A text file in your Downloads folder can hijack your AI coding agent. How do you check yours?
· Zero Agency
You did nothing wrong. You visited a website, closed the tab, then opened your coding agent in the Downloads folder to unzip something and ask a quick question.
Before it answered, the agent had already rewritten its own settings and installed a package you never asked for.
That is not a thought experiment. It happened on a real customer machine, and it worked on the two most popular coding agents in testing.
TL;DR
- Forever Security found a malicious AGENTS.md in a customer's
~/Downloadsfolder. It told OpenAI Codex to installfunction-color, a known malicious npm package. Their product blocked it before the code ran. - In their tests, Codex followed the planted file and ran the payload in more than 90% of attempts. A similar CLAUDE.md got Claude Code to send its traffic, including the login token, to an attacker server about 50% of the time.
- The file contains no code. It is plain Markdown that your agent reads as orders.
- What to do today: never start an agent in Downloads, read any AGENTS.md or CLAUDE.md you did not write, check your agent config for servers you did not add, and rotate your token if you find anything.
What actually happened?
Coding agents read an instructions file when they start in a folder. Codex reads AGENTS.md. Claude Code reads CLAUDE.md. That is a feature: it is how you tell the agent your project's rules.
The researchers, Gal Weizman and Omer Samet, point out the gap. A web page can save a file into your Downloads folder without a click, and it picks the name and the contents. Your operating system blocks downloaded programs until you approve them. It does not block a text file.
So a website can drop a file named AGENTS.md into Downloads. Later you open an agent there. The agent does what the file says.
The real file was a 13 KB document titled like normal engineering guidelines. The attack sat in one section near the end, framed as routine setup for a "project tools" server. Help Net Security notes that the length and boring tone are the point: a short, direct request to install a package gets refused.
Does this work on Codex and Claude Code?
Yes, in different ways.
Codex. Codex only follows an AGENTS.md in a folder it trusts, and Downloads counts once you have worked there. Given any task, it first added a server to ~/.codex/config.toml and then installed the package. That config is machine-wide. According to the Forever Security report, every later Codex session loads the attacker's server, in any project. You can leave the folder and the problem comes with you.
Claude Code. The researchers wrote their own CLAUDE.md based on the attacker's file. Claude was harder to fool. The version that worked asked it to save a settings change presented as a company's internal gateway, which pointed its model requests at a server the attacker controls. It followed through about half the time.
Every one of those requests carries the user's login token. When the team replayed a captured token against Anthropic's service, they were treated as the victim. No code needed. In about a fifth of tests they also got code running in the same session through a helper agent.
Why can't OpenAI or Anthropic just patch it?
Because nothing is broken in the usual sense. In the researchers' words, "there is nothing here for OpenAI or Anthropic to patch." The agent is doing what it was built to do: obey the instructions file in its folder.
The broken part is an assumption. You trust the folders you work in because nothing on the web could write to them. Downloads was always the exception, and it did not matter until a text file could act like a program.
There is a second twist. A lot of browsing is now done by agents with nobody watching. In Forever's telemetry, about half of customers run a coding agent inside Downloads, and about a quarter of agent sessions open a real browser. The agent can visit the page that drops the file, then obey it.
Is this the same problem as malicious agent skills?
Same family. A skill is a folder with a SKILL.md and maybe some scripts that an agent loads on demand. If an agent obeys it, a stranger can write it.
The numbers there are already bad. VirusTotal analysed 35,878 skills submitted to its platform and found 6,637 (18.5%) malicious. 62% of those had no malicious code at all. The attack was written as plain-language instructions.
Some hide it on purpose. In a follow-up post, VirusTotal found 90 malicious skills that put the instruction after hundreds of blank lines, inside an HTML comment, or in invisible Unicode. A rendered page on GitHub shows you a clean file. The agent reads all of it.
Our take: if a skill can't be read top to bottom in one sitting, don't install it. Apply that test to every skill you install, whether it comes from Super Agent Skill or anywhere else.
How do I check my machine today?
Ten minutes. Do it now, not after the next headline.
- Look for instruction files where they shouldn't be. On macOS or Linux, run
ls -la ~/Downloads | grep -iE "agents.md|claude.md". Do the same for your Desktop and any temp folder you open agents in. - Stop starting agents in Downloads. Move what you need into a real project folder first. This alone kills the attack as described.
- Read instruction files you didn't write. That includes AGENTS.md, CLAUDE.md and SKILL.md in any repo you just cloned. Read the raw file, scroll to the end, and look for HTML comments.
- Check your agent config. Open
~/.codex/config.tomland your Claude Code settings. Look for MCP servers,npxcommands or web addresses you don't recognise. - Keep approval prompts and sandboxes on. Treat any file that tells the agent to turn them off as hostile.
- If you find a planted file, rotate your token. The researchers say to assume it leaked, since a stolen token works like a live session. If
function-colorwas installed, treat the machine as compromised.
What should teams change?
Most security tooling watches what people do. This attack happens in what the agent does. Forever put it simply: "We caught this one because we were watching the agent, not the user."
At Zero Agency the whole company runs on agents, so this one is personal for us. Three rules we'd push on any team:
- An agent only starts in folders that a human created for work.
- Agent config files are reviewed like code, because they are code now.
- Agent login tokens get rotated on a schedule, not only after an incident.
FAQ
Is AGENTS.md itself dangerous? No. It is a useful convention. The danger is an agent obeying one that a stranger wrote and placed in a folder you trust.
Does this only affect Codex and Claude Code? Those are the two the researchers tested. They describe it as a property of how agents work, not one product's bug, so any agent that auto-reads instruction files is worth checking.
Will antivirus catch it? Don't count on it. The file is plain text with no code. VirusTotal found most malicious skills carry no malicious code either.
I found an AGENTS.md in Downloads. What now? Don't open an agent there. Delete the file, check your agent config for added servers, rotate your agent login tokens, and if a package was installed, treat the machine as compromised.