cookie-parser-legacy (npm) · Malicious Code
Affects cookie-parser-legacySource GCVE Database
Malicious package : remove cookie-parser-legacy and rotate any secrets on hosts that installed it.
Data as of 9 Jul 2026, 10:07 UTC
Malicious package
Published to npm · OSV MAL-2026-5346
What to do
Remove cookie-parser-legacy from every project, lockfile and image that pulls it in. Treat any host that installed it as compromised: rotate the credentials, tokens and keys it could read, from a clean machine.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npmcookie-parser-legacy | Affected
| Fixed in– |
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
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.
References
- github.com/advisories/GHSA-xv3p-wcmf-6hp8 (opens in a new tab)
- npmjs.com/package/cookie-parser-legacy/v/1.5.4 (opens in a new tab)
- npmjs.com/package/cookie-parser-legacy/v/1.5.3 (opens in a new tab)
- npmjs.com/package/cookie-parser-legacy/v/1.5.2 (opens in a new tab)
- npmjs.com/package/cookie-parser-legacy/v/1.5.1 (opens in a new tab)