CVE-2018-3731: npm public path traversal

CVE-2018-3731 · Severity: low · CVSS 3.1 · Published 2018-07-18

The "public" npm package is a lightweight HTTP server for serving static files. Versions before 0.1.3 fail to properly validate file paths, allowing an attacker to read arbitrary files accessible to the server process. This could expose sensitive configuration files, source code, or other confidential data stored on the same system.

Technologies: public (npm). Vendors: npm.

Quick answers

Is CVE-2018-3731 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2018-3731 being exploited in the wild.
How severe is CVE-2018-3731?
Low severity, with a CVSS score of 3.1, published 18 July 2018.
Which products and versions are affected?
public (npm) before 0.1.3.
Is there a fix for CVE-2018-3731?
A patch was published on 2018-07-18: Fixed in version 0.1.3 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2018-3731 attacked?
It is attacked over the network.
Am I affected by CVE-2018-3731?
Check whether you run public (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

The vulnerability is a classic path traversal (CWE-22) caused by insufficient sanitization of user-supplied file paths. The vulnerable component is the file path handling logic in the HTTP request handler, which does not resolve and validate paths against a configured root directory. An unauthenticated attacker can send requests with traversal sequences (e.g., "../../../etc/passwd") to read arbitrary files. The attack requires only network access to the HTTP server and no user interaction. Fix is available in version 0.1.3 and later, which adds proper path resolution and validation.

Affected products

  • npm public before 0.1.3

Identifiers

  • CVE-2018-3731
  • GHSA-rwv8-jvff-jq28

Timeline

  • 2018-06-07: disclosed
  • 2018-07-18: advisory
  • 2018-07-18: patched: Fixed in version 0.1.3

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.