Malicious code in type-swap (npm)
The npm package 'type-swap' version 3.1.3 contains malicious code that executes a concealed detached child process. This process fetches and executes remote JavaScript code, enabling arbitrary code execution within the installer's Node environment. The package impersonates a legitimate logging library to evade detection. Any system with this package installed should be considered fully compromised, and all secrets and keys on that system must be rotated immediately. Removal of the package does not guarantee elimination of all malicious components.
AI Analysis
Technical Summary
The 'type-swap' npm package version 3.1.3 exports a middleware factory that spawns a detached child process running 'lib/caller.js', which performs an HTTPS GET request to a remote URL to retrieve a JavaScript payload embedded in a cookie field. This payload is executed dynamically using the Function constructor with 'require' bound, allowing arbitrary code execution in the Node.js process. Additional remote endpoints are stored base64-encoded in a fake environment variable, facilitating staged payload delivery. The package and its README falsely impersonate an unrelated logging library to conceal its malicious intent.
Potential Impact
Systems with 'type-swap' version 3.1.3 installed are fully compromised due to arbitrary remote code execution capabilities granted to the attacker. This can lead to complete system takeover, exposure of secrets, keys, and sensitive data. The attacker may maintain persistence beyond package removal, making remediation complex and urgent.
Mitigation Recommendations
Immediate removal of the 'type-swap' package version 3.1.3 is required. All secrets, keys, and credentials stored on the compromised system must be rotated from a separate, trusted device. Due to the high risk of full system compromise, a thorough incident response and forensic analysis should be conducted. No official patch or fix is available; therefore, avoid using this package version entirely.
Malicious code in type-swap (npm)
Description
The npm package 'type-swap' version 3.1.3 contains malicious code that executes a concealed detached child process. This process fetches and executes remote JavaScript code, enabling arbitrary code execution within the installer's Node environment. The package impersonates a legitimate logging library to evade detection. Any system with this package installed should be considered fully compromised, and all secrets and keys on that system must be rotated immediately. Removal of the package does not guarantee elimination of all malicious components.
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 'type-swap' npm package version 3.1.3 exports a middleware factory that spawns a detached child process running 'lib/caller.js', which performs an HTTPS GET request to a remote URL to retrieve a JavaScript payload embedded in a cookie field. This payload is executed dynamically using the Function constructor with 'require' bound, allowing arbitrary code execution in the Node.js process. Additional remote endpoints are stored base64-encoded in a fake environment variable, facilitating staged payload delivery. The package and its README falsely impersonate an unrelated logging library to conceal its malicious intent.
Potential Impact
Systems with 'type-swap' version 3.1.3 installed are fully compromised due to arbitrary remote code execution capabilities granted to the attacker. This can lead to complete system takeover, exposure of secrets, keys, and sensitive data. The attacker may maintain persistence beyond package removal, making remediation complex and urgent.
Mitigation Recommendations
Immediate removal of the 'type-swap' package version 3.1.3 is required. All secrets, keys, and credentials stored on the compromised system must be rotated from a separate, trusted device. Due to the high risk of full system compromise, a thorough incident response and forensic analysis should be conducted. No official patch or fix is available; therefore, avoid using this package version entirely.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-10511
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-w8hw-4vch-mrj4"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a55ff8a68715ace432f47aa
Added to database: 07/14/2026, 09:21:14 UTC
Last enriched: 07/14/2026, 09:46:27 UTC
Last updated: 07/23/2026, 02:27:30 UTC
Views: 9
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.