CVE-2019-16776: Unauthorized File Access in npm CLI before before version 6.13.3
Versions of the npm CLI prior to 6.13.3 are vulnerable to an Arbitrary File Write. It fails to prevent access to folders outside of the intended nodemodules folder through the bin field. A properly constructed entry in the package.json bin field would allow a package publisher to create files on a user's system when the package is installed. It is only possible to affect files that the user running npm install has access to and it is not possible to overwrite files that already exist on disk.
References:
https://www.npmjs.com/advisories/1434 https://nodejs.org/en/blog/vulnerability/december-2019-security-releases/ https://blog.npmjs.org/post/189618601100/binary-planting-with-the-npm-cli
Other sources
Versions of the npm CLI prior to 6.13.3 are vulnerable to an Arbitrary File Write. It fails to prevent access to folders outside of the intended nodemodules folder through the bin field. A properly constructed entry in the package.json bin field would allow a package publisher to modify and/or gain access to arbitrary files on a user's system when the package is installed. This behavior is still possible through install scripts. This vulnerability bypasses a user using the --ignore-scripts install option.
Affected Software
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is the vulnerability ID for this issue?
The vulnerability ID for this issue is CVE-2019-16776.
What is the severity of CVE-2019-16776?
The severity of CVE-2019-16776 is high (8.1).
Which versions of the npm CLI are affected?
Versions of the npm CLI prior to 6.13.3 are affected.
How can I fix CVE-2019-16776?
To fix CVE-2019-16776, make sure to update the npm CLI to version 6.13.3 or later.
Where can I find more information about CVE-2019-16776?
More information about CVE-2019-16776 can be found at the following references: [npm advisory](https://www.npmjs.com/advisories/1434), [Node.js blog](https://nodejs.org/en/blog/vulnerability/december-2019-security-releases/), [npm blog](https://blog.npmjs.org/post/189618601100/binary-planting-with-the-npm-cli).