CVE-2022-25839: Improper Input Validation in url-js
5.3
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.41805%
CWE
Published
3/12/2022
Updated
1/27/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
url-js | npm | < 2.1.0 | 2.1.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper input validation in URL parsing. The commit diff shows critical changes to the _parse_url_exp regular expression in parseUrl.js, where host pattern matching was modified to account for backslashes. The original regex didn't properly exclude backslashes from hostname parsing, allowing them to persist in the parsed result. The vulnerable version would parse '\localhost' as the hostname instead of normalizing it to 'localhost', enabling spoofing attacks. The patch added backslash handling in both host and pathname components, confirming the vulnerability resides in the parseUrl function's parsing logic.