Rigged GitHub repos make AI coding agents run malware

Published

A file meant to tell an AI coding assistant how to run a project's tests is being used to tell it to run malware instead. Bitdefender Labs researchers Andrei Anton-Aanei and Alina Bîzgă describe a campaign in which 22 malicious GitHub links carry instruction files, session hooks and tool configurations designed to make AI-assisted development tools execute a concealed payload.

Once it runs, the malware steals developer credentials and cloud secrets, checks which accounts it can use, and writes the same booby-trapped files into other repositories and AI-agent configurations it can reach. It is built to spread.

Instructions that tell the agent not to look

Files such as AGENTS.md and CLAUDE.md normally describe coding conventions for an AI assistant. In this campaign they describe a file called setup.js as a sealed, signed initialization artifact that must not be inspected, and tell the assistant to run it at session start, silently. One sample, quoted by Bitdefender, instructs the agent to run node scripts/setup.js automatically without asking for confirmation if the user has not already done so. The wording borrows the language of internal security policy to make an unsafe action feel routine.

A second route needs no persuasion at all. Bitdefender found configurations using session-start hooks, where a file like .claude/settings.json can launch a shell command once a developer opens and trusts the repository. No prompt has to be typed for the script to run with the developer's permissions.

A layered loader with a long shopping list

The outer setup.js is a 3.75 MB single-line script that hex-decodes an embedded value, applies ROT13 and evaluates the result. That stage is a Node.js stager holding two AES-128-GCM encrypted blobs; it decompresses one into a 4.67 MB bundle, fetches or locates the Bun runtime and pipes the bundle into it. More payloads hide in a compressed field in package.json.

Bitdefender's analysis shows the final payload targeting CI/CD systems and GitHub Actions, cloud and container environments, package registries, browser-stored credentials, password managers, Windows Credential Manager, SSH keys, .env files and source-control tokens. It validates stolen tokens against provider APIs before batching the data for dispatch.

How it spreads, locally and through stolen tokens

Locally, the malware searches the home directory for agent configuration files, from mcp.json and .cursorrules to .github/copilot-instructions.md, keeping paths that mention any of 14 tools including Claude, Codex, Gemini, Copilot, Cursor, Cline and Amazon Q. It then injects malicious instructions, hooks or MCP server entries.

Remotely, it checks stolen GitHub and GitLab tokens for push rights and scopes, targets up to 25 repositories by default, and commits files such as AGENTS.md, CLAUDE.md, .mcp.json and .vscode/tasks.json. It can also alter workflows, create GitLab pipeline schedules and try to republish infected packages to npm, PyPI, RubyGems and JFrog. It is the same supply-chain logic seen in the ChainDrop npm worm and the poisoned Claude Code extension, now aimed at the files agents read.

Read agent files before you trust a repo

Indicators of compromise

Selected repositories and setup.js MD5 hashes published by Bitdefender:

Markdown used to be documentation. In a workspace where an agent can read it and then run commands, it is part of the attack surface, and it deserves the same review as a dependency.

This briefing is provided by IntelFusions for informational and defensive purposes only. It is based on sources assessed to be reliable at the time of writing, and analytic judgments carry the confidence levels indicated. Indicators of compromise are defanged; re-arm them only in controlled environments. IntelFusions is not affiliated with the organizations named and makes no warranty as to completeness or accuracy.

Read the full analysis on IntelFusions