Skip to content

url-parse Incorrectly parses URLs that include an '@'

Moderate severity GitHub Reviewed Published Feb 18, 2022 to the GitHub Advisory Database • Updated Sep 11, 2023

Package

npm url-parse (npm)

Affected versions

< 1.5.7

Patched versions

1.5.7

Description

A specially crafted URL with an '@' sign but empty user info and no hostname, when parsed with url-parse, url-parse will return the incorrect href. In particular,

parse(\"http://@/127.0.0.1\")

Will return:

{
 slashes: true,
 protocol: 'http:',
 hash: '',
 query: '',
 pathname: '/127.0.0.1',
 auth: '',
 host: '',
 port: '',
 hostname: '',
 password: '',
 username: '',
 origin: 'null',
 href: 'http:///127.0.0.1'
 }

If the 'hostname' or 'origin' attributes of the output from url-parse are used in security decisions and the final 'href' attribute of the output is then used to make a request, the decision may be incorrect.

References

Published by the National Vulnerability Database Feb 17, 2022
Published to the GitHub Advisory Database Feb 18, 2022
Reviewed Feb 22, 2022
Last updated Sep 11, 2023

Severity

Moderate
6.5
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N

Weaknesses

CVE ID

CVE-2022-0639

GHSA ID

GHSA-8v38-pw62-9cw2

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.