CVE-2018-3731: Public Path Traversal Vulnerability
HIGHCVE-2018-3731 is a HIGH (CVSS 7.5) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Public libraries in the npm ecosystem. The issue involves path traversal in public. Remediation is available by upgrading affected packages to version 0.1.3.
CVE-2018-3731 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2018-3731
To remediate this vulnerability, upgrade all affected Public dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install public@0.1.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls public
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2018-3731, inspect your project dependencies using npm:
npm ls public
Analyze the terminal output to locate any version of Public in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.1.3), your application is affected.
Note: The npm ls public command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Public, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2018-3731 Affected Public Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
public
|
npm |
< 0.1.3
|
0.1.3
|
References
Frequently Asked Questions
What is CVE-2018-3731?
Which Public versions are affected?
What version fixes CVE-2018-3731?
Is public affected?
What is the CVSS score of CVE-2018-3731?
What CWE is associated with CVE-2018-3731?
How can I check npm dependencies for CVE-2018-3731?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rwv8-jvff-jq28",
"modified" : "2023-01-31T01:37:12Z",
"published" : "2018-07-18T21:20:30Z",
"aliases" : [ "CVE-2018-3731" ],
"summary" : "Path Traversal in public",
"details" : "Versions of `public` before 0.1.3 are vulnerable to path traversal. This is due to lack of file path sanitization which could lead to any file the parent process has access to on the server to be read by malicious user.\n\n\n## Recommendation\n\nUpdate to version 0.1.3 or later.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "public"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.1.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.1.2"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-3731"
}, {
"type" : "WEB",
"url" : "https://github.com/tnantoka/public/commit/eae8ad8017b260f8667ded5e12801bd72b877af2"
}, {
"type" : "WEB",
"url" : "https://hackerone.com/reports/312918"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-rwv8-jvff-jq28"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/advisories/571"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T21:56:15Z",
"nvd_published_at" : "2018-06-07T02:29:00Z"
}
}