Trusting Claude With a Knife: Unauthorized Prompt Injection to RCE in Anthropic’s Claude Code Action
An attacker could inject a prompt into a pull request title that Claude Code Action would process, leading to remote code execution in a privileged GitHub Actions workflow. The attacker needed a reviewer to trigger the action and could then replace the PR title with a malicious prompt.
Published on johnstawinski.com
In the 2022-era of Large Language Models (LLMs), when I used ChatGPT only as an alternative to Google Search, prompt injection was not very impactful.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the AI action trusted user-controlled input (the pull request title) as instructions without proper isolation, allowing prompt injection to influence command execution in a privileged workflow.
Impact
An attacker could achieve remote code execution within a privileged GitHub Actions workflow, potentially compromising the repository or its secrets.
What the attacker needed
Repository uses Claude Code Action; reviewer triggers the action; attacker can submit a pull request
How it was found
- Submit a pull request to a repository using Claude Code Action.
- Wait for a reviewer to trigger the action.
- Replace the PR title with a prompt injection payload.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This report is about a tool that uses an AI assistant (Claude) to help with code changes on GitHub. An attacker could trick the AI by putting special instructions in the title of a pull request (a proposed code change). If someone approved running the AI tool, those instructions could make the tool run harmful commands on the project's servers.
What is AI / LLM?
Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.