CVE-2018-3729: Path Traversal in localhost-now
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.72984%
CWE
Published
7/25/2018
Updated
3/1/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
localhost-now | npm | < 1.0.2 | 1.0.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from how user-supplied URL paths were handled in the HTTP request handler. The pre-patch code in lib/app.js
directly used req.url
to build a filesystem path without adequate sanitization. The critical line 'const file = url === '/' ? '/index.html' : url' allowed attackers to inject path traversal sequences. The commit diff shows the fix added a regex replacement (/(\.\.\/[\\\/])+/g
, '') to neutralize traversal attempts, confirming the original function's vulnerability. The fs.readFile
call with user-controlled input is the direct vector for exploitation.