How a Simple Markdown File Can Become a Security Threat to AI Agents
We're used to treating files like AGENTS.md and CLAUDE.md as ordinary instructions for AI coding agents. They help agents understand a project, follow development guidelines, and use the right tools. But what happens when one of these files…

We're used to treating files like AGENTS.md and CLAUDE.md as ordinary instructions for AI coding agents. They help agents understand a project, follow development guidelines, and use the right tools.
But what happens when one of these files is created by an attacker instead of a developer?
I recently read a security research report from Forever Security showing how a simple Markdown file could trick Codex or Claude Code into executing malicious instructions.
How the Attack Works
The investigation started when a security system blocked an AI agent from installing a malicious npm package called function-color.
Researchers traced the command back to an AGENTS.md file located in the user's ~/Downloads folder.
The problem comes from two behaviors working together:
- Browsers can save files to the Downloads folder, sometimes without requiring separate confirmation.
- AI coding agents may read instructions from their working directory and use them when executing tasks.
If a developer starts an agent inside a folder containing a malicious AGENTS.md, the agent may treat those instructions as legitimate project guidelines.
In this case, the malicious commands were disguised as development environment setup instructions.
What the Tests Revealed
The researchers reproduced the attack against two popular AI coding tools:
- Codex: The malicious instructions were followed in more than 90% of test runs.
- Claude Code: In approximately 50% of trials, the attack successfully modified configuration settings to redirect API requests, potentially exposing authorization tokens.
These numbers come from specific experiments, not a general assessment of either tool's security.
What's interesting is that the Markdown file doesn't need to be executable. The agent only needs to interpret its contents as instructions and carry out the requested actions itself.
What Developers Should Do
I'd follow a few practical precautions:
- Avoid running AI coding agents directly from
~/Downloadsor other directories containing untrusted files. - Review
AGENTS.md,CLAUDE.md, and configuration files in newly downloaded or unfamiliar projects. - Keep command approvals and sandbox restrictions enabled unless there's a clear reason to change them.
- Watch for unexpected changes to MCP servers, API endpoints, and authentication settings.
It's especially important to verify project instructions before giving an agent broad access to the filesystem or terminal.
Why This Matters
For me, this is another reminder that the capabilities of AI coding agents come with security risks.
The more actions an agent can perform independently, the more important it becomes to understand where its instructions come from and which sources it trusts.
At the same time, security shouldn't be entirely the user's responsibility. Developers of AI tools also need to improve trust boundaries and safeguards around tool execution.
A Markdown file doesn't become executable code on its own. But when an AI agent blindly follows its instructions, the consequences can be just as serious.




