VOOZH about

URL: https://thenewstack.io/npm-attackers-sneak-a-backdoor-into-node-js-deployments-through-dependencies/

⇱ Npm Attackers Sneak a Backdoor into Node.js Deployments through Dependencies - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2018-05-08 09:42:14
Npm Attackers Sneak a Backdoor into Node.js Deployments through Dependencies
Security / Software Development

Npm Attackers Sneak a Backdoor into Node.js Deployments through Dependencies

May 8th, 2018 9:42am by Lucian Constantin
👁 Featued image for: Npm Attackers Sneak a Backdoor into Node.js Deployments through Dependencies

Maintainers of the npm registry for JavaScript code have recently identified what appeared to be a software supply-chain attack that took advantage of the nested dependency model of Node.js modules.

After being notified by members of the development community, the npm security team recently began investigating three suspicious packages and one of them turned out to include a backdoor or a secret entranceway unbeknownst by users. The modules, called getcookies, express-cookies and http-fetch-cookies, had been uploaded by the same user.

The getcookies package contained malicious code that allowed remote users to execute arbitrary code on servers through commands hidden in HTTP request headers. The other two packages were decoys and their purpose was to make it harder to discover getcookies.

The backdoor’ed module was listed as a dependency for express-cookies, which was itself listed as a dependency for http-fetch-cookies. The investigation also revealed that a few weeks ago, an existing package called mailparser began listing http-fetch-cookies as a dependency, completing the malicious chain.

“Despite being deprecated, mailparser still receives about 64,000 weekly downloads,” the npm security team said in a blog post. “We searched for how users of this module might be impacted. We determined the published versions of mailparser that depended on http-fetch-cookies did not use the module in any way, eliminating any risk the backdoor posed. We speculate that mailparser’s requiring http-fetch-cookies was to execute an attack in the future or to inflate download counts of express-cookies to add to its legitimacy.”

But while applications that used mailparser were not affected, those that directly pulled in any of the other three modules might have been compromised.

The modules have been unpublished from the npm registry, along with three versions of mailparser—2.2.3, 2.2.2 and 2.2.1—that listed http-fetch-cookies as a dependency. It’s not clear how the rogue dependency was added in the first place to mailparser, which is no longer maintained but is still listed itself as a dependency for 213 other modules.

Researchers warned in the past that a large number of module maintainers used weak passwords, but the npm maintainers have taken several actions to address that problem since then. That said, there are many ways in which developers can have their computers infected with malware and any such compromise presents an opportunity for attackers to backdoor legitimate code and launch software supply-chain attacks.

This is not the first time when malicious packages have been found in the npm registry, or the popular package repositories for other programming languages, but for the most part those attacks used typosquatting — the publishing of rogue packages with names very similar to popular ones.

This incident, however, was better thought out, abusing the dependency system to make the backdoor’ed package appear more legitimate and to make it harder for users to detect it. It highlights why it’s important for developers to carefully review the modules they use in their applications and to maintain software bills of materials so they can quickly assess the damage if any of those components gets compromised.

Feature image via Pixabay.

TRENDING STORIES
Lucian is a freelance writer for The New Stack. He has been covering cybersecurity and the hacker culture for over a decade, his work appearing in many online technology publications including PCWorld, Computerworld, Network World, The Inquirer and Softpedia.com. Lucian...
Read more from Lucian Constantin
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.