Miggo Logo

CVE-2022-25839: Improper Input Validation in url-js

5.3

CVSS Score
3.1

Basic Information

EPSS Score
0.41805%
Published
3/12/2022
Updated
1/27/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
url-jsnpm< 2.1.02.1.0

Vulnerability Intelligence
Miggo AIMiggo AI

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

Vulnerable functions

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

WAF Protection Rules

WAF Rule

T** p**k*** url-js ***or* *.*.* is vuln*r**l* to Improp*r Input V*li**tion *u* to improp*r p*rsin*, w*i** m*k*s it is possi*l* *or t** *ostn*m* to ** spoo***. *ttp://\\\\\\\\lo**l*ost *n* *ttp://lo**l*ost *r* t** s*m* URL. *ow*v*r, t** *ostn*m* is no

Reasoning

T** vuln*r**ility st*ms *rom improp*r input v*li**tion in URL p*rsin*. T** *ommit *i** s*ows *riti**l ***n**s to t** _p*rs*_url_*xp r**ul*r *xpr*ssion in p*rs*Url.js, w**r* *ost p*tt*rn m*t**in* w*s mo*i*i** to ***ount *or ***ksl*s**s. T** ori*in*l r