Overview
npm allows packages to take actions that could result in a malicious npm package author to create a worm that spreads across the majority of the npm ecosystem.
Description
| npm is the default package manager for Node.js, which is a runtime environment for developing server-side web applications. There are several factors in the npm system that could allow for a worm to compromise the majority of the npm ecosystem: 
 When these three aspects of npm are combined, it provides the capability for a self-replicating worm. The following steps are an example worm workflow outlined in the report provided by Sam Saccone: 
 The full report from Sam Saccone is available here in PDF form:  npmwormdisclosure.pdf The timeline provided in the above document is as follows: Jan 1 2016  Initial discovery of exploit Jan 4 2016  Initial disclosure + proof of concept to npm Jan 5 2016   Private disclosure to Facebook Jan 7 2016  Response from npm Jan 8 2016  Confirmation of works as intended no intention to fix at the moment from npm. Feb 5 2016  Shared the disclosure doc | 
Impact
| An attacker may be able to create a self-replicating worm that spreads as users install packages. | 
Solution
| The CERT/CC is currently unaware of a practical solution to this problem. Please see the npm Blog for details and also consider the following workarounds: | 
| 
 | 
Vendor Information
CVSS Metrics
| Group | Score | Vector | 
|---|---|---|
| Base | 6 | AV:N/AC:M/Au:S/C:P/I:P/A:P | 
| Temporal | 5.1 | E:POC/RL:W/RC:C | 
| Environmental | 3.8 | CDP:ND/TD:M/CR:ND/IR:ND/AR:ND | 
References
- http://blog.npmjs.org/post/141702881055/package-install-scripts-vulnerability
- https://www.npmjs.com/
- https://nodejs.org/en/
- https://docs.npmjs.com/getting-started/semantic-versioning
- https://docs.npmjs.com/cli/shrinkwrap
- https://github.com/joaojeronimo/rimrafall
- https://blog.liftsecurity.io/2015/01/27/amaliciousmoduleonnpm
- https://medium.com/@nm_johnson/npm-package-hijacking-from-the-hijackers-perspective-af0c48ab9922
- https://github.com/contolini/pizza-party
Acknowledgements
Thanks to David Ross and Sam Saccone for reporting this vulnerability.
This document was written by Will Dormann.
Other Information
| CVE IDs: | None | 
| Date Public: | 2016-03-25 | 
| Date First Published: | 2016-03-26 | 
| Date Last Updated: | 2016-03-26 21:46 UTC | 
| Document Revision: | 46 |