Skip to main content
Live
Main content

Forever Security finds AGENTS.md files in Downloads can hijack Codex and Claude Code

A planted instruction file got Codex to run malware in more than 90% of tests and rerouted Claude Code's API traffic about half the time.

Jaeden Schafer
Editor in Chief · · 5 min read
Forever Security finds AGENTS.md files in Downloads can hijack Codex and Claude Code

Forever Security says a malicious AGENTS.md file planted in a user's Downloads folder can hijack AI coding agents, after the firm caught one trying to install malware on a real customer machine. In Forever's own tests, OpenAI's Codex followed the planted instructions and ran the malicious payload in more than 90% of attempts.

Forever researchers Gal Weizman and Omer Samet detailed the findings in an October 22 report titled "Markdown Is the New Executable." The investigation began when Forever blocked an agent on a customer machine from installing function-color, a known malicious npm package. The instructions came from an AGENTS.md in the user's Downloads folder, disguised as ordinary engineering notes, not from the developer. Forever stopped the attack before any code ran and has not determined how the file got there.

AGENTS.md and CLAUDE.md are plain-text instruction files that coding agents read and follow when they start in a folder. Forever's argument is that two ordinary behaviors combine into an attack path: agents trust the instruction files in whatever folder they open, and a website can save a file into Downloads without a click or permission prompt, choosing its name and contents. Forever built a proof-of-concept page that silently drops an AGENTS.md into Downloads when visited, though it did not establish that a real attacker used that route.

Key facts

  • 01Forever Security found a malicious AGENTS.md in a customer's Downloads folder that told a coding agent to install npm malware.
  • 02In Forever's tests, OpenAI's Codex executed the planted payload in more than 90% of attempts.
  • 03A planted CLAUDE.md rerouted Claude Code's API endpoint about 50% of the time, exposing the session's OAuth token.
  • 04About half of Forever's customers run a coding agent inside Downloads; about a quarter of agent sessions open a browser.
  • 05The npm package function-color, tied to the MALFEX campaign, was replaced with a security placeholder on October 7, 2026.

The package at the center of the incident, function-color, belongs to a campaign that researchers at CloudSEK and Checkmarx named MALFEX. It pulls in a downloader, function-flag, which fetches and runs a Windows payload. Version 1.0.0 appeared on npm in July 2025, and npm replaced the package with a 0.0.1-security holding version on October 7, 2026.

For the Codex test, Forever ran the real attacker file, about 13 KB, inside an isolated virtual machine. The file told Codex to register a server in its config.toml file and install the package. Because that config applies machine-wide, the change persisted across every later Codex session and project. The researchers said the payload had to work around five controls, including a trust gate, a network sandbox and startup-only server loading.

The Claude Code attack worked differently and succeeded less often. Forever wrote its own CLAUDE.md, framed as internal gateway setup, that tried to get Claude to write a new API base URL into a project settings file, rerouting traffic to a server Forever controlled. That configuration write went through about half the time. When it did, the reroute exposed the session's OAuth token, which the researchers replayed against the real API to demonstrate account takeover. Same-session code execution worked in about one of five attempts.

Claude Code often asks for approval before such writes and frequently refuses suspicious ones, according to the report, and the long engineering-document framing is what got the write approved as often as it was. Forever also found that when the folder contained security notes, a subagent Claude spawned flagged the file as an attack, so the payload only worked in a clean-looking folder. Forever said it did not break out of Claude Code's sandbox.

The exposure figures come from Forever's own customer telemetry. About half of its customers run a coding agent inside their Downloads folder, and roughly a quarter of agent sessions open a real browser, the two conditions the attack depends on. Forever counted more than 1,300 Claude Code sessions launched from Downloads in its customer base.

Related · from this week
OpenAI puts Codex inside the ChatGPT mobile app on iOS and Android
Jaeden Schafer · 4 min read →

Forever argues there is nothing for OpenAI or Anthropic to patch, because the agents are doing what they were designed to do when they follow an instruction file in their working folder. Neither company was quoted in coverage of the research. Codex reads AGENTS.md files up to a 32 KiB combined default limit, while Claude Code reads AGENTS.md only when no CLAUDE.md exists in the working directory or above it.

Forever's recommendations are specific: do not start coding agents in Downloads, read any AGENTS.md or CLAUDE.md you did not write, including in freshly cloned repositories, and check Codex's config.toml for unexpected server blocks and Claude Code's settings.json for unfamiliar API endpoints. It also advises keeping approval gates and sandboxes on, rotating credentials if a planted file turns up, and treating any machine with function-color installed as compromised.

ShareXLinkedInEmail
AI Box

Every AI model. One chat.

The latest models from ChatGPT, Claude, Gemini, Sora, ElevenLabs — 80+ models in a single chat. Compare answers side by side. Pick the best one every time.

  • ChatGPT, Claude, Gemini, Grok, DeepSeek — in one chat
  • Generate images & video with Sora, Veo, Ideogram
  • Compare any two models side by side
  • From $8.99/mo · 80+ models, all included
Try AI Boxaibox.ai
Trusted by 3,000+ teams
Got a tip?

Working on something we should cover, or seeing a story we missed? Send leads, documents, or feedback to hello@aichatdaily.com. For sensitive tips, see our secure tips page for Signal and PGP options.

Spotted an error? Email hello@aichatdaily.com with the URL and the issue, or read our full corrections policy.

AI Box Daily briefingFree · Daily · No fluff

Stay ahead of everyone in AI.

The tightly edited AI news email engineers, founders, and investors actually open. One email. Every weekday. Five minutes to finish.

Loved by 10,000+ AI professionals
Free forever. Unsubscribe with one click.

The briefing read inside teams at

Keep reading

More from Security

OpenAI logo
Tools

OpenAI puts Codex inside the ChatGPT mobile app on iOS and Android

Phone users can now dispatch tasks to Codex running on their desktop, with files and credentials staying on the local machine.

Jaeden Schafer4 min read
Anthropic logo
Security

Claude, Codex, and Hermes installed unowned code inside Fortune 500 networks

Researchers scanned 6,214 domains and found 227 install commands in AI-facing docs pointing at unregistered packages an attacker could claim.

Jaeden Schafer5 min read
200 economists and AI leaders warn of jobs 'tsunami' from AI
Careers

200 economists and AI leaders warn of jobs 'tsunami' from AI

Signed by Anthropic, Google, and OpenAI executives alongside Nobel laureates, the statement says AI could transform the economy faster than the Industrial Revolution.

Jaeden Schafer5 min read