CVE-2019-16777 Arbitrary File Overwrite in npm CLI

High 7.7 Published Updated

Attackers can overwrite existing globally-installed binaries during package installation, potentially leading to code execution or privilege escalation.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2019-16777?

CVE-2019-16777 is a high-severity path traversal vulnerability in Fedoraproject Fedora, published on 13 Dec 2019. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

Official description

Versions of the npm CLI prior to 6.13.4 are vulnerable to an Arbitrary File Overwrite. It fails to prevent existing globally-installed binaries to be overwritten by other package installations. For example, if a package was installed globally and created a serve binary, any subsequent installs of packages that also create a serve binary would overwrite the previous serve binary. This behavior is still allowed in local installations and also through install scripts. This vulnerability bypasses a user using the --ignore-scripts install option.

Weakness: CWE-269, CWE-22

Which versions are affected by CVE-2019-16777?

2 open source packages ship an affected version, including npm. It affects 6 products.

PackageAffectedFixed in
npm npmAll versions6.13.4
npm npmAll versions6.13.4

Products include Fedoraproject Fedora, Npmjs Npm, Opensuse Leap, Oracle Graalvm, Redhat Enterprise Linux, Redhat Enterprise Linux Eus.

How do I fix CVE-2019-16777?

Upgrade npm to 6.13.4 or later.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2019-16777 being exploited?

There is no known exploitation of CVE-2019-16777 in the wild and no public exploit code.

All Fedoraproject Fedora vulnerabilities

Sources

Also known as DEBIAN-CVE-2019-16777, GHSA-4328-8hgf-7wjr, MINI-wpcm-v5x2-4prj, UBUNTU-CVE-2019-16777.

Is CVE-2019-16777 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free