Miggo Logo

CVE-2021-27516: URIjs Hostname spoofing via backslashes in URL

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.67029%
Published
3/1/2021
Updated
12/8/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
urijsnpm< 1.19.61.19.6

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Imp**t I* usin* *****t** v*rsions to **t*rmin* * URL's *ostn*m*, t** *ostn*m* **n ** spoo*** *y usin* * ***ksl*s* (`\`) ***r**t*r *s p*rt o* t** s***m* **limit*r, *.*. `s***m*:/\*ostn*m*`. I* t** *ostn*m* is us** in s**urity ***isions, t** ***isi

Reasoning

T** vuln*r**ility st*ms *rom improp*r input v*li**tion w**n **n*lin* ***ksl*s**s in t** s***m* **limit*r. T** *ommit *i** s*ows t** *ix mo*i*i** t** proto*ol ****k to r*pl*** ***ksl*s**s wit* *orw*r* sl*s**s in t** su*strin* *omp*rison (`strin*.su*st