Hackers hijack AI coding agents through malicious GitHub repositories to steal developer credentials
Hackers Hijack AI Coding Agents Through Malicious GitHub Repositories to Steal Developer Credentials
Bitdefender Labs disclosed that hackers planted malicious instruction files and configurations in GitHub repositories to induce AI coding agents such as Claude Code and Cursor to run hidden malware that steals developer credentials, and 22 malicious repository links have been found. One path is writing seemingly official instructions into instruction files such as AGENTS.md and CLAUDE.md, requiring the agent to run setup.js without reading or displaying its contents, which is indirect prompt injection; the other is session startup hooks in configurations such as .claude/settings.json that directly execute commands. setup.js is a multi-stage loader whose final payload steals credentials including CI/CD, cloud platform, package registry, password manager, SSH keys, .env files, API keys and source control tokens, and uses stolen GitHub and GitLab tokens to commit trigger files to other repositories to self-propagate, with a default of up to 25 target repositories.
The attack chain disclosed by Bitdefender shows that malicious repositories can use AI instruction files and session hooks to steal developer credentials and self-propagate; the article provides a checklist to review before opening a repository.