CVE-2022-0639: url-parse Incorrectly parses URLs that include an '@'
6.5
CVSS Score
3.0
Basic Information
CVE ID
GHSA ID
EPSS Score
0.04754%
CWE
Published
2/18/2022
Updated
9/11/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
url-parse | npm | < 1.5.7 | 1.5.7 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from how url-parse's toString() function constructs the href property. The GitHub patch adds logic to preserve '@' in URLs with empty auth when specific conditions are met (non-file protocol, special protocol, empty host, and non-root pathname). The pre-patch version omitted the '@' in these cases, leading to href values like 'http:///127.0.0.1' instead of 'http://@/127.0.0.1'. This discrepancy allowed attackers to bypass security checks using hostname/origin (which would be empty) while requests would target the pathname-as-host via the malformed href.