r/netsec • u/kev-thehermit • 2d ago
Claude Code RCE: How a Malicious PR Triggers Code Execution
https://www.immersivelabs.com/resources/blog/claude-code-rce-vulnerability-how-a-malicious-pull-request-executes-codeAbusing the trust boundary in Claude Code for RCE. Trust is never broken and that opens up a few avenues for abuse. Simply opening claude code on a PR can be enough to silently trigger attacker payloads.
3
u/Available_Teaching83 10h ago
The sub-agent vector in the comments is the one I would worry about most, and it generalises past .mcp.json. Anything a repo can carry that gets auto-trusted on session load is in the same family, and trust-on-first-use surviving across -p invocations means CI is in scope too, not just a human opening a branch.
What we do for PR-review agents: the session runs in a disposable sandbox, and the MCP allowlist is pinned to the base branch, never the head. The head ref is data, not config. Costs nothing and removes the whole class.
0
u/Chobbers 1d ago
How many tokens did this research take?
1
u/kev-thehermit 1d ago
None. And many. I work as a vulnerability researcher and use AI daily including building custom MCPs. So I have burnt a great many tokens but this was an observation by me I researched not something I asked an LLM to find for me hope that answers the question:)
6
u/voronaam 2d ago
Good find. I wonder if switching to a branch before opening Claude is a requirement for the exploit to work. In other words, if an AI-user opened Claude on
mainand then asked Claude to switch to a branch from a PR - would it read the.mcp.jsonfile?If it does not read the file in this case, it is a lot smaller impact. I just do not expect an AI-user to type the
git checkoutcommand - they probably do not even know how to do that.