Skip to main content
Mallory
← Back to News
ai-platform-securitypackage-repository-poisoninginitial-access-methodpersistence-method

Malicious AGENTS.md File Tricks Codex Into Running npm Malware in Tests

Emerging Technology Risk · 12 sources · Updated 23d ago · First seen Oct 26, 2026

Malicious AGENTS.md File Tricks Codex Into Running npm Malware in Tests

Forever Security discovered a malicious AGENTS.md instruction file in a customer's Downloads folder that attempted to persuade an AI coding agent to install the malicious npm package function-color. The real-world attempt was stopped before code executed, and the file's delivery mechanism remains unknown. In isolated tests, however, the planted file caused OpenAI Codex to execute malware in more than 90% of attempts and sought to alter machine-wide configuration for persistence across sessions. Researchers also demonstrated that a web page could silently download an instruction file into Downloads, where a coding agent might later treat it as trusted guidance.

A separate Claude Code proof of concept redirected API traffic to a researcher-controlled server, exposing a session token and allowing malicious responses, with reported success in approximately half of tests. Together, the findings highlight the risk of coding agents treating attacker-controlled local files and configuration as authoritative instructions. Forever recommended avoiding agent sessions in Downloads, inspecting agent instruction files and configuration, retaining approval prompts and sandbox protections, and rotating potentially exposed tokens.

New surface, new adversariesTrack how attackers are adapting to this technology.
Track this risk
Event timeline

How this story unfolded

Events from the most recent confirmed update back to the earliest known activity.

8 events
  1. Reported Oct 26, 202630d ago

    Researchers replay captured Claude OAuth token to impersonate the victim

    Forever Security replayed an OAuth token captured through redirected Claude Code API traffic and successfully accessed Anthropic's service as the victim. The researchers also demonstrated code execution through malicious server responses, with same-session execution via a helper agent succeeding in approximately one-fifth of tests.

    Hackers Can Hijack OpenAI Codex and Claude Code Using Malicious Files in Downloads Folder | Cryptika Cybersecurity
  2. Reported Oct 26, 202630d ago

    npm removes malicious function-color package

    npm removed function-color, the malicious package that the planted AGENTS.md file instructed Codex to install. The reference does not specify when the removal occurred.

    AI coding agents fall for malicious instructions planted in the Downloads folder - Help Net Security
  3. Reported Oct 26, 20261mo ago

    Forever Security issues guidance for detecting and limiting instruction-file attacks

    Forever Security advised avoiding coding-agent sessions in Downloads, inspecting unexpected instruction files and altered agent configurations, and retaining approval prompts and sandboxes. It also recommended rotating potentially exposed login tokens when a planted instruction file is discovered.

    Malicious File in Downloads Folder Tries to Trick AI Coding Agent Into Installing Malware
  4. Reported Oct 26, 20261mo ago

    Claude Code proof of concept redirects API traffic and exposes login tokens

    A separate Forever Security proof of concept used a planted CLAUDE.md to redirect Claude Code API traffic to a researcher-controlled server, exposing the session login token and allowing malicious model responses. The configuration change required human approval, which the researchers reported obtaining in approximately half of tests.

    Malicious File in Downloads Folder Tries to Trick AI Coding Agent Into Installing Malware
  5. Reported Oct 26, 20261mo ago

    Attacker's instruction file triggers Codex malware execution in over 90% of tests

    Forever Security tested the attacker-supplied AGENTS.md in an isolated virtual machine and reported that Codex executed malware in more than 90% of attempts. The instructions also sought to register a server in machine-wide Codex configuration, allowing it to load across subsequent sessions.

    Malicious File in Downloads Folder Tries to Trick AI Coding Agent Into Installing Malware
  6. Reported Oct 26, 20261mo ago

    Researchers demonstrate silent delivery of an agent instruction file

    Forever Security built a proof-of-concept web page that silently downloaded an AGENTS.md file into Downloads when visited. The demonstration established a possible delivery route, not how the customer's malicious file actually arrived.

    Malicious File in Downloads Folder Tries to Trick AI Coding Agent Into Installing Malware
  7. Reported Oct 26, 20261mo ago

    CloudSEK and Checkmarx analyze the MALFEX package campaign

    CloudSEK and Checkmarx separately analyzed the malicious package campaign, naming it MALFEX. The function-color package pulls in function-flag, a downloader that fetches and executes a Windows payload.

    Malicious File in Downloads Folder Tries to Trick AI Coding Agent Into Installing Malware
  8. Reported Oct 26, 20261mo ago

    Forever Security intercepts malicious AGENTS.md on a customer's machine

    Forever Security discovered a malicious AGENTS.md file in a customer's Downloads folder and stopped the coding agent before malicious code executed. Disguised as engineering documentation, the file instructed the agent to install the malicious npm package function-color; its delivery mechanism remained unknown.

    Malicious File in Downloads Folder Tries to Trick AI Coding Agent Into Installing Malware
Linked entities

Related entities

Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.

Open in app →

Malware

1 linked

Affected products

2 linked
Claude CodeCodex

Organizations

2 linked
AnthropicOpenai
Do you run this?Follow how adversaries are adapting to this technology, and where it touches your stack today.
Track This Risk
Source coverage

Sources

12 references tracked. Mallory keeps watching after this page renders.

Mallory platform

See the full picture, correlated to your attack surface.

This page covers what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which threat actors are using it right now, and what to deploy next.

Exposure mappingMap indicators from this story to your assets and identify affected systems in minutes.
Threat actor evidenceEvery observed campaign, victim, and pivot linked to actors named in this story.
Associated malwareMalware, exploits, and IOCs connected to the activity described here.
Detection signaturesYARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Scheduled alertsGet matching new stories delivered to your team as they break, not the next morning.
AI threadsAsk questions about this story and take action on the answers.