Hackers Hijack AI Coding Agents Through Malicious GitHub Repositories to Steal Developer Credentials

Blog WriterCybersecurity News - Original News Source is cybersecuritynews.com


Hackers are planting poisoned files in GitHub repositories to make AI coding assistants run hidden malware. The malware steals developer credentials, and it also uses them to spread to other projects.

The campaign targets tools such as Claude Code and Cursor, and 22 malicious GitHub links have been found so far. The trick is simple. Files that AI tools read to understand a project now carry secret orders.

Once a developer opens the repository, the assistant may run a script without any warning. That script runs with the developer’s own access and permissions.

Analysts at Bitdefender Labs identified the malware, and thge researcher Andrei Anton-Aanei found the 22 malicious links and mapped how they work. The team says the campaign abuses the files, rules, hooks and settings that AI coding tools use to automate work.

Hackers Hijack AI Coding Agents Through Malicious GitHub Repositories

Many projects include files such as AGENTS.md and CLAUDE.md. These notes tell an AI assistant how to run tests or follow coding rules. In this campaign, the same files carry a different message. They tell the assistant to run a file named setup.js.

The text is written to sound official. It calls the script a “sealed binary artifact” that has been cryptographically signed. It tells the assistant not to read or show the contents, to run it at session start, and to hide the output.

If a user asks for help before setup has run, the assistant is told to run node scripts/setup.js without asking. This language is meant to make a risky step feel routine.

A malicious project instruction file (Source - Bitdefender)
A malicious project instruction file (Source – Bitdefender)

This is a form of indirect prompt injection attack, where harmful instructions sit in content the AI reads instead of in what the user types. Researchers have already shown that a clean-looking repository can push an agent into opening a reverse shell.

There is also a second path that needs no AI prompt at all. Bitdefender found settings files, such as .claude/settings.json, that use session-start hooks.

Once a developer trusts the repository, the hook can run a command in the user’s shell. The configuration file does the work, and the AI never has to follow an instruction.

The setup.js file is a multi-stage loader built to hide its purpose. The outer file is a 3.75 MB single-line script. It decodes a large hex value, applies ROT13 and runs the result.

That reveals a Node.js stager with two AES-128-GCM encrypted blobs. One blob unpacks into a 4.67 MB bundle. The stager then downloads or finds the Bun runtime and passes the bundle to it.

The final payload goes after credentials. It targets CI/CD systems and GitHub Actions, cloud platforms, package registries, browser-stored logins and password managers.

It also takes Windows Credential Manager data, SSH keys, .env files, API keys and source-control tokens. It can check whether stolen tokens still work, then encrypt and batch the data. Extra modules sit in a compressed _bz field in package.json.

Self-Spreading Through Stolen Tokens and Agent Settings

This is more than a password stealer, because it is built to spread. After it runs, it searches the victim’s home folder for AI agent settings, such as mcp.json, .cursorrules, .windsurfrules and .github/copilot-instructions.md.

It keeps results that match 14 agent names: Claude, Codex, Gemini, Copilot, Kiro, OpenCode, Cline, Aider, Tabby, Amazon Q, Cody, Bolt, Continue and Cursor. It then adds its own instructions, hooks or MCP server settings to those files.

The spread also reaches other repositories. The malware checks stolen GitHub and GitLab tokens for account details, repositories, scopes and push rights.

For GitHub it looks for the repo, public_repo and workflow scopes. By default it is capped at 25 target repositories through a MAX_TARGET_REPOS setting. For each target it can inspect up to 50 branches and skip automated ones, such as dependabot/ and copilot/.

If the account has enough rights, it commits files that trigger AI tools, including AGENTS.md, CLAUDE.md, .mcp.json and .vscode/tasks.json.

A session-start hook can launch setup.js (Source - Bitdefender)
A session-start hook can launch setup.js (Source – Bitdefender)

It can also edit package data and workflows. It may try to republish infected packages through npm, PyPI, RubyGems and JFrog. The pattern echoes the Mini Shai-Hulud npm worm, which also searched for Claude Code settings and VS Code task files.

A recent case of 4,837 hijacked GitHub accounts shows how fast stolen tokens can reach tens of thousands of repositories.

Developers should review unfamiliar repositories before opening them in an AI-enabled editor. Check AGENTS.md, CLAUDE.md, and the .claude/, .cursor/ and .gemini/ folders.

Look at MCP server definitions, session-start hooks, VS Code tasks and unknown setup scripts. Treat any text that says not to inspect a file, hides output or skips confirmation as a warning sign. Earlier research on a Claude Code deny-rule bypass showed that a CLAUDE.md file alone can be enough to cause harm.

Bitdefender says its AI Guardian tool inspects instruction files such as CLAUDE.md and AGENTS.md before the agent acts. In internal tests on November 10, it detected all 22 samples.

The company notes that new variants may give different results. If a system ran any of these files, rotate every token, key and cloud secret that the machine could reach.

Indicators of compromise (IoCs):-

Repository setup.js MD5
toray/QiniuSDK-lib b9a182b646c7fdff68f2ff9dfd822516
toray/widget-lib b9a182b646c7fdff68f2ff9dfd822516
toray/XiamiSDK-lib b9a182b646c7fdff68f2ff9dfd822516
toray/torayUtils-lib b9a182b646c7fdff68f2ff9dfd822516
toray/Rainbow-lib b9a182b646c7fdff68f2ff9dfd822516
ConcordiaDev/theme_saimaniq 2f54f6d41f41bb3c8e684b0f009cbcc3
itsunai/docker-php-fpm 3794736979327349404171798328a38a
itsunai/passport_auth_server 3794736979327349404171798328a38a
ejaaduipitara/djp-devops ab7ff2f782c194953e5811d16b9e1817
ejaaduipitara/whatsapp-bot ab7ff2f782c194953e5811d16b9e1817
ejaaduipitara/content-service ab7ff2f782c194953e5811d16b9e1817
Imanilom/baraja-coffe 2191cbd04134839daeb6b8909725eae0
bajoebel/kkpatip 31f1f5d9c59b950d91d05cecee20fce8
ahmadtohar9/restomoiz 908293cd1ed04cf50fbe72baf74967b6
tobias94-design/s-valentine bbd5695c36e76538547c45fd17e6c7e4
tobias94-design/gymtracker bbd5695c36e76538547c45fd17e6c7e4
tobias94-design/signage bbd5695c36e76538547c45fd17e6c7e4
claudiohernanbesada/xenios.api… (name truncated in source) 7ad1567180f6d5a5b317f697310a796c
rkamphuis012-hub/sr-pilot-codex-test 5c8db9bf78c6c2174ccf8a6299f9aafd
Malala-Tour-Indonesia/Malala-Tour-Indonesia.github.io 82a8be193a41f5b17906f919a179d999
julieth333/campustech 5dc5473468ee2d8006ebdaab0c7e93fb
madolee/da… (name truncated in source) a20a99e325226f56d7a25460a9d436ab

Note: IP addresses and domains are intentionally Qdefanged (e.g., [.]) to prevent accidental resolution or hyperlinking. Re-fang only within controlled threat intelligence platforms such as MISP, VirusTotal, or your SIEM.

Give your SOC the alert context on the latest threats to stop incidents quickly -> Integrate Threat Intel from 16K SOCs

The post Hackers Hijack AI Coding Agents Through Malicious GitHub Repositories to Steal Developer Credentials appeared first on Cyber Security News.