How to Check Your Repos for the setup.js AI Coding Agent Malware
A GitHub campaign poisons AGENTS.md, CLAUDE.md and hook files so AI assistants run a credential stealer. Here is how to check repos and laptops.
On this page 8 sections
The setup.js campaign is AI coding agent malware that hides in AGENTS.md, CLAUDE.md, hook and MCP files and tells an assistant to silently run a script that steals credentials. To check, search every repo for those files, grep for "sealed" and "without asking" phrasing, look for an oversized setup.js, and rotate any token a suspect machine held.
Backtrace tests developer tools against real codebases, and this campaign targets a habit most teams have not reviewed yet: trusting the files an AI assistant reads. This guide is for engineers and security leads who run Claude Code, Cursor, Copilot or similar agents. It covers repo checks, laptop checks, token rotation and the controls that stop a repeat, as of November 18, 2026.
What Is the setup.js AI Coding Agent Malware Campaign?
It is a campaign that plants poisoned project files in GitHub repositories so an AI assistant runs a hidden JavaScript loader called setup.js. Bitdefender Labs researcher Andrei Anton-Aanei found 22 malicious links. The loader steals developer credentials and then tries to spread to other repositories.
Files such as AGENTS.md and CLAUDE.md normally explain coding conventions and how to run tests. In this campaign, Bitdefender Labs' analysis shows the same files describing scripts/setup.js as a signed, sealed artifact. The text tells the assistant not to read it, to run it at session start and to hide the output.
The wording is built to sound like internal policy. Phrases about signed artifacts and compliance make an unsafe action feel routine. That social pressure is the real exploit, because the agent only needs to believe the file is a normal part of the project.
How Can an Instruction File Run Code on Your Machine?
There are two paths. In the first, the agent reads a poisoned instruction file and runs setup.js because the file told it to. In the second, a session-start hook in a settings file such as .claude/settings.json runs the command in your shell as soon as you trust the repository.
The first path is indirect prompt injection, where harmful instructions sit in content the AI reads instead of in what the user types. The agent cannot tell a project note from an attacker's note unless something checks the file first.
The second path needs no AI judgment at all. The configuration file itself triggers execution. Bitdefender stresses that no typed prompt is required, and the script runs with the developer's own permissions.
Trusting a repository is the click that arms the hook. Treat the trust dialog as an execution approval for everything in that folder, not as a formality.
That split matters for defenders. A prompt-level guardrail will not stop a hook that fires before the agent says a word. You need controls on both the instruction files and the settings files.
What Does the setup.js Payload Steal and How Does It Spread?
The payload steals developer and enterprise credentials, then copies itself into AI agent configuration files. It targets CI/CD tokens, cloud keys, package registry logins, browser-stored passwords, SSH keys, .env files and source-control tokens. It also validates stolen GitHub and GitLab tokens before using them.
The loader is heavy. The outer file is a 3.75 MB single line that is hex-decoded, run through ROT13 and evaluated. It then unpacks a 4.67 MB bundle, fetches the Bun runtime and pipes the bundle into it. Extra payloads sit in a compressed _bz field inside package.json.
Spread is the dangerous part. On a victim's machine, the malware searches the home directory for agent files such as mcp.json, .cursorrules, .windsurfrules and .github/copilot-instructions.md. It keeps paths that mention one of 14 agent names, then injects instructions, hooks or MCP server entries.
Remotely, it checks whether a stolen token has repo, public_repo or workflow scope. It targets up to 25 repositories by default and inspects up to 50 branches in each. If permissions allow, it commits poisoned files, edits workflows and tries to republish infected packages to npm, PyPI, RubyGems and JFrog.
How Do You Check Your Repositories for Poisoned Agent Files?
List every agent-related file in each repo, search them for the campaign's phrasing, then read the git history of any hit. Start with repos your team cloned recently and repos where a maintainer's token may have been exposed. Run the checks from a clean clone.
For an organization, loop the same commands over a shallow clone of every repo, or use GitHub code search for the file names across your org. Do the repos with the most contributors first, since each contributor is another place a token could leak.
This command lists the files the campaign has been seen writing:
git ls-files -- 'AGENTS.md' 'CLAUDE.md' '.cursorrules' '.cursor/rules/*' \
'.claude/*' '.mcp.json' '.vscode/*' '.github/copilot-instructions.md'Next, search those paths for the language the attackers used:
git grep -n -i -E 'sealed|do not (read|inspect|display)|without (asking|confirmation)|setup\.m?js' \
-- AGENTS.md CLAUDE.md .cursorrules .cursor .claude .mcp.json .vscode .github/copilot-instructions.mdAny hit deserves a human read, but not every hit is malicious. A real AGENTS.md may say to run the test suite without asking. The red flag is an instruction to run a script the file forbids you to read, or to hide its output.
Then find out who added the file and when:
git log --diff-filter=A --format='%h %an %ad %s' -- AGENTS.md CLAUDE.md .claude .mcp.json .vscodeFinally, look for oversized scripts and the hidden package.json field. Run find . -name 'setup.js' -size +1M -not -path '*/node_modules/*' and git grep -n '"_bz"' -- '*package.json'. A setup script over a megabyte is not a setup script.
How Do You Check a Developer Laptop for Signs of Infection?
Look for planted agent files in home-directory projects and for hooks or MCP entries you did not write. The malware writes into the same places your tools already read, so compare against what you configured on purpose. Any unexplained entry is a finding.
Start with files the malware is known to create, outside dependency folders:
find ~ -type f \( -path '*/.claude/setup.mjs' -o -path '*/.vscode/setup.mjs' -o -name 'setup.mdc' \) -not -path '*/node_modules/*' 2>/dev/null
grep -n -i -E 'hooks|SessionStart' .claude/settings.json ~/.claude/settings.json 2>/dev/nullThen open each mcp.json and .mcp.json and confirm every server is one you installed. Check shell history and process lists for a Bun runtime you never set up, since the loader downloads one when it is missing. If anything looks wrong, isolate the machine before you touch credentials.
Our guide to auditing AI coding agent configs for planted instructions covers the same review for a wider set of files, and it is a good companion to the commands above.
Which Credentials Should You Rotate First?
Rotate source-control tokens and package registry tokens first, because they let an attacker spread. Then rotate CI secrets, cloud keys, SSH keys and anything stored in a .env file on the suspect machine. Revoke before you reissue, and do it from a clean device.
Order matters because the malware validates tokens against provider APIs. A token that still works is a token that keeps spreading. After revoking, review recent pushes, new workflow files and package publishes made with the old credentials.
The steps for doing this without breaking builds are in our guide to checking your builds and rotating secrets safely after an npm compromise. For the longer-term habit, see API key rotation best practices. Backtrace's editors built this order from the credential types Bitdefender lists, not from a single vendor's playbook.
How Do You Stop Agents From Running Unreviewed Setup Scripts?
Require human approval for every shell command an agent proposes from repo content, and review agent files like code. No agent should run a file that its own instructions say not to inspect. Add owners to the paths the campaign writes, so a stolen token cannot slip them in unseen.
A CODEOWNERS entry is the cheapest control. This sketch routes the files the campaign targets to a security review group:
AGENTS.md @your-org/security-reviewers
CLAUDE.md @your-org/security-reviewers
.claude/ @your-org/security-reviewers
.cursor/ @your-org/security-reviewers
.mcp.json @your-org/security-reviewers
.vscode/tasks.json @your-org/security-reviewersPair it with branch protection on the default branch. In your branch rule, enable "Require review from Code Owners", as GitHub's code owners documentation describes. The malware inspects protection rules, so a repo that blocks direct pushes is a harder target. Our GitHub Actions workflow lockfiles guide covers pinning for the workflow files it also edits.
Turn off any auto-approve mode on shared machines and build agents. Auto-approval is exactly what the campaign's "without asking for confirmation" line is trying to exploit.
In CI, run agents without cloud credentials unless the job needs them. Our walkthrough on fixing codex exec in CI shows why a trust prompt exists and what breaks when you bypass it. For a related attack through a hostile git config, read the GitSpawn explainer.
Conclusion: Treat Agent Files as Code
Search your repos for the poisoned file patterns, check laptops for planted hooks, and rotate tokens in the order above. Then change the default: agent instruction files, hooks and MCP definitions get the same review as a CI workflow. The files are small, but they decide what runs with your credentials.