Browse / MCP and Tool Server Flaws / AML.CS0067
Claude Code GitHub Action Secret Exposure
- Target
- Claude Code GitHub Action (Exercise)
How it worked
- Reconnaissance · Search Open Websites/Domains: Code Repositories
The researchers analyzed the Claude Code Action codebase and the obfuscated Claude Agent SDK. They used the implementation details to understand how agent tools executed and where security boundaries were applied.
- Discovery · Discover AI Agent Configuration: Tool Definitions
The researchers identified the tools available to Claude Code Action and compared their execution paths. They determined that Bash subprocesses could run within Bubblewrap with a scrubbed environment, while the built-in Read tool performed direct, in-process file access outside that isolation boundary.
- Discovery · Discover AI Agent Configuration: Activation Triggers
The researchers identified that Claude Code Action could be triggered by GitHub events involving issues, pull requests, and comments and that the action would fetch the associated content into Claude's context.
- AI Attack Adaptation · LLM Prompt Crafting
The researchers crafted a prompt tailored to Claude Code Action framed as a compliance task that directed Claude to read a credential from its environment and emit it.
- Initial Access · Prompt Infiltration via Public-Facing Application
The researchers introduced the malicious prompt through attacker-controlled GitHub content processed by the lab workflow, modeling delivery through an issue body, pull request description, or comment handled by Claude Code Action.
- Execution · LLM Prompt Injection: Indirect
Claude Code Action incorporated the malicious GitHub content into the model context. Claude interpreted the malicious content as instructions and followed the supplied instructions.
- Defense Evasion · LLM Jailbreak
The prompt used benign compliance review framing and instructions to remove the credential prefix to bypass Claude's refusal behavior for emitting a recognizable API key.
- Execution · AI Agent Tool Invocation
Claude invoked its built-in Read tool on
/proc/self/environ. Read did not execute within the Bubblewrap and scrubbed-environment boundary applied to Bash subprocesses. - Credential Access · AI Agent Tool Credential Harvesting
The Read tool returned the action process's unsanitized environment, including
ANTHROPIC_API_KEYand potentially other credentials available to the workflow. - Collection · Data from AI Services: Conversation Context and Memory
Claude emitted the Anthropic API key after removing its
sk-ant-prefix. The transformation prevented GitHub's secret scanner from recognizing the credential, while the researchers could reconstruct the original key by restoring the prefix. - Exfiltration · Exfiltration via AI Agent Tool Invocation
The researchers could use WebFetch, Bash, GitHub MCP, and Action logs as potential exfiltration channels depending on the tools available in the workflow configuration.
Summary
The Microsoft Defender Security Research Team demonstrated that Anthropic's Claude Code GitHub Action could expose CI/CD workflow secrets when processing GitHub content, such as issue bodies, pull request descriptions, and comments, containing prompt injections.
The researchers analyzed the Claude Code Action codebase and obfuscated Claude Agent SDK to understand how agent tools executed and how GitHub events supplied content to the agent. They crafted a prompt framed as a compliance review that directed Claude to read a credential from its process environment, remove the credential prefix, and emit the transformed value. They introduced the prompt through attacker-controlled GitHub content processed by the lab workflow. The action fetched the malicious content into Claude's context, where it was interpreted as instructions.
Claude invoked its Read tool against /proc/self/environ, returning the action process's unsanitized environment, including ANTHROPIC_API_KEY. Unlike Bash subprocesses, Read operations did not execute within the Bubblewrap sandbox and scrubbed-environment boundary. Removing the key's sk-ant- prefix allowed the output to bypass Claude's refusal behavior and GitHub's secret-pattern detection while remaining reconstructable by the researchers. Microsoft identified WebFetch, Bash, GitHub MCP, and GitHub Actions logs as potential additional exfiltration channels depending on workflow configuration.
Microsoft disclosed the issue to Anthropic through HackerOne on April 29, 2026. Anthropic mitigated the vulnerability in Claude Code 2.1.128 on May 5, 2026, by blocking Read access to sensitive /proc files.
References
Source: MITRE ATLAS case studies, used under Apache 2.0.