AI-Generated npm Malware Exposes Threat Actor’s GitHub Token
Key Takeaways A new npm package, “mouse5212-super-formatter,” was identified as an infostealer. The malware, likely AI-generated, inadvertently exposed the attacker’s private GitHub...
Key Takeaways
- A new npm package, “mouse5212-super-formatter,” was identified as an infostealer.
- The malware, likely AI-generated, inadvertently exposed the attacker’s private GitHub token, offering insights into the operation.
- The package was designed to exfiltrate all files from the “/mnt/user-data” directory to a GitHub repository controlled by the threat actor.
- The attacker’s operational security was poor, suggesting a lack of experience and reliance on AI tools.
- Developers who installed this package should immediately revoke GitHub tokens and audit compromised files.
A recent discovery by security researchers has shed light on the increasing prevalence of AI-generated malware within the open-source software ecosystem. In a notable incident, an npm package designed as an infostealer inadvertently exposed its creator’s private GitHub token, providing an unusual level of insight into the attacker’s activities and methods.
Table Of Content
The “mouse5212-super-formatter” Infostealer
The malicious package, named “mouse5212-super-formatter,” was found on the npm registry. Its primary function was to operate as an infostealer, covertly extracting files from any developer’s system upon installation. Disguised as a benign “archive deployment sync” utility, the malware aimed to blend in with legitimate internal tools.
Once installed, the malware was programmed to scan the local “/mnt/user-data” directory recursively. It then uploaded every discovered file directly to a remote GitHub repository controlled by the threat actor. This exfiltration process utilized the GitHub Contents API. To complicate detection and differentiate between multiple victim data, the stolen files were stored under randomly generated folder names for each session.
Before its true nature was uncovered, the malicious package garnered 676 downloads. At the time of reporting, it remained active on the npm platform.
Careless Mistakes Uncover Threat Actor
Researchers at OX Security were responsible for identifying the package and subsequently published a comprehensive analysis detailing its behavior and internal mechanisms. Their findings indicated that this was not a sophisticated, professionally crafted attack. Instead, the malware’s code exhibited significant sloppiness, leading to critical operational security failures by the attacker.
The most significant blunder was the hardcoded private GitHub token embedded directly within the malware. This token belonged to the threat actor, not any victim, and provided the OX Security researchers with the unique ability to monitor the file exfiltrations in real-time. OX Security’s report, shared with Cyber Security News, documented approximately seven active exfiltration events observed in the attacker’s GitHub repository before it was taken down. Most of these events appeared to be tests conducted by the attacker during the malware’s development phase.
Further analysis revealed that the threat actor’s GitHub account was created merely hours before the initial malicious version of the package was uploaded to npm. Following the discovery of the attack, the account was promptly deleted. This brief operational timeline, coupled with the negligent inclusion of a private token, strongly suggests that the individual behind the attack lacked professional experience in cybersecurity operations. Researchers hypothesize the attacker likely relied on AI tools to generate the malicious code without a full understanding of secure coding practices or operational security principles.
The malware attempted to mask its activities by writing fake “network connections” logs during execution, making the data theft appear as routine diagnostic processes. Additionally, comments and commit messages within the code were deliberately written in generic, technical language to reduce suspicion. The exfiltrated data was also encoded using base64, a basic obfuscation technique intended to obscure the content during transmission.
AI-Assisted Malware Creation is Lowering the Bar
This incident serves as a stark illustration of how threat actors are leveraging artificial intelligence to generate malicious code without adhering to fundamental operational security concepts. The accessibility of AI tools is significantly lowering the barrier to entry for creating functional malware, and the cybersecurity community should anticipate a rise in similarly unsophisticated, AI-assisted malware campaigns in the near future.
While such AI-generated malware may be imperfect and prone to errors, like the hardcoded token in this case, it still poses a tangible risk if it manages to reach a substantial number of users before detection. Developers and security teams are advised to exercise extreme caution when evaluating new packages, particularly those with limited history, low download counts, and a lack of clear community endorsement.
What You Should Do
If you or your organization installed the “mouse5212-super-formatter” npm package, OX Security recommends taking immediate action to mitigate potential damage:
- Revoke GitHub Access Tokens: Immediately revoke any GitHub access tokens that may have been present in the environment where the malicious package was installed.
- Audit Compromised Files: Treat all files within the “/mnt/user-data” directory as potentially compromised. Conduct a thorough audit of these files for any sensitive data that may have been exfiltrated.
- Review Package Dependencies: Implement strict vetting processes for all new npm packages. Prioritize packages with established reputations, a significant number of downloads, and active community support.
- Enhance Endpoint Monitoring: Deploy and maintain robust endpoint detection and response (EDR) solutions to monitor for unusual file access patterns, network connections, and data exfiltration attempts.
Indicators of Compromise (IoCs):-
| Type | Indicator | Description |
|---|---|---|
| Package Name | mouse5212-super-formatter | Malicious npm infostealer package |
| File Path | /mnt/user-data | Local directory targeted for recursive file exfiltration |
| Exfiltration Method | GitHub Contents API | Used to upload stolen files to threat actor’s repository |
| Obfuscation Technique | Base64 encoding | Used to encode exfiltrated file contents during upload |
Disclaimer: HackersRadar reports on cybersecurity threats and incidents for informational and awareness purposes only. We do not engage in hacking activities, data exfiltration, or the hosting or distribution of stolen or leaked information. All content is based on publicly available sources.



No Comment! Be the first one.