🛡️ AI Security & Dev Environments • November 2026

Malicious AGENTS.md in Downloads can hijack your coding agent

Malicious AGENTS.md hero, a Downloads folder on a laptop screen with a plain text file named AGENTS.md inside it, and a coding agent terminal window beside it reading that file, with a red warning triangle between the folder and the terminal
A plain text instruction file in Downloads can steer your agent before you type your first prompt.

A malicious AGENTS.md file sitting in a Downloads folder can turn your own coding agent against you. Security firm Forever Security caught exactly that on a customer machine, and the file had already told the agent to install a known-malicious npm package before the firm's tooling stopped it. The attack needs no click from you, and no patch exists for it, because the agent is doing what it was built to do. This guide shows you how to check your machine and close the gap in about 10 minutes.

⚡ Key Security Takeaways
  • Zero Operating System Patch: The agent is working as designed by executing instruction files in its working directory. No CVE exists for the agent behavior.
  • Folder Trust Vulnerability: Web browsers can write files into Downloads without explicit prompts; agents treat Downloads as a trusted project directory.
  • Immediate Remediation: Never launch coding agents from Downloads. Audit Codex config.toml and Claude project settings.json files immediately.

Quick answer

Stop starting coding agents in your Downloads folder. Check that folder for AGENTS.md or CLAUDE.md files you did not write, and read any you find before an agent touches them. Then check your agent configs for entries you did not add: look for an MCP server block you do not recognise in the Codex config file, and for an API address you did not set in any Claude settings file. If you find a planted file, delete it, remove what it added, and rotate your tokens. The rest of this guide walks through each check with the exact commands.

Why this matters now

Forever Security published the report, titled "Markdown Is the New Executable", on 22 October 2026. BleepingComputer covered it on 25 October, O'Reilly listed it in the November 2026 Radar trends, and a wave of explainers followed on 2 and 3 November. The coverage keeps coming because the problem has no fix coming. Forever's own words are that there is nothing for OpenAI or Anthropic to patch, and no CVE identifier covers the agent behavior.

The exposure is wide. In Forever's telemetry, about half of its customers run a coding agent inside the Downloads folder, and about a quarter of agent sessions open a real browser. One of the report's authors told BleepingComputer that Claude Code alone launched more than 1,300 sessions from that folder across the firm's customers, and that Cursor CLI shows up there too. People use agents in Downloads to organise the folder or to act on something they just pulled down, so the habit is common and the folder is the one place on the machine a website can write to on its own.

The timing also matters because AGENTS.md keeps spreading. A study of 10,000 repos published on 21 October 2026 found it becoming the shared instruction file across agents, which means more agents read these files in more folders. The attack surface grows with that adoption, and the fix stays the same, so this guide will still apply months from now.

What happened on the customer machine

Forever's monitoring stopped a coding agent mid-session from installing function-color, a known-malicious npm package. The order had not come from a dependency or a cloned repository. It came from an AGENTS.md file in the customer's Downloads folder, which was also the agent's working directory. The file was about 13 KB of bland "Engineering Work Guidelines", and the attack sat in one section near the end, dressed up as routine setup.

Nobody knows how the file got into that folder. Forever says it could not determine this, and the coverage repeats that point. What the firm did establish is that the delivery is plausible: a web page can save a file named AGENTS.md into your Downloads folder on its own, choosing both the name and the contents. Forever built a demonstration page to prove it, and BleepingComputer tested the page and confirmed it downloads an AGENTS.md file. Treat the web-drop route as demonstrated, not as the confirmed cause in the real incident.

The package itself is a known quantity. Checkmarx links function-color to the MALFEX npm campaign, and npm has since removed it. The package page now shows version 0.0.1-security under the heading "Security holding package", published on 7 October 2026, and the notice states the package contained malicious code and was removed by the npm security team. The GitHub advisory GHSA-m6cg-6crx-mggv covers versions 1.0.0 and 1.7.3 and was published on 7 October 2026. That date matters: the package was already gone from the registry before the Forever report, so the incident shows the file, not the package, is the live threat.

How a malicious AGENTS.md steers Codex

Codex builds its instructions from AGENTS.md files at startup. It reads a global file, then project files from the project root down to the folder you start in. If there is no project root, it reads only the current folder. Downloads is usually not a git repo, so a file sitting there is the project file for any session started in that folder.

There is a trust gate. Codex only obeys an AGENTS.md in a project it trusts, and Forever notes that once you have worked in Downloads, it qualifies. That is the catch: the folder you have already used is the folder the attack needs.

Forever took the real customer file and ran it untouched inside an isolated VM. In testing, Codex ran the payload in more than 90 percent of attempts. Most of those runs used a harmless stand-in that only opened a calculator. To remove doubt, the researchers also ran the real malicious package once, inside an isolated VM, so it never touched a real machine.

The file told Codex to register a new MCP server in its machine-wide config file, the one that applies to every Codex session on the computer. The server's job was to install the malicious package. Because the config is machine-wide, the damage does not stay in Downloads. Once the entry is written, every Codex session on the machine loads the rogue server at startup, in any folder, in any project. You can leave the folder. The poison stays.

Fig 01, The attack chain: a web page drops AGENTS.md into Downloads, you start an agent in Downloads, the file tells the agent to change its own config, and the poison spreads machine-wide in Codex or leaks the token in Claude Code
Fig. 01: A plain text file steers your agent. No patch exists, and no CVE covers the agent behavior.

Two caveats belong here. The success rates come from Forever's own testing, and an IDC analyst quoted by CSO Online notes they have not been independently validated, with no sample sizes or tested versions published. Treat the numbers as proof the attack works often enough to matter, not as a benchmark.

How the attack works on Claude Code

Claude Code was harder to fool, so the researchers wrote their own CLAUDE.md, modeled on the real file. It told Claude to save a project settings file that pointed API traffic at a server the researchers controlled. The config write succeeded about half the time.

Once written, the reroute handed the researchers Claude's OAuth login token on every request. They replayed a captured token against the real API and were served as the victim, which is account takeover with no code run. The same file also reached code execution: on the next launch in that folder, Claude talked to the researchers' server from its first request, and their server answered as the model with tool calls Claude then ran. Same-session code execution happened in about a fifth of runs, through a subagent spawned to validate the config.

The file worked because it read like ordinary engineering notes. A short, direct instruction to install a package gets refused. The long, calm document framing gets through, and the researchers found the same file failed every time when placed in a folder full of security notes. The blandness is part of the attack, which is why the defence is to read the file, not to trust its tone.

What you need

  • Whichever agent you run: Codex, Claude Code, Cursor, or any agent that reads instruction files
  • A terminal, for the checks below
  • About 10 minutes
  • No account, no API key, and no new software for any step in this guide

Check your machine in 10 minutes

  1. Stop starting agents in Downloads. Run agents from a project folder instead. If you have a session open in Downloads now, close it and start again from the project root. Downloads is the one folder the web can write to, so it is the one folder an agent should never treat as a project.
  2. Look for stray instruction files in Downloads. Run this command and read what it returns:
    ls -la ~/Downloads/AGENTS.md ~/Downloads/CLAUDE.md
    If either file exists and you did not put it there, treat it as hostile and do not start an agent in that folder until you have read it. Repeat the check in any folder where you run agents, and in any repo you just cloned, before you open an agent there.
  3. Read any instruction file you did not write. Skim the whole file, because the attack hides in one section near the end of a long dull document. This triage search flags the lines worth reading closely:
    grep -inE 'mcp_servers|config\.toml|settings\.json|ANTHROPIC_BASE_URL|npm install|npx ' ~/Downloads/AGENTS.md
    A hit is a reason to read the file, not proof on its own. Normal setup docs can mention config paths. What you are looking for is a section that tells the agent to write to its own config, register a server, change an API address, or turn off approvals and the sandbox. Any line that tells the agent to disable its own safety checks is a red flag by itself.
  4. Audit the Codex config. This command shows every MCP server block in the machine-wide config:
    grep -n 'mcp_servers' ~/.codex/config.toml
    Read each block it finds and remove any server you did not add. While you are in that file, look for a base URL entry you did not set. Forever's own mitigation list names both checks.
  5. Audit Claude settings. Open the settings file in each project you work in and look for an API address or a proxy you did not set. This search covers your code folders at once; change ~/code to your own folder if yours is elsewhere:
    grep -rn 'ANTHROPIC_BASE_URL' ~/code --include='settings.json' 2>/dev/null
    Any hit you did not set yourself is a planted entry. Remove it, then move to the recovery steps below.
  6. Check whether the malicious package is installed. This lists global packages and filters for the two names tied to the campaign:
    npm list -g --depth=0 2>/dev/null | grep -iE 'function-color|function-flag'
    If either name shows up, treat the machine as compromised and follow the recovery steps below before you run an agent again.
  7. Turn on "ask where to save each file" in your browser. In Chrome, open Settings, then Downloads, and turn on "Ask where to save each file before downloading". In Firefox, open Settings, then General, then Downloads, and select "Always ask you where to save files". Brave already prompts by default. This stops a page from dropping a file into Downloads without you seeing it.
  8. Keep approvals and the sandbox on. Leave the approval gates and sandbox enabled in every agent you run, and be very suspicious of anything that tells the agent to turn them off. The report shows the attack needs those controls off to finish, so keeping them on is a real layer of defence, not a formality.
Fig 02, The 10-minute check: eight checks to find a planted AGENTS.md or CLAUDE.md and audit your agent configs, from stopping agents in Downloads to checking for the function-color package
Fig. 02: Eight checks, about 10 minutes, no new software.

If you find a planted file

Delete the file first, then remove what it added. Take the MCP server block out of the Codex config, or the API address out of the Claude settings file, and save the config. Deleting the file alone is not enough, because a config write it already made stays in place.

Then rotate your tokens. Re-authenticate Claude Code, rotate your API keys and npm token, and rotate SSH keys if the agent session could reach them. Assume the token leaked. A stolen token is a live session, so rotate it even if nothing looked wrong.

Then run steps 2 to 6 again from the top. If the second pass comes back clean, the machine is back to a known state.

Fig 03, Recovery: delete the planted file, remove what it added, rotate every token it could reach, and run the checks again. Codex ran the payload in more than 90 percent of Forever's VM tests
Fig. 03: Delete the file, remove what it added, rotate the tokens, check again.

Frequently asked questions

It is a plain text instruction file planted where a coding agent will read it. The file looks like ordinary engineering notes, and one section tells the agent to change its own config or install something. The agent follows it because instruction files are meant to be obeyed, and the file is not an executable, so none of the operating system guardrails for downloaded programs apply to it.
No. There is no patch for the agent behavior and no CVE identifier covers it, because the agents are working as designed. The npm package has the advisory GHSA-m6cg-6crx-mggv, and npm removed it. The fix for the agent side is habit and config checks, which is what this guide covers.
The Codex chain in the report was demonstrated on macOS. The behavior underneath it, an agent obeying an instruction file in its folder, is not tied to one operating system, and the Claude Code chain works by editing a settings file, which applies on any system. Run the same checks on any machine where you use these agents.
Forever tested Codex and Claude Code. The firm says any agent that reads an instruction file in its folder and can rewrite its own config can be driven the same way, and Cursor CLI also appears in Downloads sessions in the firm's telemetry. If your agent reads AGENTS.md or a similar file, the checks in this guide apply to it.
Nobody knows. Forever could not determine how the real file arrived, and the coverage repeats that gap. The firm demonstrated that a web page can drop a file named AGENTS.md into Downloads with no click and no permission prompt, and BleepingComputer confirmed the demonstration page works. Treat the web-drop route as a demonstrated possibility, not as the confirmed cause in that incident.

What to do next

A malicious AGENTS.md works because two ordinary behaviors meet in one folder: the web can write to Downloads, and your agent trusts the folder it starts in. Neither behavior will change, so the fix is yours to keep. Start agents in project folders, read instruction files you did not write, and check the configs for entries you did not add. Do the 10-minute check today, then keep the habit. If you audit agent skills as well as projects, read our 7-step SKILL.md security checklist, and if you want to mask secrets before the model sees them, our shim-cli guide covers the setup for Claude Code, Codex and Copilot CLI. You can also explore our EMBRACE vulnerability guide to secure local embedded browser previews.

Sources

  • Forever Security, Gal Weizman and Omer Samet, "Markdown Is the New Executable: Attackers Are Dropping Agent Instructions Into Your Downloads Folder From the Web", 22 October 2026: forever.security
  • npm package page for function-color, verified live 4 November 2026: npmjs.com/package/function-color (shows version 0.0.1-security, "Security holding package", published 7 October 2026)
  • O'Reilly Radar, "Radar Trends to Watch: November 2026": oreilly.com/radar/radar-trends-to-watch-november-2026/
  • PromptMaster, "A Stray AGENTS.md Can Steer Your Agent: Check What It Loads First", Medium, November 2026: medium.com/@promptmastershop
  • HackerLogs, "Downloads Gave the Order. npm Had Already Held It.": hackerlogs.com/blog/function-color-downloads-clock/ (GHSA-m6cg-6crx-mggv details)
  • BleepingComputer coverage, 25 October 2026 (cited by name and date; article URL not verified, so no link given)
  • CSO Online, 26 October 2026, IDC analyst caveat on the success rates (cited by name and date)
TJ
TJ Singh
Lead AI Systems Architect & Founder, PromptStaging

Benchmarking agentic LLMs, token FinOps, and client-side developer tooling. Author of PromptStaging's single source of truth model roster and verification suites.