Malicious GitHub Repos Are Now Targeting AI Agents
A 10,000-repo GitHub campaign and the Miasma worm were built to trick AI coding agents into running poisoned code. Here is why agents turn reading a repo into executing it, and how sandboxing, least privilege and secrets hygiene contain it.

Table of contents
A solo researcher mapping a sprawling GitHub malware campaign noticed something that should change how every developer thinks about their tooling: the fake repositories weren't really built to fool people. They were built to fool the AI agents that increasingly search GitHub, clone code, and run it on a developer's behalf. When the thing reading the repo is a coding agent with shell access, repo poisoning stops being a phishing problem and becomes a remote-code-execution problem.
What changed: poisoned repos aimed at machines, not humans
In June 2026, an independent investigator working under the alias Orchid documented roughly 10,000 malicious GitHub repositories seeding crypto-stealing Trojans. As Cybernews reported, the repos shared a common pattern: they were not forks of established projects, they came from many throwaway contributor accounts, and they were refreshed every few hours — old commits deleted, new ones pushed — to dodge detection. Crucially, the fake repos were engineered to rank above the originals in GitHub search.
That last detail is the tell. A human developer browsing GitHub is unlikely to download a ZIP from an unknown account and execute it. An AI coding agent told to "find a library that does X and set it up" behaves differently: it searches, takes a high-ranking result at face value, clones it, and may run setup scripts. Developers on Hacker News and security analysts both concluded the campaign reads as search-poisoning tuned for agents rather than people.
The pattern isn't isolated. In the same window, GitHub disabled 73 repositories across four Microsoft GitHub organizations after the so-called Miasma worm pushed a malicious commit to the Azure/durabletask repository. Per StepSecurity's analysis, the planted files were designed to execute a credential-harvesting payload when a developer opened the repository in an AI coding tool — specifically naming Claude Code, Gemini CLI, Cursor, and VS Code. The trigger wasn't a human clicking "run." It was an agent reading the project.
Why this is dangerous: agents turn "reading code" into "running code"
A traditional supply-chain attack waits for you to install a package or execute a binary. Agentic workflows collapse that gap. When an agent has permission to run terminal commands, install dependencies, or execute build steps, opening a poisoned repo can be enough to run attacker-controlled code in your environment.
The blast radius is whatever the agent can reach. On a developer machine that typically means: environment variables and .env files, cloud credentials cached by the AWS or gcloud CLIs, SSH keys, browser-session tokens, and the contents of every other repo on disk. Infostealer logs are exactly how credentials end up in bulk dumps — the 24-billion-record credential trove Cybernews surfaced in June 2026 was overwhelmingly made of infostealer output: usernames, passwords, and the services they unlock. A poisoned-repo payload that harvests local secrets is feeding that same pipeline.
There's a second mechanism worth naming: indirect prompt injection. A malicious repo doesn't have to ship a binary. It can hide instructions in a README, a code comment, an issue, or a config file that the agent reads as context and then obeys — "run this setup step," "fetch and execute this script," "add this dependency." The model can't reliably tell trusted instructions from untrusted content it just ingested, which is why the defense has to live around the model, not inside the prompt.
How to work more safely: sandbox, least privilege, secrets hygiene, test gates
The fix is not "tell the agent to be careful." It's containment. Treat any code an agent fetches as untrusted until proven otherwise.
- Sandbox execution. Run agent commands inside a disposable container or VM, not on your primary machine. If a payload fires, it detonates in a throwaway environment with no path to your real keys.
- Least privilege by default. Don't hand an agent broad shell, network, and filesystem access "to be convenient." Scope it to the project directory, deny outbound network where you can, and start every workflow read-only — let it analyze before it's allowed to execute.
- Keep secrets out of reach. No long-lived cloud keys or SSH keys sitting in the same environment the agent runs in. Use short-lived, scoped credentials and a secrets manager, and never commit
.envfiles the agent could read. - Pin and verify dependencies. Prefer named, well-known packages over whatever ranks first in a search. Pin versions, check the actual repository owner, and don't let an agent add a brand-new, low-history dependency unreviewed.
- Gate with tests and human review. Require that anything an agent produces passes CI and a human diff review before it touches a real branch, deploys, or runs against production data.
None of this is exotic; it's the same isolation discipline you'd apply to any untrusted code, now mandatory because the "reader" can also be the "runner."
FAQ
Does this only affect people using AI coding agents? The campaign is optimized for agents, but the repos are live for anyone. A human who clones and runs one is equally compromised. Agents just make the bad outcome far more likely because they act automatically.
Is GitHub itself compromised? No. The attackers abuse GitHub as a hosting and search surface — creating fake repos and gaming search ranking. The platform removes them, but new ones appear, so don't treat search rank as trust.
Will antivirus catch it? Not reliably. Repos mutate every few hours specifically to evade signatures, and an injected-instruction attack ships no malware at all. Isolation and least privilege are the durable defenses, not detection alone.
Bottom line
Repo poisoning aimed at AI agents reframes an old supply-chain risk: when the tool reading your code can also execute it, "just looking" can compromise you. The durable answer is architectural — sandbox the agent, give it the least privilege that lets it work, keep secrets out of its environment, and put tests and human review between the agent and anything that matters. Expect more campaigns built for machines, not people; the projects that isolate their agents now won't have to scramble when the next one lands.
Sources and further reading
Sources
- Cybernews: One tech pro single-handedly mapped a 10K malicious repos campaign on GitHub — AI agents targeted cybernews.com
- Cybernews: AI agents vulnerable to prompt injection via GitHub — but do vendors care? cybernews.com
- StepSecurity: Miasma Worm Hits Microsoft Again — Azure Functions Action and 72 other repositories disabled stepsecurity.io
- Cybernews: 24 billion records, including usernames and passwords, exposed in a colossal data leak cybernews.com


