Hackers have devised a method to compromise AI coding tools by embedding harmful files within GitHub repositories. These files, when accessed by AI assistants, can execute malware designed to steal developer credentials and propagate across multiple projects.
Targeting Popular AI Tools
The attackers are focusing on popular coding assistants like Claude Code and Cursor. So far, 22 malicious GitHub links have been identified. The strategy involves inserting commands into files that AI tools interpret, leading them to execute harmful scripts without developers’ awareness.
These scripts leverage the developer’s permissions to perform their tasks. Researchers from Bitdefender Labs, including Andrei Anton-Aanei, revealed the extent of this campaign, highlighting how it exploits configuration files and settings that automate coding processes.
Manipulation of Project Files
Files such as AGENTS.md and CLAUDE.md, typically used to guide test executions or coding standards, are manipulated to instruct AI tools to run a script named setup.js. The script is misleadingly described as a secure and cryptographic component, prompting the AI to execute it without inspection.
This indirect prompt injection tactic places harmful instructions within the content AI reads, rather than directly from user input. Additionally, settings files can trigger actions by embedding commands that run automatically when a session starts.
Expanding Through Compromised Credentials
The setup.js file acts as a multi-stage loader, hiding its intent by decoding a large hex value and executing a Node.js script. The final payload targets sensitive credentials, including those for CI/CD systems and cloud platforms, among others.
The malware then uses stolen tokens to access and potentially alter other repositories. It checks for account details and permissions, attempting to push malicious files to more projects. By default, it targets up to 25 repositories, inspecting multiple branches within each.
Developers are advised to carefully scrutinize unfamiliar repositories before usage, particularly looking for signs of manipulation in configuration files and scripts. Tools like Bitdefender’s AI Guardian can help by analyzing these files before execution.
Conclusion and Protective Measures
This attack highlights the importance of vigilance and robust security measures in software development environments. Developers should regularly review and update their security protocols to defend against such threats. By staying informed and proactive, the risk of credential theft and project compromise can be minimized.
