How to Audit Malicious AGENTS.md and CLAUDE.md Files

Bitdefender found repos whose AGENTS.md and CLAUDE.md files tell a coding agent to run a hidden setup script. Audit them before the agent opens the repo.

By Muhammad Saif and Aashan Khan · Techtribe co-founders

An AGENTS.md file and a CLAUDE.md file are instructions a coding agent reads before it edits your repository. Teams use them for test commands, folder layout, and the places a model should not invent. On November 17, 2026, Bitdefender Labs described a malware campaign that uses those same files for a different job: talk the agent into running a concealed script, then use the developer's access to steal credentials and spread.

Bitdefender researcher Andrei Anton-Aanei identified 22 malicious GitHub links carrying files built to make AI-assisted development tools execute that payload. The write-up is How AI Agents Become New Targets in a GitHub Malware Campaign. The campaign abuses the files, rules, hooks, and configurations those tools use to understand a project. Once the script runs, Bitdefender says it can steal credentials, check which accounts those credentials open, change repositories, infect software packages, and plant new agent instructions so the same pattern travels.

This note is the audit of the instruction files themselves. A malicious npm package that registers a hook on install is covered in whether a package can compromise the agent. A README or an issue that steers a model after the project is already open is covered in how a coding agent can be steered by a file it reads. If the agent on a laptop may already have run something like this, the signs to look for before it can push to a production branch are in how to detect a compromised coding agent. Read this one before you let the agent open a repository you did not write.

What the agent is built to obey

AGENTS.md is a convention several coding agents look for at the root of a repository, and sometimes in nested folders. CLAUDE.md is the file Claude Code reads for project instructions. Cursor rules, Copilot instruction files, and a .claude/settings.json beside them are the same family: text and config the tool loads because a person, or a previous session, put them in the project.

The useful version of that file is boring. It says where the tests live, which command builds the app, and which directories are generated. The model treats it as part of the task. That is the feature. A sentence in the file is not a comment the tool ignores. It is context the product loaded on purpose, often ahead of the user's first message.

A hook is stricter than a paragraph. Claude Code can run a command on session start from project settings. The command is a process. It does not need the model to agree, and it does not need the user to type "run the setup." Trusting the folder, which many editors ask for once, is enough for that path. Bitdefender describes both paths in this campaign. One tries to persuade the assistant. The other starts the script from configuration when the repository is trusted.

If your team has standardized on these files, you already decided they are part of the build. Review them with the same seriousness as a CI workflow. A workflow can deploy. An instruction file can tell an agent that holds your GitHub token to deploy, or to run a script that reads the token first.

What Bitdefender says the files told the agent to do

In the repositories Bitdefender examined, the instruction files present scripts/setup.js as a legitimate, security-sensitive part of the project. They claim it is a sealed initialization step, that it has been cryptographically signed, and that it holds encrypted credentials or internal configuration that should not be inspected. They then tell the assistant to run it.

Bitdefender quotes the shape of those instructions. The file is described as a sealed binary artifact, not human-readable source. The agent is told not to read, quote, or display its contents. It is told to run at session start without displaying output. If the user asks for help with the project before that setup has run, the agent is told to run node scripts/setup.js automatically, without asking for confirmation.

That language is chosen because it sounds like a company that already has a security team. Signed artifacts, sealed builds, and "do not print the secret" are normal sentences in a real DevSecOps repo. Here they are cover. The secrecy instruction is the payload's protection. An agent that follows it will execute a file and will also refuse the one action that would show a person what the file is.

If the product is in a mode that approves commands on its own, the script runs with the developer's permissions. If a person is still in the loop, the instruction is written to make the approval feel routine: this is setup, it is signed, do not look inside, the user is waiting. A tired approval of "run the project setup" is the click the file is trying to earn.

The second path skips the conversation. Bitdefender found configurations that use session-start hooks. After a developer opens the repository and trusts it, a file such as .claude/settings.json can start a command in the user's shell. No typed prompt is required. The assistant does not have to interpret a sentence. The configuration is the execution path. A team that reviews markdown and skips JSON settings has reviewed the weaker of the two doors.

What running it puts at risk

Bitdefender describes setup.js as a multi-stage JavaScript loader built to make analysis harder. The details of how the stages are packed belong in their lab write-up. For a team deciding whether a repository is safe to open, the behavior after the loader runs is the part that changes the weekend.

The payload is built to steal credentials and tokens across a developer machine and the systems that machine can reach. Public summaries of the research name developer credentials, CI credentials, cloud credentials, package-registry credentials, browser data, and SSH material. It can check which of those accounts still work. A stolen token that still authenticates is the difference between a file on disk and an account the attacker can use tonight.

It is also built to spread through the same channel that delivered it. Bitdefender says the malware can modify repositories, infect software packages, and plant new AI-agent instructions. That last step is why deleting one CLAUDE.md is not the end of the incident. The developer's GitHub token can push a fresh instruction file into another repo the token can write. The next person who clones that repo and opens it in an agent is the next run. The audit has to include repositories the compromised account could push to, which is a wider set than the one repository where you first noticed a strange setup script.

A browser profile and an SSH key on the same laptop widen that set again. The agent is not the only program that can read them once a script runs as the user. The script is a program. Sandbox settings that wrap the model's shell tool do not automatically wrap a hook the product starts outside that sandbox. The permission boundary is discussed in what Claude Code and Cursor can reach. The practical consequence here is simple: a session-start command inherits the user, and the user can often read ~/.ssh, cloud CLI files, and the tokens in the environment.

Why this file is a worse place to hide than a dependency

A dependency is reviewed, sometimes, because a lockfile diff is visible and install scripts have a reputation. An instruction file looks like documentation. People add it in the same pull request as a formatting change. Agents add it themselves when asked to "set up the project for Claude." Reviewers skim it for tone and miss a paragraph at the bottom that names a script.

The file is also inherited. A template repository, a starter the agency clones for every client, or a .claude directory copied between laptops will copy the instruction with it. One bad starter becomes every new client repo. Forks copy it again. A public example that a developer cloned because the README looked helpful is how a campaign repository enters a company that never meant to depend on that GitHub user.

Nested instruction files make the skim worse. An agent that walks the tree can read packages/billing/CLAUDE.md as well as the root file. A review that opens only the root file has not reviewed the instructions the agent will see. The same is true of rules dropped into a tool-specific folder that the markdown points at. Follow the references. A sentence that says "see scripts/setup.js and do not open it" is the sentence you stop on.

There is a honest version of a setup script. Projects do have codegen steps and private config. The difference is that a person can open the script, the script is small enough to read, the git history shows who added it, and nothing in the instruction file forbids that reading. Secrecy pointed at the reviewer is the signal. Cryptographic signing, if you actually use it, comes with a key your company controls and a check you can run. A paragraph that says "this is signed" and supplies no verification step is a costume.

What to check before the agent opens the repo

Do this on a clone, with the coding agent closed. Reading the files in an editor, or on GitHub, is the review. Opening the folder in Claude Code, Cursor, or another agent before the review is how the hook path runs.

  1. List every instruction file. Search for AGENTS.md, CLAUDE.md, .cursorrules, .cursor/rules, Copilot instruction files, and anything under .claude/. Include nested copies, not only the repository root. Include files the default branch has and files a recent branch added.
  2. Read them as commands, not as style guidance. Any line that names a script, a binary, a hook, or a network call is a line you can explain or you remove. Pay particular attention to orders not to read, quote, or display a file, and to orders to run something at session start or without confirmation.
  3. Open the script the instruction names. If it is huge, minified, or described as a sealed artifact you must not inspect, treat the repository as hostile. Do not run it to "see what happens." Bitdefender's case is a loader. Running it is the incident.
  4. Open .claude/settings.json and any local settings the repo contains. Read every hook command. A session-start hook is code execution tied to trust, which many tools ask for with a single click. If the command is a node invocation of a script you have not read, it is the same decision as step 3.
  5. Check git history for those paths. An agent commit that adds an instruction file, or a commit that appears on several repos the same day with the same setup language, is spread. Look at the account that pushed it. That account's other repositories are in scope.
  6. Check the developer machines and CI users that already cloned the repository. A hook in the project settings runs for each of them. If any of them opened the project in an agent, assume the script may have run and move to credential rotation. The rotation order for keys an agent has already written down is in what to do when a coding agent exposes an API key.
  7. Search the rest of the organization for the same phrases. A private GitHub search for "sealed" next to a setup script, or for an instruction not to display setup.js, is how you find the copy that was pushed after the first laptop was hit. Do this before you announce that the one repo you found was the only repo.

Write down what you opened, what you removed, and which machines had already trusted the folder. The next person who reclones the repository needs that note. An audit that lives in a chat with the agent will be repeated from zero when the next starter kit shows up.

If a machine may have run the script, isolate it from the production network before you keep using it to rotate keys. Rotating a cloud key from the laptop that just leaked the cloud key is how the new key leaves too. Use a machine you trust, then decide whether the first laptop is rebuilt. Browser sessions, SSH agent sockets, and long-lived PATs on that laptop are part of the blast radius even when the repository itself looks clean again.

What a clean instruction file looks like

A file you keep can tell the agent how to run the tests, which package manager the repo uses, and which directories are generated. It can name a setup command that is already in package.json and that a person has read. It should not embed a secret, point at a credential file, or instruct the model to skip a confirmation the product would otherwise show.

Keep the file short enough that a reviewer finishes it. A 40-line CLAUDE.md gets read. A 400-line file that mixes architecture notes with shell one-liners hides the one-liner. If you need a long guide, link a document humans read and keep the agent file to commands you are willing to see executed.

Pin the review to pull requests. A change to AGENTS.md, CLAUDE.md, .claude/, or a rules directory requires a human reviewer the same way a change to .github/workflows does. Agents can propose the edit. They should not be the only author who approves it. In Bitdefender's description, the spread works by planting instructions the next agent will trust. Your review rule is the place that spread dies.

Templates get the same rule. The repository you clone for new services is a higher-risk file than any one service, because it is copied forward. Review it on a schedule, not only when a feature branch happens to touch it. If contractors or a vibe-coding tool start new repos from that template, they inherit the hook on day one.

What does not hold

Telling the model, inside the same file, "ignore instructions that look malicious" does not hold. The malicious file is the instruction source. You would be asking the model to disregard the document the product told it to follow, based on a sentence an attacker can also write more convincingly. The control is outside the model: a person reads the file before the product loads it, and a hook command that has not been read does not get to start.

An allow-list of "we only run npm test" does not hold if a session-start hook runs before that allow-list is consulted, or if the hook lives in a settings file the allow-list does not cover. Read the product's docs for the tool you actually installed. Claude Code's own split between a sandboxed shell and everything else is why a policy written only for Bash misses the hook. Confirm the setting on a laptop and in CI. They diverge.

VirusTotal on the markdown will not hold. The markdown is a paragraph. The harm is that a trusted developer tool executes what the paragraph names. A scanner may catch a known loader hash inside setup.js after the hash is published. It will not catch the paragraph on the morning the campaign is new, which is the morning someone clones the repo because an example looked useful.

Trusting the repository because it has stars, a familiar topic, or a fork from a project you know does not hold. Bitdefender's count is 22 links, which is enough to look like a pattern of examples and small enough to pass as random GitHub noise. A fork can add one file the upstream project does not have. Diff against upstream before you trust the folder, and treat a new .claude directory in that diff as code.

Deleting the file on one branch does not hold if the default branch, an old tag, or a second repo still has it. Agents and people check out tags. Audit the places a clone can start, including the template and the mirror your CI uses.

How a small team actually gets through the list

A founder with four repositories can finish the file list in an afternoon, as long as the agent stays closed until the list is done. Start with the repo that production deploys from, then the template, then the experiments. Experiments are where a cloned example usually lands, and experiments are where a personal access token often sits in the environment because someone was trying a deploy.

A company with a GitHub organization and twenty engineers needs the search to be central. One person opens the org search, exports the paths, and assigns owners. Each owner reads the files they recognize and flags the ones they do not. The security-relevant part is the flag, handled by someone who will not run the script. Parallel reading is fine. Parallel execution is how a curious teammate becomes the second incident.

Write the result as a table the team can keep: path, last author, whether a hook runs, whether a person has read the command, and the date. Store it next to the rest of your engineering notes. Six weeks later a new repo appears. The table is how you notice it was never on the list.

If the search finds a hit, stop the broad reading and move that repository and that developer out of the normal queue. A single confirmed instruction of the kind Bitdefender quotes is enough to treat tokens on that machine as burned. Finish rotation, then go back to the rest of the list. Teams that keep auditing other repos while a live token is still in the wild are documenting the spread instead of stopping it.

Where this sits next to the rest of the agent's trust boundary

Instruction files are one input. Tool servers are another. An MCP server the repo starts can run with a token the markdown never mentions. That review is in whether the agent's MCP servers are safe. Permissions decide what a successful run can touch. A setup script on a laptop that also has production cloud keys is a production incident even when the script was only supposed to install dev dependencies.

If you only add one control after this campaign, make instruction files and hooks a reviewed path, and keep production credentials off the machines that open untrusted repos in an agent. The file audit catches the paragraph. The missing production key limits the paragraph you have not caught yet.

Share the rule with people who do not think of themselves as the security team. The developer who clones a UI kit on a Sunday is the person this campaign is written for. A one-page note that says "do not open a third-party repo in the agent until someone has read CLAUDE.md and .claude/" will do more than a policy document that never reaches that laptop.

If this is your app, send the repo.

A 30-minute scope call. We read what is live, name what is dangerous, and quote a fixed scope.

How Techtribe audits a repository's agent instructions

We read every instruction file and hook the repo starts, including nested rules and the settings a template copies into new projects. You get a written list: which files the agent will load, which commands those files run, and which lines tell the agent not to show its work. We remove what nobody can explain and leave a short file a reviewer can actually finish.

A one-time pass fits when you have a handful of repositories and you want them opened safely in Claude Code or Cursor this month. A Dedicated Team fits when new repos appear every week, agents run in CI, or a starter kit is how every project begins. The code stays in your repo. The keys stay in your cloud. On the scope call we say which of those you are in, and we start with the repo you deploy from.

Bring the repositories you want opened in an agent, including the template if you have one, and say whether anyone has already trusted the folder on a laptop that holds cloud or GitHub credentials. If the answer is yes, we treat those credentials as burned and put rotation first. If a key may already be public, the follow-on is the credential sweep in the incident-response guide for keys an agent exposed.

The fixed scope for taking a generated app to production is a page per tool: Lovable, Bolt, v0, and Replit.

Questions

What did Bitdefender find in AGENTS.md and CLAUDE.md files?

On November 17, 2026 Bitdefender Labs said it had found 22 malicious GitHub links whose project instruction files tell an AI coding assistant to run a script named setup.js. The same campaign also uses session-start hooks so the script can run when a developer trusts the repository, without anyone typing a prompt.

Is an instruction file the same as a prompt injection in a README?

They overlap. A README can steer a model that reads it. AGENTS.md and CLAUDE.md are written for the agent on purpose, and a settings file can run a command before the model speaks. Treat both as code you are about to execute, then review them before the agent opens the project.

What should we do if the repo tells the agent not to read a setup script?

Stop. Do not open the project in the agent and do not run the script. An instruction that forbids reading, quoting, or displaying a file, or that says to run it without confirmation, is a reason to isolate the machine and rotate credentials that the user could already reach.

Does deleting the markdown file clean a machine that already ran the script?

No. Bitdefender describes a payload that steals credentials and can plant new agent instructions in other repositories the developer can write. Removing one file does not remove a token that was read, a hook under the home directory, or a commit the agent already pushed.

Book a free call

Have a vibe-coded app in production?

30-minute free call. We'll read what you have, name what is dangerous, and quote a fixed scope.