Malicious code in 2nestjs (npm)
Description
The 2nestjs npm package is a malicious typosquatting package impersonating the popular nestjs package. Its postinstall script exfiltrates environment variables containing secrets to a remote server and establishes a reverse shell, allowing arbitrary command execution on the installer's machine.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The 2nestjs package, a numeric-prefix typosquat of nestjs, contains malicious code in its postinstall hook. This hook enumerates environment variables, filters those matching sensitive key patterns (SECRET, API, TOKEN, KEY), serializes their values, and sends them over a raw TCP socket to a hardcoded remote host (84.32.22.44:9999). Additionally, it invokes a netcat command to open an interactive reverse shell to the same host, granting the attacker full remote command execution on the victim's system. The package's own metadata and logs confirm its intent to target nestjs users via typosquatting.
Potential Impact
Installation of version 0.0.1 of the 2nestjs package results in exfiltration of sensitive environment variables and establishes a remote shell, enabling an attacker to execute arbitrary commands on the affected system. This compromises confidentiality and integrity of the environment and system.
Mitigation Recommendations
No official patch or remediation is available for this malicious package. The best mitigation is to avoid installing 2nestjs and verify package names carefully to avoid typosquatting. Remove the package if installed and investigate any potential compromise. Use trusted sources and package integrity verification mechanisms.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-15911
- Osv Schema Version
- 1.7.4
- Ecosystems
- ["npm"]
Threat ID: 6a9ad4edacd9273b49b677e0
Added to database: 09/04/2026, 14:25:49 UTC
Last enriched: 09/07/2026, 17:28:53 UTC
Last updated: 10/04/2026, 06:57:03 UTC
Views: 28
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.