One GitHub Issue Was Enough to Hijack Claude Code, Gemini CLI and Codex in CI. 6 Rules to Stay Safe
AI coding agents in CI: 2026 so far Feb Clinejection one issue title led to a malicious npm release, live ~8 hours Apr Comment and Control PR titles and hidden comments steered 3 vendors' agents Jun CVE-
AI coding agents in CI: 2026 so far
Feb Clinejection one issue title led to a malicious npm release, live ~8 hours
Apr Comment and Control PR titles and hidden comments steered 3 vendors' agents
Jun CVE-2025-66032 claude-code-action trusted any actor ending in "[bot]"
Aug Black Hat USA Claude Code (CVE-2026-54316), Gemini CLI (CVSS 10.0), Codex
Every attack on that list started the same way: someone wrote text where an agent would read it. An issue, a PR title, a comment. No stolen password, no zero-day in the runner.
At Black Hat USA in August, researchers from Novee showed that a single untrusted GitHub issue could compromise AI coding agents from Anthropic, Google and OpenAI, each running in its vendor's own repositories with default settings. All three vendors have since shipped fixes. The pattern behind it hasn't gone away.
What actually happened
Claude Code (CVE-2026-54316). A prompt injection delivered through a GitHub issue led to remote code execution on the runner, letting the attacker read files and steal GitHub and Anthropic API credentials. One reported path used an approved web-fetch destination as a channel to carry data out. Anthropic patched it; versions from 2.1.163 are reported as fixed.
Gemini CLI (rated CVSS 10.0). A crafted .gemini/.env file could run commands on the CI host before the sandbox started. Google fixed it in Gemini CLI 0.39.1 and the run-gemini-cli action 0.1.22, and changed its trust model for non-interactive runs, a breaking change.
Codex. In a two-stage workflow, attacker text from an issue was written into AGENTS.md in the first stage, then loaded as trusted instructions by the second. OpenAI separated the stages and now documents that file as untrusted input.
Earlier in the year, the "Comment and Control" research by Aonan Guan showed the same idea across Claude Code Security Review, Gemini CLI Action and GitHub Copilot Agent: PR titles, issue comments and hidden HTML comments could steer the agent into printing secrets into a comment or log.
In CI, every field a stranger can type into is part of your agent's prompt.
Why CI makes this worse
On your laptop, a confused agent is annoying. In CI, it's dangerous for three reasons:
-
Nobody's watching. There's no human to say "wait, why are you reading
/proc/self/environ?" - Strangers write the input. On a public repo, anyone can open an issue.
- The runner holds the keys. Tokens with write access, API keys and sometimes publish rights are right there in the environment.
That's how the Clinejection chain worked: one issue title led to an npm token being stolen and a malicious [email protected] being published, live for roughly eight hours before it was pulled.
6 rules for agents in your workflows
1. Give the agent no write credentials by default. Start every workflow from read-only and add only what that job needs:
permissions:
contents: read
issues: read
pull-requests: read
2. Don't let strangers trigger it. Run the agent only for maintainers or trusted collaborators, and never configure "allow any user" options (the June advisory involved allowed_non_write_users: "*"). Check github.event.comment.author_association before the agent step runs.
3. Treat every repository field as untrusted. Issue bodies, PR titles, comments, branch names, and files the PR itself changes, including AGENTS.md, .gemini/ and other agent config. Don't let a PR edit the instructions the agent will follow when reviewing that same PR.
4. Separate stages, and don't share writable files between them. If stage one writes something stage two reads as instructions, an attacker only has to fool stage one. That's the Codex lesson.
5. Pin and patch. Pin third-party actions to a full commit SHA, not a floating tag, and keep agent CLIs and actions on current versions. Several of these bugs were fixed months before people stopped running the vulnerable versions.
6. Put a human between the agent and anything irreversible. Releases, publishes, credential use and pushes to protected branches should need an explicit approval. Add egress limits where you can, so a hijacked agent can't send data anywhere it likes.
Your 10-minute audit
Open .github/workflows/ and, for every workflow that calls an AI agent, answer four questions:
1. Who can trigger it? (anyone / contributors / maintainers)
2. What permissions does it get? (look for write)
3. What secrets are in its environment?
4. Does anything it reads come from a PR or issue author?
Any workflow where the answers are "anyone," "write," "lots," and "yes" is the one to fix today.
The bottom line
None of these attacks needed to beat a firewall. They only needed the agent to read text and act on it, which is exactly what agents are built to do. The defense isn't a smarter model. It's giving the agent less to lose when it gets fooled.
Do you run an AI agent in CI? Which of the six rules would your setup fail? Tell me in the comments.
If this was useful, follow for practical, sourced pieces on working with AI agents.
Sources
- [1] eSecurityPlanet, "Black Hat 2026: Critical Flaws Found in Anthropic, Google, and OpenAI Coding Agents," August 6, 2026 (research by Novee).
- [2] PointGuard AI, "GitHub Issues Turn AI Coding Agents Against CI/CD (CVE-2026-54316, CVE-2026-12537)," incident AISSI-26-100.
- [3] Cloud Security Alliance AI Safety Initiative, "AI Agent Prompt Injection: The New CI/CD Supply Chain Threat," June 2026 (covers CVE-2025-66032, Comment and Control, Clinejection).
- [4] PointGuard AI, "AI Agents Read the Comments, Then Spill Secrets," incident AISSI-26-066 (Comment and Control, research led by Aonan Guan).
This story was written with the help of AI.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.