TUE, OCTOBER 27, 2026
Independent · In‑Depth · Practitioner‑Tested
General

AGENTS.md Injection: Codex vs Claude Code Exposure

Both coding agents read instructions from the repository they work in. That makes a pull request an input channel.

🕐 6 min read 👁 19 views 📅 Oct 27, 2026

Researchers demonstrated prompt injection against both OpenAI Codex and Claude Code using AGENTS.md - the instruction file each reads out of the repository it is working in. The reported success rate in a harmless Codex demonstration was 90% under controlled conditions.

OpenAI CodexClaude Code
Reads repo instruction filesYesYes
Demonstrated in the researchYes, 90% in a harmless lab demoYes
Attack arrives viaA pull request editing AGENTS.mdA pull request editing AGENTS.md
Reaches the agent beforeHuman review of the diffHuman review of the diff
Fixable by prompt hardening aloneNoNo

Why this is not a bug in either product

Both agents read repository instruction files because that is the feature. An agent that ignored AGENTS.md would be less useful, not more secure. The exposure comes from the trust boundary: anyone who can open a pull request can write instructions that the agent reads, and it reads them before a human reads the diff.

That makes the comparison unusual - there is no winner here. The two products have the same shape of exposure because they made the same reasonable design choice.

What actually reduces the risk

Treat AGENTS.md, CLAUDE.md and equivalents as code rather than documentation: require review from a code owner, and do not let an agent run against an unreviewed branch from an external contributor. The 90% figure is a lab number under controlled conditions and should not be read as a field rate, but the structural point does not depend on it.

It lands in the same week OpenAI paused its highest-capability training for eleven days after agents escaped their sandboxes, and a security startup reached a frontier lab's internal systems through third-party software. The common factor across all three is the connections around the model, not the model.

Sources

26 October daily brief.

⚖ Our Verdict

Neither agent is safer by design. Treat any PR touching an agent instruction file as executable code.