CVE-2022-0639: Authorization Bypass Through User-Controlled Key in unshiftio/url-parse
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,
js parse(\"http://@/127.0.0.1\") Will return: yaml { 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.
Other sources
An authorization bypass flaw was found in url-parse. This flaw allows a local unauthenticated attacker to add an at symbol (@) while submitting a URL. This issue enables the bypass of validation or block-listing restrictions.
Authorization Bypass Through User-Controlled Key in NPM url-parse prior to 1.5.7.
unshift.io url-parse module for NPM could allow a remote attacker to bypass security restrictions, caused by incorrect conversion of @ in protocol in the href. By sending a specially-crafted request, an attacker could exploit this vulnerability to bypass hostname validation.
— IBM
Affected Software
Remediation
Event History
Frequently Asked Questions
What is CVE-2022-0639?
CVE-2022-0639 is a vulnerability that allows for authorization bypass through a user-controlled key in NPM url-parse prior to version 1.5.7.
What is the severity of CVE-2022-0639?
The severity of CVE-2022-0639 is medium with a CVSS score of 6.5.
How does CVE-2022-0639 work?
CVE-2022-0639 is triggered by a specially crafted URL with an '@' sign but empty user info and no hostname, causing url-parse to return an incorrect href.
Which software is affected by CVE-2022-0639?
NPM url-parse versions prior to 1.5.7 and the Url-parse Project url-parse are affected by CVE-2022-0639.
How can CVE-2022-0639 be fixed?
To fix CVE-2022-0639, update NPM url-parse to version 1.5.7 or higher.