# Forever Security Demonstrates AGENTS.md Attack on Coding Agents

Published 2026-10-26 · AI.info Team · AI.info

> A malicious instruction file in a customer’s Downloads folder led a coding agent to attempt to install a harmful npm package, Forever Security reports. Its tests showed how similar files could affect Codex configuration or redirect Claude Code traffic, while BleepingComputer’s test verified only that a proof-of-concept page downloaded a harmless file.

[OpenAI](https://ai.info/companies/openai) and [Anthropic](https://ai.info/companies/anthropic) have nothing to patch, [Forever Security](https://forever.security/blog/hijacking-ai-agents-via-downloads-folder) says, even as its researchers show how a plain-text instruction file can steer their coding agents toward malware or expose an account token. An agent on a customer’s computer tried to install a malicious npm package after reading an AGENTS.md file in the customer’s Downloads folder, the company says.

Forever Security published its findings on October 22, 2026. The attempted installation was stopped before code ran, the researchers say, but they could not establish how the file got onto the customer’s machine. Their tests show what could happen if a user later starts an agent in that same folder.

## An instruction file, not an executable

AGENTS.md files are plain-text documents that give coding agents project instructions, such as which tools to use and how to run tests. Agents may read applicable instructions from the folder where they start, then act on them with the permissions available to them. That turns a file that does not run by itself into a route for commands, package installs or configuration changes.

Forever Security’s report argues that the agents followed instructions in their working folder as designed, while the risk arose because that folder contained instructions the user had not placed there.

## Codex’s configuration widened the risk

In its test of OpenAI Codex, Forever Security used the actual instruction file recovered from the customer’s machine inside an isolated virtual machine. The file presented a malicious package, function-color, as routine project tooling and told Codex to add a server entry to its machine-wide configuration. Forever says the server’s startup command then installed the package; in its tests, Codex ran the malware in more than 90% of attempts.

The configuration change mattered because it was not confined to the Downloads folder: Forever says the altered file could affect later Codex sessions elsewhere on the same machine. BleepingComputer separately tested the proof-of-concept download page and confirmed it downloaded an AGENTS.md file containing harmless text. That browser test demonstrated the download-and-instruction path, not execution of the malicious package or a 90% Codex payload result.

## Claude Code presented a different route

Forever Security also tested a related attack using a crafted CLAUDE.md file. The instructions persuaded Claude Code to change a project setting that redirected its API traffic to a server controlled by the researchers. That exposed the agent’s OAuth token; the researchers say their server could then respond as the model and send tool calls back to the agent.

This Claude Code technique led to code execution in about half of its tests, Forever reports. The result came from a researcher-built test, not from the customer incident that first exposed the Downloads-folder file. BleepingComputer reported that Forever could not determine how that original file arrived.

## The agent must also start in Downloads

A web page can trigger a download named AGENTS.md into a browser’s default Downloads location, but the file does not hijack an agent simply by arriving. The user must start a coding agent in that directory so it reads the file as instructions. BleepingComputer found that Chrome, Edge and Firefox saved downloads there by default in its tests, while still displaying download notifications; Brave prompted for approval in the publication’s test.

Forever researcher Gal Weizman told BleepingComputer that customers commonly use agents to organize Downloads or process newly downloaded files. The publication reported that Forever’s internal figures counted hundreds of customer agents launched from that folder, including more than 1,300 Claude Code sessions.

Forever and BleepingComputer point to a practical defense: start an agent from the root of the specific project it is meant to work on, not Downloads or a broad parent folder. Review unfamiliar AGENTS.md and CLAUDE.md files, and keep approval prompts and sandbox protections enabled. The original customer’s agent was stopped before function-color ran; the source of the instruction file remained unknown.

## Sources

1. Original source · Blog post [Forever Security](https://forever.security/blog/hijacking-ai-agents-via-downloads-folder) forever.security

Other pages read

2. [BleepingComputer](https://www.bleepingcomputer.com/news/security/ai-coding-agents-hijacked-using-agentsmd-file-in-downloads-folder/) bleepingcomputer.com

## Related stories

- [Anthropic adds experimental Code Mode to Claude Code](https://ai.info/news/anthropic-claude-code-experimental-code-mode)
- [Pwn2Own’s Codex and LiteLLM Targets Fall for Exploits](https://ai.info/news/pwn2own-codex-litellm-exploits)
- [GitHub Octoverse: Agents Started More Than 40% of September Pull Requests](https://ai.info/news/github-agents-started-40-percent-pull-requests)
- [Anthropic Finds Analysts Follow AI Agents’ Hidden Preferences 86% of the Time](https://ai.info/news/anthropic-analysts-follow-ai-agents-hidden-preferences)
- [Microsoft Research Used PDD Kit to Formally Verify Login Logic in a Rust Web App](https://ai.info/news/microsoft-research-pdd-kit-rust-web-app)

## Explore

[More articles](https://ai.info/news)

---

Canonical: https://ai.info/news/forever-security-agents-md-coding-agent-attack
