CVE-2021-27515: Url parse Path Traversal Vulnerability
MODERATECVE-2021-27515 is a MODERATE (CVSS 5.3) path traversal vulnerability (CWE-23: Relative Path Traversal) affecting Url parse libraries in the npm ecosystem. The issue involves path traversal in url-parse. Remediation is available by upgrading affected packages to version 1.5.0.
CVE-2021-27515 at a Glance
Security Impact
CVSS: 5.3
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:N/I:L/A:N).
How to Fix CVE-2021-27515
To remediate this vulnerability, upgrade all affected Url parse 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 url-parse@1.5.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls url-parse
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-27515, inspect your project dependencies using npm:
npm ls url-parse
Analyze the terminal output to locate any version of Url parse in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.0), your application is affected.
Note: The npm ls url-parse 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-23: Relative Path Traversal, where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory. In Url parse, 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-2021-27515 Affected Url parse Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
url-parse
|
npm |
≥ 0.1.0
< 1.5.0
|
1.5.0
|
References
Frequently Asked Questions
What is CVE-2021-27515?
Which Url parse versions are affected?
What version fixes CVE-2021-27515?
Is url-parse affected?
What is the CVSS score of CVE-2021-27515?
What CWE is associated with CVE-2021-27515?
How can I check npm dependencies for CVE-2021-27515?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9m6j-fcg5-2442",
"modified" : "2026-02-03T22:11:36Z",
"published" : "2021-05-06T16:10:51Z",
"aliases" : [ "CVE-2021-27515" ],
"summary" : "Path traversal in url-parse",
"details" : "url-parse before 1.5.0 mishandles certain uses of backslash such as http:\\/ and interprets the URI as a relative path.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "url-parse"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.1.0"
}, {
"fixed" : "1.5.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-27515"
}, {
"type" : "WEB",
"url" : "https://github.com/github/advisory-database/pull/6763"
}, {
"type" : "WEB",
"url" : "https://github.com/unshiftio/url-parse/pull/197"
}, {
"type" : "WEB",
"url" : "https://github.com/unshiftio/url-parse/commit/d1e7e8822f26e8a49794b757123b51386325b2b0"
}, {
"type" : "WEB",
"url" : "https://advisory.checkmarx.net/advisory/CX-2021-4306"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/unshiftio/url-parse"
}, {
"type" : "WEB",
"url" : "https://github.com/unshiftio/url-parse/compare/1.4.7...1.5.0"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2023/02/msg00030.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-23" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-03-22T21:04:52Z",
"nvd_published_at" : "2021-02-22T00:15:00Z"
}
}