A malicious AGENTS.md file in a Downloads folder got Codex to run npm malware in over 90% of tests, and a separate Claude Code attack leaked login tokens. Here's what that means for teams shipping with AI agents.
The attack surface for AI coding agents isn’t the model or the API key. It’s the folder where your browser dumps everything you download. The Hacker News reports that a malicious AGENTS.md file placed in a Downloads folder caused Codex to execute npm malware in more than 90% of tests, and that a separate Claude Code attack exposed login tokens.
What actually happened
The mechanics are mundane, which is what makes them work. AGENTS.md is a convention, not a security boundary: it’s a plain instruction file that agents read to learn project context, and nothing in the format distinguishes a legitimate one from a hostile one. An agent that treats any AGENTS.md it encounters as trusted guidance will follow it, and following it here meant running npm packages that carried malware.
The test results are the part worth sitting with. Codex complied in over 90% of trials, which is not a flaky edge case or a one-in-a-thousand jailbreak. That’s close to deterministic behavior. The Claude Code incident is a different vector with a similar shape: an attack that ended with login tokens exposed, meaning the blast radius extended past the sandbox into whatever those credentials unlocked.
Both cases share one property. Neither required the attacker to compromise a model, a vendor, or a package registry. The payload arrived as a file, and the agent’s job is to read files.
Why this lands on people who don’t run agents all day
If you’re a developer using Codex or Claude Code, the practical question is whether your setup lets an agent read arbitrary paths. Downloads is the default destination for every PDF, zip, and spec sheet a marketer or PM sends you, and it’s rarely treated as untrusted input. Most teams have spent years hardening CI pipelines and dependency pinning while leaving the human’s home directory wide open to anything that can read it.
For marketers and site owners, the exposure is indirect but real. Agents increasingly touch content repos, WordPress theme directories, and deployment scripts. A token leak from a Claude Code session is a token leak into whatever that session could reach, and that can include a CMS admin, a hosting panel, or a git remote. You don’t have to be the one running the agent to inherit the consequences.
The uncomfortable conclusion is that prompt injection has stopped being a research curiosity and become an ordinary file-handling problem. We already know how to handle untrusted files. We just haven’t applied that instinct to the documents we feed our agents.
The controls that would have helped, and why teams skip them
None of this requires exotic defense. It requires treating agent context files as untrusted input and scoping what an agent can read and execute. In practice that means a few unglamorous changes:
- Restrict agent working directories to the project root instead of the whole home folder, so a stray AGENTS.md in Downloads is never in scope.
- Require explicit approval before any package install or shell command an agent proposes, rather than auto-running it.
- Keep credentials out of the agent’s environment and rotate anything a session could have touched after an incident.
- Treat downloaded instruction files the way you’d treat an emailed attachment from a stranger.
The reason teams skip these is friction. Approval prompts interrupt flow, and scoping directories means thinking about what the agent actually needs. That tradeoff is fine until a single downloaded file turns a helpful assistant into an npm installer running with your permissions.
What to watch next
The interesting question is whether agent vendors respond at the format level or the runtime level. Format-level fixes, like signing AGENTS.md files or requiring them to live inside a declared project root, are cheap and would blunt this specific attack. Runtime-level fixes, like sandboxing execution and gating installs behind confirmation, address the broader class. The 90%-plus compliance rate suggests the runtime layer is where the real work sits, because an agent that will follow instructions from any file it can read is one configuration mistake away from doing something you didn’t ask for.
Watch for whether Codex and Claude Code publish guidance on directory scoping and install approval, and whether the AGENTS.md convention gains any notion of provenance. Until then, the safest assumption is that any file an agent can read is a file that can give it orders. That’s a strange sentence to write about developer tooling, but it’s where the tooling currently is.
Source: The Hacker News
