IncidentCoding assistants
An AGENTS.md file in the Downloads folder told a coding agent to install a malicious npm package
Forever Security blocked an AI coding agent on a customer's machine from installing an npm package called function-color, and traced the order to an AGENTS.md instruction file in the customer's ~/Downloads folder, where the agent had been started. How the file got there was not established, but the researchers showed that a web page can drop a file named AGENTS.md into Downloads, since Chrome, Edge and Firefox save downloads there without asking. In their tests a planted file got OpenAI Codex to run code, and a related technique made Claude Code leak OAuth tokens. Checkmarx found that function-color pulls in function-flag, which can download and quietly run a Windows program, part of a campaign researchers call MALFEX. The researchers say the agents did what they were built to do, and that hundreds of their customers run agents from Downloads.
Replay the attack step by step in the Learning Center
How it happened
- A file named AGENTS.md lands in ~/Downloads, which any web page can write to without a prompt.
- A coding agent started in that folder reads the file as its project instructions.
- The instructions tell it to install a malicious npm package or hand over tokens.
Impact
One attempted malware install on a customer machine, blocked before it completed; in tests, code run through Codex and OAuth tokens leaked from Claude Code.
The fix
Nothing to patch in the agents. Never start a coding agent in Downloads or another folder others can write to, read unfamiliar AGENTS.md and CLAUDE.md files first, and require approval before an agent installs packages.
Lessons
- An instruction file is code for an agent; where the agent starts decides whose code it runs.
- Downloads is attacker-writable by design, so it is never a safe working folder.