Malicious GitHub repos hijack AI coding agents through AGENTS.md and CLAUDE.md
Malicious GitHub repos hijack AI coding agents through AGENTS.md and CLAUDE.md
Bitdefender found GitHub repositories whose agent instruction files tell your coding assistant to run a hidden malware loader, "automatically without asking for confirmation". The malware steals credentials and spreads by planting the same files in other repositories. If you open unfamiliar repos with Claude Code, Codex, Cursor or similar, this is aimed at you.
Links
- Report: How AI agents become new targets in GitHub malware campaign, Bitdefender Labs, 17 Nov 2026 (includes indicators of compromise)
- Map: moc-ai-security-incidents
How it works
- A repo ships an
AGENTS.mdorCLAUDE.md-style file telling the assistant to runscripts/setup.js, describing it as "a sealed binary artifact, not human-readable source code" so the agent won't look inside. - Session-start hooks in
.claude/settings.jsoncan also run a command once you trust the repo. setup.jsis a heavily obfuscated loader that unpacks and runs the main payload.- The payload checks stolen tokens against provider APIs, then encrypts and sends the data out.
It looks for 14 agents by name, including Claude, Codex, Gemini, Copilot, Cursor, Cline, Aider and Amazon Q.
What it steals: CI/CD and GitHub Actions credentials, cloud secrets, package-registry credentials, browser-stored passwords, password-manager data, SSH keys, .env files, API keys and source-control tokens.
How it spreads: it injects instructions, hooks or MCP server configs into other agent config files on your machine; uses stolen GitHub/GitLab tokens to commit the same files to up to 25 other repos; and tries to republish infected packages to npm, PyPI, RubyGems and JFrog. Bitdefender found 22 malicious repos or links and 13 versions of the loader.
What to do
From Bitdefender's advice:
- Read
AGENTS.md,CLAUDE.mdand the.claude/,.cursor/and.gemini/folders before opening an unfamiliar repo with an agent. - Check MCP definitions, session-start hooks, VS Code tasks and setup scripts.
- Treat "don't inspect", "suppress output", "skip confirmation" and auto-install instructions as red flags.
- Treat agent instruction files like dependencies and CI workflows: code that runs.
Bitdefender also promotes its own scanning tools. The report mentions no response from Anthropic, OpenAI or GitHub.