CVE-2021-27516: URIjs Hostname spoofing via backslashes in URL
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.67029%
CWE
Published
3/1/2021
Updated
12/8/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 |
---|---|---|---|
urijs | npm | < 1.19.6 | 1.19.6 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper input validation when handling backslashes in the scheme delimiter. The commit diff shows the fix modified the protocol check to replace backslashes with forward slashes in the substring comparison (string.substring(pos + 1, pos + 3).replace(/\\/g, '/') === '//
). This indicates the original implementation in URI.parse()
lacked this normalization, making it vulnerable to hostname spoofing via malformed scheme delimiters. The test case added in test/urls.js
explicitly validates this scenario, confirming the function
's role in the vulnerability.