Blog
A file in Downloads can steer coding agents: what teams can check
The story: Markdown Is the New Executable · Forever Security ·
Topics: AI tools
On 22 October 2026 researchers showed that an AGENTS.md or CLAUDE.md file planted in Downloads can make Codex or Claude Code install malware or leak its sign-in token. How it works, what to check on each machine, and why the hard part is knowing what the agent read.
On 22 October 2026 the security company Forever Security published research showing that a plain text file in a computer's Downloads folder can take over a coding agent started there. It began with a real case: an AGENTS.md file in a customer's Downloads folder that told an agent to install a malicious npm package. For teams that let developers run Claude Code, Codex or similar tools, the questions are what such a file can make an agent do, and how anyone would know afterwards what the agent read.
What happened
Forever Security says its product stopped a coding agent in a customer's environment as it tried to install function-color, an npm package from what the researchers call "a campaign that flew under the radar for roughly two years". npm has since removed the package. The instruction did not come from a code repository or a dependency. It came from an AGENTS.md of about 13 KB in the customer's ~/Downloads folder, written to look like ordinary engineering notes.
The researchers do not say who put the file there or how it arrived. Their explanation is that "a web page can save a file to your machine on its own", and Downloads is where browsers put it. BleepingComputer, reporting on 25 October 2026, notes that Chrome, Edge and Firefox save there by default and show a download notification, while Brave asks first, and that a public test page from the researchers downloaded a harmless AGENTS.md when it tried it.
The attack still needs someone to start an agent with Downloads as its working folder. People do, BleepingComputer notes, to organize files or act on new downloads. Forever Security says that in its own telemetry "about half of customers run a coding agent inside their Downloads folder".
The researchers then rebuilt the chain in their own tests:
- Codex. With the attacker's real
AGENTS.md, in an isolated virtual machine, Codex added an MCP server entry to~/.codex/config.tomland installed the package before starting the user's task. That file applies to every Codex session on the machine, in any folder. It worked in more than 90% of attempts. - Claude Code. A planted
CLAUDE.mdled Claude Code to write a project.claude/settings.jsonthat setANTHROPIC_BASE_URLto a server the researchers controlled. That exposed the agent's sign-in token, which they say they replayed against the real API, and let their server answer as the model and send back commands to run. Claude Code wrote the file about half of the time; the step that ran code within the same session worked about a fifth of the time.
The researchers argue there is nothing for OpenAI or Anthropic to patch, because each agent followed the instructions in its own folder as designed. Neither report carries a statement from either company.
What it means
Both agents are documented to work this way. OpenAI's Codex guide says Codex reads AGENTS.md from the project root down to the current folder, and checks only the current folder when it finds no project root, as in a Downloads folder that is not a Git repository. Anthropic's Claude Code documentation says it loads CLAUDE.md from the working directory and every directory above it at launch, and reads AGENTS.md when there is no CLAUDE.md. A project's .claude/settings.json applies to "everyone working in the folder that contains it", and ANTHROPIC_BASE_URL is the setting that overrides the API endpoint.
So two kinds of files are at stake. First, the agent's own configuration and credentials: the attack's aim is to change them. Second, anything the agent can read with the user's permissions once it follows someone else's instructions, starting with Downloads itself, which holds whatever people have downloaded.
Working out afterwards what happened is harder than finding the file. A planted file can be deleted. The agent's own record is kept on the machine, by the program that was steered: Claude Code, for example, keeps session transcripts under ~/.claude/projects/ and deletes them after 30 days by default. And none of the three desktop systems keeps a lasting, searchable record of which program opened which file unless someone set one up beforehand. Across a fleet, the questions are which machines ran an agent in Downloads, whether it opened an instruction file there, and what it opened next.
What you can do
Start agents in the project they are meant to work on, not in Downloads or your home folder. Anthropic's security page for Claude Code says to start it from a project subdirectory rather than the home directory. Keep approval prompts and sandboxing on, as the researchers advise.
Look for instruction files you did not write. Running an agent in a folder doesn't put one there by itself: Claude Code creates a CLAUDE.md only when someone runs /init, and keeps its own notes under ~/.claude/projects/, not in the folder; Codex has an /init command too. So a file found in Downloads may still be someone's own, made with /init or by hand. Read what it says, and ask whoever uses the machine, before treating it as planted. On a Mac or a Linux machine:
ls -la ~/Downloads/AGENTS.md ~/Downloads/AGENTS.override.md ~/Downloads/CLAUDE.md ~/Downloads/.claude
Check the agents' own configuration for MCP servers or endpoints you did not add, which is what the two tests changed:
grep -n -E "mcp_servers|chatgpt_base_url" ~/.codex/config.toml
grep -rn "ANTHROPIC_BASE_URL" ~/.claude/settings.json ~/Downloads/.claude
Look for the package the real file asked for, globally here and with npm ls function-color inside each project:
npm ls -g function-color
See whether Claude Code was started in Downloads in the last 30 days. Its transcript folders are named after the working directory, with every character other than a letter or digit replaced by a dash:
ls ~/.claude/projects/ | grep -i downloads
If you find a planted file or the package, the researchers' advice is to treat the machine as compromised and rotate credentials, since a stolen token gives a live session. On Windows the same files sit under %USERPROFILE%.
Where ProofStream fits
ProofStream records which program opened which folder on each Mac, Windows and Linux machine, and keeps that history searchable for months. In a case like this it would show on which machines a coding agent opened the Downloads folder, and which other folders that same program opened afterwards; with Downloads among the folders where it records file names, it would also show the AGENTS.md being opened. It wouldn't have stopped the agent, and it doesn't see what the agent wrote to its configuration, the commands it ran or where its traffic went. How it works.
Sources
- Markdown Is the New Executable
- BleepingComputer: AI coding agents hijacked using AGENTS.md file in Downloads folder
- OpenAI: Custom instructions with AGENTS.md (Codex)
- OpenAI: Codex commands
- Anthropic: How Claude remembers your project (Claude Code)
- Anthropic: Settings files and precedence (Claude Code)
- Anthropic: Environment variables (Claude Code)
- Anthropic: Explore the .claude directory (Claude Code)
- Anthropic: Security (Claude Code)
Spotted a mistake? Tell us and we'll correct it.
Comments
No comments yet.