CVE-2022-0691: Authorization Bypass Through User-Controlled Key in unshiftio/url-parse
An authorization bypass flaw was found in url-parse. This flaw allows a local unauthenticated attacker to add a backspace character (\b) while submitting a URL. This vulnerability can enable bypassing any hostname checks.
Other sources
Authorization Bypass Through User-Controlled Key in NPM url-parse prior to 1.5.9.
Leading control characters in a URL are not stripped when passed into url-parse. This can cause input URLs to be mistakenly be interpreted as a relative URL without a hostname and protocol, while the WHATWG URL parser will trim control characters and treat it as an absolute URL.
If url-parse is used in security decisions involving the hostname / protocol, and the input URL is used in a client which uses the WHATWG URL parser, the decision may be incorrect.
This can also lead to a cross-site scripting (XSS) vulnerability if url-parse is used to check for the javascript: protocol in URLs. See following example: js const parse = require('url-parse') const express = require('express') const app = express() const port = 3000
url = parse(\"\\bjavascript:alert(1)\")
console.log(url)
app.get('/', (req, res) => { if (url.protocol !== \"javascript:\") {res.send(\"<a href=\\'\" + url.href + \"\\'>CLICK ME!</a>\")} })
app.listen(port, () => { console.log(Example app listening on port ${port}) })
unshift.io url-parse module for NPM could allow a remote attacker to bypass security restrictions, caused by improper validation of \b (backspace) character. By sending a specially-crafted request, an attacker could exploit this vulnerability to bypass hostname validation and leads to false positive in the extractProtocol() function.
— IBM
Affected Software
Remediation
Event History
Frequently Asked Questions
What is CVE-2022-0691?
CVE-2022-0691 is a vulnerability that allows authorization bypass through user-controlled key in NPM url-parse prior to version 1.5.9.
What is the severity of CVE-2022-0691?
CVE-2022-0691 has a severity rating of critical with a CVSS score of 9.8.
What software is affected by CVE-2022-0691?
The npm package 'url-parse' versions prior to 1.5.9, as well as the Red Hat package 'url-parse' versions prior to 1.5.9, and the Url-parse Project Url-parse with versions up to 1.5.9.
How can CVE-2022-0691 be exploited?
An attacker can bypass authorization by manipulating the URL and causing it to be interpreted as a relative URL without a hostname and protocol.
How can I fix CVE-2022-0691?
Update the affected 'url-parse' packages to version 1.5.9 or higher.