Malicious code in cookie-parser-legacy (npm)
The cookie-parser-legacy npm package impersonates the legitimate cookie-parser middleware but includes malicious code. It replaces a critical dependency with a malicious package pinned to a mutable 'latest' tag, allowing arbitrary code execution during installation. The package imports child_process execSync without legitimate use, indicating potential for executing arbitrary commands. Systems with this package installed should be considered fully compromised, and all secrets should be rotated. Removal of the package may not fully remediate the compromise.
AI Analysis
Technical Summary
The cookie-parser-legacy npm package is a malicious clone of the popular cookie-parser Express middleware. It substitutes the legitimate 'cookie-signature' dependency with a malicious package named 'moustick' pinned to the mutable 'latest' tag, enabling execution of arbitrary code controlled by the attacker during installation and runtime. The presence of 'execSync' import without legitimate use further suggests capability for arbitrary command execution. This malicious package executes code on user-supplied cookie values using secrets from the host environment, leading to full system compromise. The package versions 1.5.1 through 1.5.4 are affected. Because the package name closely mimics a trusted library, users may inadvertently install it, exposing their systems to severe risk.
Potential Impact
Any system with cookie-parser-legacy versions 1.5.1 to 1.5.4 installed is considered fully compromised. The malicious package can execute arbitrary code during installation and runtime, potentially exposing all secrets and keys on the system. Attackers may gain full control over the affected system. Rotating all secrets and keys is necessary after compromise. Removal of the package alone does not guarantee full remediation due to possible persistence of malicious artifacts.
Mitigation Recommendations
No official patch or fix is available for this malicious package. Immediate removal of cookie-parser-legacy versions 1.5.1 through 1.5.4 is required. All secrets and keys on affected systems should be rotated from a clean, uncompromised environment. Users should verify dependencies carefully and avoid installing packages that impersonate well-known libraries. Monitor for any signs of persistent compromise and consider full system reimaging if necessary.
Malicious code in cookie-parser-legacy (npm)
Description
The cookie-parser-legacy npm package impersonates the legitimate cookie-parser middleware but includes malicious code. It replaces a critical dependency with a malicious package pinned to a mutable 'latest' tag, allowing arbitrary code execution during installation. The package imports child_process execSync without legitimate use, indicating potential for executing arbitrary commands. Systems with this package installed should be considered fully compromised, and all secrets should be rotated. Removal of the package may not fully remediate the compromise.
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 cookie-parser-legacy npm package is a malicious clone of the popular cookie-parser Express middleware. It substitutes the legitimate 'cookie-signature' dependency with a malicious package named 'moustick' pinned to the mutable 'latest' tag, enabling execution of arbitrary code controlled by the attacker during installation and runtime. The presence of 'execSync' import without legitimate use further suggests capability for arbitrary command execution. This malicious package executes code on user-supplied cookie values using secrets from the host environment, leading to full system compromise. The package versions 1.5.1 through 1.5.4 are affected. Because the package name closely mimics a trusted library, users may inadvertently install it, exposing their systems to severe risk.
Potential Impact
Any system with cookie-parser-legacy versions 1.5.1 to 1.5.4 installed is considered fully compromised. The malicious package can execute arbitrary code during installation and runtime, potentially exposing all secrets and keys on the system. Attackers may gain full control over the affected system. Rotating all secrets and keys is necessary after compromise. Removal of the package alone does not guarantee full remediation due to possible persistence of malicious artifacts.
Mitigation Recommendations
No official patch or fix is available for this malicious package. Immediate removal of cookie-parser-legacy versions 1.5.1 through 1.5.4 is required. All secrets and keys on affected systems should be rotated from a clean, uncompromised environment. Users should verify dependencies carefully and avoid installing packages that impersonate well-known libraries. Monitor for any signs of persistent compromise and consider full system reimaging if necessary.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-5346
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-xv3p-wcmf-6hp8"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a4f6c7068715ace4315aa34
Added to database: 07/09/2026, 09:40:00 UTC
Last enriched: 07/09/2026, 10:07:20 UTC
Last updated: 07/26/2026, 18:51:41 UTC
Views: 5
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.
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.