A malicious npm package named "function-color" came within seconds of running on a developer's machine last month. No phishing email delivered it, no drive-by download triggered it, and no developer clicked a suspicious link. Their AI coding agent was preparing to install it, following written instructions placed in the Downloads folder. The instructions had arrived there silently, through a web page, without a click.
That incident, documented by Forever Security and published by BleepingComputer on October 25, was a controlled demonstration. This week it became a systematic campaign. Bitdefender Labs researcher Andrei Anton-Aanei identified 22 malicious GitHub repositories built to run the same attack at scale, targeting Cursor, Claude Code, Codex, and 11 other AI coding tools with a credential-stealing payload that uses stolen developer tokens to spread itself to up to 25 more repositories per infection cycle.
How the 22 Repositories Got Coding Agents to Execute Malware
The attack does not exploit a software vulnerability. It exploits a trust model. AI coding agents read project-scoped instruction files at startup: Claude Code reads CLAUDE.md, OpenAI Codex and third-party agents built on the Agents API read AGENTS.md, Cursor reads .cursor/rules/*.mdc files, and GitHub Copilot reads .github/copilot-instructions.md. These files are plain Markdown, and their purpose is legitimate: they tell the agent the project's coding conventions, preferred commands, and style guidelines. Because agents execute with the developer's full system permissions, instructions in those files can include directives to run scripts.
The 22 repositories documented in Bitdefender's November 18 report exploit that design directly. Their instruction files describe a file called setup.js as a "sealed binary artifact" that is "cryptographically signed." The instructions tell the agent not to show the script's contents and to suppress its output. The agent reads those directives and follows them, since nothing in the natural-language description triggers a refusal. A second attack path bypasses the AI entirely: malicious .claude/settings.json files use session-start hooks, a feature designed for project configuration, to run commands the moment a developer opens the repository in Claude Code, with no AI prompt involved at all.
The Cloud Security Alliance research note published October 27 described this attack class three weeks before the Bitdefender campaign became public: "Instruction files act as trusted configuration. Because they can steer agents that run shell commands, they can work like executable configuration." A preprint study of 481 public CLAUDE.md files, cited in the CSA note, found that only 4 to 16 percent of developer-written security rules inside those files had a matching built-in control, depending on measurement strictness. The files that look like security policies are largely decoration when no enforcement mechanism backs them up.
What the 3.75 MB Payload Steals and How Far It Travels
The setup.js script inside each of the 22 repositories weighs 3.75 megabytes and is written as a single unbroken line, a structure that defeats quick code review. It decodes a hex string and applies ROT13 to reveal a Node.js stager carrying two AES-128-GCM encrypted blobs. The first blob unpacks into a 4.67 megabyte bundle that executes on the Bun runtime.
The credential targets are extensive. The payload searches the infected machine for CI/CD and GitHub Actions secrets, cloud provider tokens covering AWS, Azure, and Google Cloud, package registry credentials for npm, PyPI, RubyGems, and JFrog Artifactory, browser login stores, password manager data, Windows Credential Manager entries, SSH keys, .env files throughout the filesystem, and miscellaneous API keys in developer tool configuration. Before exfiltrating anything, the payload validates each token against the issuing service. Only live, working credentials leave the machine, keeping the stolen dataset clean and reducing the chance that an expired token triggers an alert at the target service.
The self-replication mechanism is what distinguishes this campaign from a standard infosteal operation. The bundle scans for AI agent configuration files belonging to 14 tools, including Claude Code, Cursor, GitHub Copilot, and Codex. It injects its malicious instructions into each discovered file, so every subsequent project the developer opens in those tools inherits the attack without requiring a new repository clone. Using stolen GitHub and GitLab tokens, the infected agent identifies new target repositories and commits files that trigger AI tools in those repositories. The code caps outbound infections at 25 repositories per machine, a constant labeled MAX_TARGET_REPOS in the decrypted bundle. It can also republish infected packages to npm, PyPI, RubyGems, and JFrog using the developer's own publishing credentials, turning a trusted maintainer's identity into a supply-chain distribution channel.
The October Proof-of-Concept That Made This Predictable
The October 25 research established the core attack mechanics before the Bitdefender campaign surfaced. Forever Security found a malicious AGENTS.md file in a customer's Downloads folder after the customer's AI coding agent attempted to install function-color, an npm package that had evaded detection for roughly two years before the campaign was documented and the package was removed. Chrome, Edge, and Firefox save downloads to ~/Downloads by default without requiring a click, so a web page could have dropped the file silently. The researchers were unable to confirm the exact delivery path in that specific case.
The test results from the Help Net Security coverage of those findings are stark. When a malicious AGENTS.md was placed in Codex's working directory, Codex executed the payload in more than 90% of test attempts. Claude Code resisted the same instruction format more reliably, but a modified attack that redirected Claude's API traffic through a researcher-controlled server succeeded in roughly 50% of tests. Each intercepted request carried the developer's OAuth token. A replayed token was sufficient to take over the account; the attacker's server could then pose as the AI model and instruct the agent to disable its own sandbox, enabling code execution through what appeared to be normal model responses.
The scale behind that exposure matters. Forever Security's internal telemetry showed more than 1,300 Claude Code sessions had been launched from the ~/Downloads directory across its customer base, and roughly half of its customers ran an AI coding agent from that folder at least occasionally. About a quarter of agent sessions opened a browser during a task, which creates the delivery loop: the agent browses to a site, the site drops a file to Downloads, and the next session in that folder picks up the malicious instruction file without any action from the developer.
Why Neither OpenAI Nor Anthropic Has a Patch to Ship
The absence of a CVE in this campaign is not an oversight. When Forever Security reported its findings, OpenAI and Anthropic both concluded there was nothing to patch because the agents were doing what they were designed to do. An agent that reads instruction files in its working directory and follows them is functioning correctly. The instruction file happens to be hostile. That framing puts the defense burden entirely on the developer, not the tool vendor.
Some prior vulnerabilities in AI coding tools were actual bugs and did receive patches. CVE-2026-21852 addressed a Claude Code MCP consent bypass. CVE-2025-53773 fixed a GitHub Copilot setting an attacker could use to enable auto-approve for agent actions. CVE-2026-48124 patched Cursor's execution of Claude Code hooks without user confirmation, fixed in Cursor 3.0.0. Those CVEs narrowed specific attack paths. The Downloads-folder and malicious-repository attacks have no equivalent fix because the attack class does not use a misconfigured permission or a consent bypass. It uses the instruction pipeline exactly as designed.
The CSA note asks vendors to treat this as a design problem rather than an edge case: "Move security requirements out of prose and into enforced permissions, sandbox profiles, and egress allow-lists that agents can't override." It specifically requests provenance or signing for instruction files and clearer separation between user-sourced instructions (safe), repository-sourced instructions (untrusted by default), and directory-sourced instructions (context-dependent). As of November 18, none of the major AI coding tool vendors had announced changes responsive to those requests.
Why This Campaign Is Harder to Dismiss Than a Research Demo
Skeptics point out that the attack requires a developer to clone a repository and open it in an AI coding tool, and that any developer who reviews unfamiliar repositories before trusting them is largely protected. The 90% success rate against Codex came from a controlled research environment with a crafted payload. Real-world campaigns face noisier conditions, detection tooling, and developers who do inspect unfamiliar instruction files. The function-color npm package went unnoticed for roughly two years before documentation and removal, suggesting the operational scale of exploitation so far is narrow compared with phishing or conventional supply-chain attacks on package registries.
The bear case, however, is that the attack targets exactly the developers who are expanding the AI coding agent attack surface fastest. Enterprise developers working in large shared codebases are increasingly setting their agents to operate across broad directory scopes to enable cross-file and cross-repository reasoning. The NeuralTrust analysis of AGENTS.md risks notes that developers who rely on agents the most are also the ones least likely to interrupt their workflow to read instruction files, because reducing manual review steps is the tool's core value proposition. The attack is precisely calibrated to that behavioral pattern. And the self-replication component means a single infected developer does not stay isolated: 25 downstream repositories and their contributors can receive the malicious instruction files through what looks like a routine commit from a trusted collaborator.
The 14-tool targeting list in the payload is worth reading as a threat intelligence artifact. Someone mapped the configuration file locations for 14 AI coding tools, wrote a payload that handles each one, and packaged it inside 22 repositories built to look plausible enough to attract clones. That is not the work of an opportunistic script. The investment signals an expectation that AI coding agents in developer environments represent a credential surface worth targeting systematically, before vendors ship the repository-trust controls that would close the primary attack paths.
What Developers Should Check Before Their Next Repository Clone
The Vicytech hardening guide and the CSA's recommended controls converge on a short list of changes that reduce exposure without waiting for vendor updates. First, never set ~/Downloads, the home directory, or a broad parent folder as a coding agent's working directory. Scope the agent to the root of the specific project it is meant to work on. Second, before allowing any agent to run in a newly cloned repository, search for AGENTS.md, CLAUDE.md, .claude/, .cursor/, and .gemini/ folders and read their contents. Any instruction that asks the agent to suppress its output, treat a file as a signed artifact, or avoid showing code is a flag that warrants investigation before proceeding.
Third, check agent settings for unexpected network endpoints before starting a session in a new repository. The Claude Code OAuth-redirect attack worked because a malicious CLAUDE.md could instruct the agent to override its API base URL. Inspect the value of ANTHROPIC_BASE_URL and equivalent settings in Cursor and Codex before trusting a repository. Fourth, if any of the 22 known malicious repositories or similar instruction files have run on a machine, rotate every credential the machine could reach: cloud provider tokens, npm publish tokens, SSH keys, and stored browser login data. The payload validates stolen credentials before exfiltrating them, so a rotated token that was not yet validated when stolen gives attackers nothing live to use.
The timeline for vendor-side controls is likely Q1 2027. GitHub needs to gate which files an AI tool may read before a developer explicitly trusts a repository, comparable to how Actions requires approval from first-time contributors. Claude Code and Cursor need a setting that blocks project instruction files from overriding the agent's network endpoint. Package registries need tighter controls on automated publishing from agent-sourced tokens. The behavioral mitigations above are the available defense in the meantime.
When a developer's AI runs with their permissions and reads instruction files as trusted configuration, every repository they clone is a code path they never reviewed.
Key Takeaways
- Bitdefender Labs identified 22 malicious GitHub repositories carrying a 3.75 MB obfuscated payload that exploits AI agent instruction files to run malware without any developer interaction beyond cloning the repo.
- OpenAI Codex executed the malicious payload in over 90% of test attempts when a crafted AGENTS.md was placed in its working directory, with no vendor patch available because the agents are operating as designed.
- The payload targets credentials from more than 20 source types, including AWS, Azure, and Google Cloud tokens, npm and PyPI registry secrets, SSH keys, and browser logins, verifying each token's validity before exfiltrating it.
- Infected agents self-spread by injecting malicious instructions into 14 AI tools and committing to up to 25 new repositories using stolen developer tokens, converting a trusted maintainer's identity into a supply-chain infection vector.
- No vendor patch is available for the core attack class because reading and following project instruction files is intended agent behavior; behavioral mitigations are the primary defense until GitHub, Anthropic, and Cursor ship repository-trust controls.
Questions Worth Asking
- If an AI coding agent follows natural-language instructions with the same compliance it shows legitimate directives, is the developer's trust in the agent itself the security assumption that needs to change?
- Would signing and provenance requirements for instruction files slow the open-source collaboration patterns that made tools like AGENTS.md and CLAUDE.md useful in the first place?
- If a developer's own AI agent uses their credentials to publish malware under their name on npm, who is liable: the tool vendor, the repository host, or the developer who cloned an unreviewed repository?