The mailparser and getcookies npm Supply Chain Attack
Updated 5 Oct 2026 · Incident date 12 Apr 2018 · npm
mailparser 2.2.0 -> 2.2.1 (also 2.2.2, 2.2.3)mailparser's package.json gained the http-fetch-cookies dependencymailparser 2.2.1, 2.2.2 and 2.2.3 added a new dependency that led to the getcookies backdoor. npm found the chain on 2 May 2018 and removed all of it.
The mailparser versions never called the new package. The risk was the code that sat in the dependency tree.
What happened
An attacker hid a remote code execution backdoor in a chain of npm packages and then added the chain to mailparser. The npm security report describes it.
The chain was mailparser to http-fetch-cookies to express-cookies to getcookies. The last package had no real function. It read HTTP request headers for a pattern of the form gCOMMANDhDATAi. The control codes were 0xfffe to reset a buffer and 0xfffa to run the buffered code with vm.runInThisContext. Any other code loaded remote code into memory. An Express app that used the module directly can run attacker code from a web request.
npm got the first report at 5:23 AM PDT on 2 May 2018. The team removed the three malicious packages at 7:01 AM and the three mailparser versions at 7:26 AM. It also revoked the author's tokens. BleepingComputer reports that the account that published the packages was named dustin87. It reports that mailparser had about 66,000 weekly downloads. It also reports that no exploitation attempts were documented.
npm notes that the mailparser versions did not use the module in any way. So mailparser users were not exposed by the backdoor itself. The case still matters. A new dependency that parses requests and runs code is a capability that mailparser never had. Vigilance reports a change like this when it compares the trusted version with the new one.
Affected versions
mailparser 2.2.1, 2.2.2 and 2.2.3 contained the dependency. Version 2.2.0 is clean.
mailparser2.2.1, 2.2.2, 2.2.3: removed from npm.http-fetch-cookies: all versions removed.express-cookies: all versions removed.getcookies: all versions removed.
mailparser was rolled back to 2.2.0, per BleepingComputer.
Indicators of compromise
- Any of the packages
getcookies,express-cookiesorhttp-fetch-cookiesinnode_modulesor in a lock file. - A mailparser entry at 2.2.1, 2.2.2 or 2.2.3 in a lock file.
- A
vm.runInThisContextcall in a package that has no reason to run code. - The publisher account
dustin87.
How to check
List the three malicious packages in your dependency tree and check the mailparser version.
npm ls getcookies express-cookies http-fetch-cookies mailparser grep -nE "getcookies|express-cookies|http-fetch-cookies" package-lock.json
An empty result for the first three packages means the chain is not installed. A mailparser version of 2.2.0 is clean. Run the check in each project and each CI cache.
What to do now
- Move mailparser to 2.2.0 or a later release that does not contain the chain.
- Delete
node_modulesand install again from a clean lock file. - Stop use of
getcookies,express-cookiesandhttp-fetch-cookies. npm removed all versions. - If an Express app used the packages directly, treat the server as exposed. Review the logs for odd request headers and rotate secrets.
- Review new transitive dependencies when a minor version adds them.
What Vigilance showed
Vigilance compares the version you trust with the new one and names the file that gained a new capability. The block below is rebuilt from the public reports in the words Vigilance prints. It is not a captured scan, because the malicious release is not redistributed.
files scanned: 49 HEADS UP 1 file can now do things the old version could not. The rest changed and gained nothing. CHANGED package.json It now downloads from the internet and runs other programs. It did not before.
Frequently asked questions
Which mailparser versions had the getcookies backdoor?
Versions 2.2.1, 2.2.2 and 2.2.3. They depended on http-fetch-cookies, which depended on express-cookies and then getcookies. npm removed them on 2 May 2018.
Was mailparser itself exploitable?
According to the npm report, the mailparser versions did not use the module in any way. Apps that used the malicious packages directly were the real risk.
How do I check for getcookies in my project?
Run npm ls getcookies express-cookies http-fetch-cookies mailparser and search package-lock.json for the same names.
Sources
More supply chain attacks
- @apexacc/cli Defender-blinding C2 loader 17 Sept 2026
- keyv / cacheable npm worm (Shai-Hulud third wave) 4 Aug 2026
- Mastra AI npm compromise (Sapphire Sleet) 17 Jun 2026
- TanStack npm compromise (Mini Shai-Hulud) 11 May 2026
All 111 attacks in the library · npm supply chain attacks · How to prevent supply chain attacks
Check the next update before you install it
Vigilance compares the version you trust with the new one. It names the one file that can now do something it could not do before.