Minimal editorial cover: white background with an open folder and a plain document page with a small warning motif in muted amber and gray

A File in Downloads Can Hijack AI Coding Agents, Researchers Warn

Security firm Forever Security found a malicious AGENTS.md file in a developer Downloads folder that tricked AI coding agents into installing malware or handing over login tokens, with Codex running the payload in over 90 percent of tests.

Security and governanceAI Coding AgentsCodexClaude Code

A plain text file sitting in a developer’s Downloads folder can hijack an AI coding agent. That is the finding of security firm Forever Security, reported on October 26, 2026: a malicious AGENTS.md file, discovered on a real customer’s machine, tried to make a coding agent install a known-malicious npm package, and the firm’s software stopped it before any code ran. Nobody knew how the file got there.

The file is the kind of document developers write every day. AGENTS.md is a plain-text instructions file that a coding agent reads when it starts in a project folder: coding conventions, project structure, how to run tests, what not to touch. The agent is built to trust it. That trust, combined with one ordinary property of the Downloads folder, is what makes the attack work.

“This is not ordinary malware,” wrote Forever Security researchers Gal Weizman and Omer Samet. “An AGENTS.md is a file a coding agent is built to trust and obey, and ~/Downloads is the one folder a website can drop a file into with no click and no permission. Together, that lets the web plant orders your own agent carries out. Markdown is the new executable.”

How the attack works

Websites can save files to Downloads without approval. Operating systems will not run a downloaded program until the user approves it, but that protection does not apply to plain text. An agent launched in that folder reads the instructions file it finds there, as if the user wrote it.

In Forever Security’s testing, the planted document ran to 13 KB, and its length and mundane tone helped it get through: a short request to install a package gets refused, while a long document disguised as ordinary engineering guidelines does not. Codex follows an AGENTS.md only in a folder it trusts, and Downloads qualifies once the user has worked there. When Codex was opened in that folder and given any task, it first changed its own settings and then installed the package named in the file.

“In our testing, Codex ran the malware in more than 90% of attempts,” the researchers found. Most of the testing used a harmless stand-in that only opens a calculator, and the malicious package itself was run once inside an isolated virtual machine. The package was function-color, part of a malicious npm campaign that, according to Checkmarx, went unnoticed for about two years before it was documented; npm has since removed the package. The settings Codex changes apply to the whole computer, so every later Codex session runs the attacker’s command, whichever project the user opens.

Claude Code was harder, but not safe

To find out whether the problem went beyond one product, the researchers created their own CLAUDE.md, the equivalent file for Anthropic’s Claude Code, inspired by the attacker’s document. Claude Code was much harder to fool, they noted, and the attack that worked looks nothing like the Codex one.

Claude Code sends its requests over the internet to Anthropic’s AI model. The researchers’ file asks the agent to save a small settings change, presented as a company’s internal gateway, that sends those requests to a server the attacker controls. Claude Code normally asks a person to approve a change like this and often refuses ones that look wrong. “In our testing, Claude followed through on this about 50% of the time,” the team said.

Each request carries the user’s login token, a digital key that keeps the user signed in. When the researchers replayed a captured token against Anthropic’s service, they were treated as the victim and took over the account without running any code. The next time Claude Code starts in that folder, the attacker’s server can pose as the AI model and tell the agent to run commands with its sandbox turned off. The file also tries to get Claude Code to start a helper agent, which connects through the attacker’s server right away, and that let the researchers run code within the same session in about a fifth of tests.

The pattern is not isolated. NVIDIA’s AI Red Team separately discovered an indirect AGENTS.md injection vulnerability in OpenAI Codex, in which a compromised Go library detected the Codex environment and wrote a malicious AGENTS.md file instructing the agent to inject a delay into functions while concealing the change from pull-request summaries. The mechanism differs, but the lesson is the same: a trusted instruction file can redirect an agent, and hide the redirect from the human reviewing its work.

There is nothing to patch, the researchers say

“There is nothing here for OpenAI or Anthropic to patch,” Weizman and Samet argue. An agent that obeys the instructions file in its folder is doing its job, the same way a browser that shows a phishing page is working as designed. That leaves the gap open, and users have to defend against it themselves.

That framing shifts responsibility from the vendor to the user, and from a fix to a habit. The researchers’ advice is practical rather than technical: do not start any coding agent in the Downloads folder, and read any AGENTS.md or CLAUDE.md file you did not write before letting an agent near it, including in a code repository you have just copied. Check agents’ settings files for servers or web addresses you did not add. Keep approval prompts and sandboxes switched on, and treat any instruction telling an agent to get around them as suspicious.

The exposure is not hypothetical. Forever Security’s data shows that about half of its customers run a coding agent inside the Downloads folder, and about a quarter of agent sessions open a browser. And a lot of browsing is now done by agents working on their own while nobody watches the screen, so the agent itself can visit the page that drops the file, making the agent both the target and the weapon in this attack.

Why it matters

The two stories in this round share a theme, and it is the theme of the AI security moment: the weakest link is rarely the model. It is the file the agent trusts, the folder the browser can write to, the third-party tool nobody reviewed, the token that never expires. AI coding agents are powerful precisely because they act on instructions without asking the user about every step, and that power is exactly what a planted instruction file borrows.

For developers, the fix costs nothing: never run an agent from Downloads, and never let an agent read an instruction file you have not read yourself. Anyone who finds a planted file should assume the login token leaked and replace it; a machine where function-color ran should be treated as compromised. For teams, the fix is a policy: treat AGENTS.md and CLAUDE.md files in any repository, including internal ones, as code that needs review, because to the agent, that is what they are. And for the industry, the question is harder: if instruction files are executable in practice, when do they start getting the same scrutiny as executables, in code review, in supply-chain tooling, and in the agent’s own trust model?

Until then, Downloads remains a place where files arrive uninvited. The difference now is that something there may be waiting for an agent to arrive and obey it.