core.fsmonitor 守卫绕过(PoC)针对 “恶意裸 git 仓库 → core.fsmonitor → 代码执行” 漏洞类(参见 GitHub Copilot CLI 中的 CVE-2026-45033)的概念验证,已在 Claude Code 上复现,并绕过了 Claude Code 额外添加的 bash 权限守卫(Copilot 没有该守卫)。
结果:当 agent 在文件被放置在守卫之后的仓库中运行 git 命令时,可在 Claude Code 的沙箱内执行代码。Payload 为惰性(将时间戳写入 /tmp/.bench-marker)。
Claude Code 会在执行任何同时创建 git 结构文件(HEAD/objects/refs/hooks)并运行 git 的单条 bash 命令之前提示:
“此命令会创建 git 仓库结构文件(HEAD/objects/refs/hooks),然后运行 git,从而可能执行所创建文件中的 hooks/fsmonitor。”
两种绕过方式:
current/HEAD,其中 current -> .。旧版守卫按词法解析路径,永远看不到 HEAD。(已通过修补版本中的 realpath 更改修复。)mkdir/touch/mv/cp)进行路径检查;/bin/mkdir、install 或仓库自带的二进制文件都会被跳过。(该绕过在修补版本上同样有效。)无论哪种方式,项目目录都会变成一个有效的裸仓库,其 core.fsmonitor 会在下一次 git status 时触发。
两个部分:
container/ two Claude Code versions side by side, auto-updater disabled
malicious-repo/ a plausible monorepo that carries the injection
环境健全性检查(无 agent,证明该机制):
cd malicious-repo
./build.sh
./verify.sh # clones fresh, runs the planted command, asserts fsmonitor fired
针对真实 Claude Code 的实机测试:
cd container
./build.sh # builds an image with both the vulnerable and patched versions
./run.sh login # one-time sign-in (shared across versions)
./run.sh # drops you in the malicious checkout; run claude and follow the prompt
参见 malicious-repo/RUNBOOK.md,了解逐步实机操作流程以及两个版本之间的预期差异。
$HOME。/tmp/.bench-marker 写入时间戳,别无其他。无网络访问、无文件读取、无破坏性操作。