# CVE-2018-3731: npm public path traversal

Source: https://junglewise.ai/threats/cve-2018-3731-npm-public-path-traversal  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2018-07-18. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

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)](https://junglewise.ai/threats/technologies/public). Vendors: [npm](https://junglewise.ai/threats/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

- [https://github.com/tnantoka/public/commit/eae8ad8017b260f8667ded5e12801bd72b877af2](https://github.com/tnantoka/public/commit/eae8ad8017b260f8667ded5e12801bd72b877af2)

## Related threats

- [npm public path traversal via symlink navigation](https://junglewise.ai/threats/npm-public-path-traversal-via-symlink-navigation-dd9ade29)
- [npm public package stored cross-site scripting](https://junglewise.ai/threats/npm-public-package-stored-cross-site-scripting-d7e34af9)
- [Tnantoka public reflected XSS vulnerability](https://junglewise.ai/threats/cve-2018-16480-tnantoka-public-reflected-xss-vulnerability)
- [public Cross-Site Scripting in filename handling](https://junglewise.ai/threats/cve-2018-3747-public-cross-site-scripting-in-filename-handling)
