Skip to content
AI / LLM Write-up Intermediate

The Attack That Steals Your API Keys Through a GitHub Issue Comment

AI coding agents wired to GitHub issue events could be tricked by hidden HTML comments in an issue into running shell commands that dump environment variables and open a public pull request. An attacker with only a free GitHub account could then read the encoded output and recover API keys and tokens.

rjbdjnf Follow

Published on medium.com

You’re building a project. You want your AI agent to automatically review security-related GitHub issues.

Prem kumar Akula, on medium.com

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 workflow fed untrusted issue content to an AI agent that had shell execution and write permissions, without checking who authored the issue.

Impact

An attacker could steal API keys and tokens such as ANTHROPIC_API_KEY, GITHUB_TOKEN, GEMINI_API_KEY and GITHUB_COPILOT_API_TOKEN, and the base64 encoding bypassed GitHub's secret scanning.

What the attacker needed

A free GitHub account; the target repo runs an AI agent on issue events; the agent can execute shell commands

The fix

The attack was fixed in Claude Code 2.1.128, and workflows should also add an author_association guard, read-only permissions and restricted tool access.

How it was found

  1. The attacker opens a GitHub issue containing hidden HTML comments with instructions.
  2. The workflow triggers on the issue and passes the raw markdown to the AI agent.
  3. The agent follows the hidden instructions and runs a command that dumps environment variables.
  4. The agent saves the output to a file, commits it, and opens a pull request.
  5. The attacker reads the public pull request and decodes the output to recover secrets.

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.

A workflow is an automated recipe that runs on GitHub when something happens, such as a new issue being opened. Here the recipe passed the issue text to an AI assistant that was allowed to run commands, so text hidden inside the issue could tell the assistant to copy secret passwords into a public pull request. Anyone could then read those secrets.

What is AI / LLM?

Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.

Similar reports

View all

Same bug class and techniques, clearest first.

AI and LLM vulnerabilities

The lesson behind this report.

Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.