On Oct 22, Forever Security researchers Gal Weizman and Omer Samet reported that they had stopped Codex on a real customer machine as it tried to install the known-malicious npm package function-color, following an AGENTS.md in ~/Downloads the customer had never seen. A web page can drop a file into Downloads with no click, and an agent started there obeys it. In their reproduction Codex rewrote the machine-wide ~/.codex/config.toml to register a malicious MCP server in more than 90% of attempts; a CLAUDE.md they crafted made Claude Code point ANTHROPIC_BASE_URL at an attacker server and leak its OAuth token about half the time. The researchers say there is no vendor bug to patch; The Hacker News and others covered it on Oct 26.
Key Takeaways
- ✓Real case: a 13 KB AGENTS.md disguised as engineering guidelines sat in a customer's ~/Downloads and told Codex to install the malicious package function-color (since removed by npm)
- ✓Codex path: it appends a project-tools MCP server to the machine-wide ~/.codex/config.toml, then spawns a child codex exec with --dangerously-bypass-approvals-and-sandbox; it worked in over 90% of tests and the server then loads in every session on the machine
- ✓Claude Code path: a CLAUDE.md gets ANTHROPIC_BASE_URL written into .claude/settings.json about 50% of the time, leaking the OAuth token on every request; about a fifth of the time it also reached code execution in the same session
- ✓Forever's telemetry shows about half of customers run a coding agent inside Downloads, and about a quarter of agent sessions open a real browser
- ✓Advice: never start an agent in Downloads, read AGENTS.md/CLAUDE.md files you did not write, check agent configs for unknown MCP servers or API endpoints, keep approvals and sandboxes on, and rotate tokens if you find one (write-up)
Key Decision Metrics at a Glance
Heavy Claude Code use: compare subscription limits and API bills
Compare 40 dev plans & simulate token costs vs $20/mo subscriptions
Project Links & Resources
Direct AccessIn-Depth Technical Analysis
Background and pain point
Coding agents read the AGENTS.md or CLAUDE.md in their working folder on startup and follow it; that is what the files are for. The catch is that ~/Downloads is the one folder a web page can write to with no click and no permission, and OS protections against downloaded executables do not cover Markdown. Forever Security sums it up as "Markdown is the new executable."
What changed under the hood
It started with a real alert: Forever blocked Codex on a customer machine from installing function-color, a known malicious npm package from a campaign that went unnoticed for about two years, and traced the order to an AGENTS.md in Downloads the customer had never seen. The file is a long, bland "Engineering Work Guidelines" document. The attack section, framed as local environment setup, tells Codex to append a project-tools MCP server to the machine-wide ~/.codex/config.toml before handling the user's request, using launchctl to run npm install outside Codex's control, and then to spawn a child codex exec with --dangerously-bypass-approvals-and-sandbox to "confirm the server initialized." That works around startup-only server loading, the command network sandbox and the handshake timeout. Codex only obeys AGENTS.md in a trusted folder, but Downloads qualifies once you have worked there, and because the write lands in the global config, the server keeps loading in every other folder.
Claude Code was harder to fool. Using the real sample as inspiration, the researchers wrote a CLAUDE.md posing as an internal model gateway that gets Claude to write ANTHROPIC_BASE_URL into .claude/settings.json. Claude's API traffic then goes to the attacker's server, leaking the OAuth token, and that server can answer as the model with a Bash tool call that sets dangerouslyDisableSandbox, giving code execution on the next launch.
Benchmarks
All numbers come from Forever's own tests, not a third-party evaluation. Codex, given the real attacker file and the real package inside an isolated VM, ran the malware in more than 90% of attempts. Claude Code wrote the reroute about 50% of the time and reached same-session code execution through a subagent about a fifth of the time. The same CLAUDE.md failed every time in a folder full of security notes, where a spawned subagent flagged it as an attack. Forever's telemetry shows about half of customers run a coding agent inside Downloads and about a quarter of agent sessions open a real browser.
How to try it
The researchers say there is nothing for OpenAI or Anthropic to patch, since the agents behave as designed, so the defense is on you: never start Codex, Claude Code or any agent in ~/Downloads; read any AGENTS.md or CLAUDE.md you did not write; check ~/.codex/config.toml for unexpected [mcp_servers.*] blocks or a changed chatgpt_base_url, and a project's .claude/settings.json for ANTHROPIC_BASE_URL or proxy entries; keep approval gates and sandboxes on and distrust instructions to bypass them; and treat any machine with function-color installed as compromised and rotate tokens. Full technical details are in the Forever Security write-up.
Benchmark side-by-side against alternatives, or calculate monthly token cost vs subscription break-even.
Discussion & Comments
0Sign in to join the discussion
Connect with AI developers to exchange benchmark insights.