{"id":"CVE-2022-0691","aliases":["GHSA-jf5r-8hm2-f872"],"url":"https://o3.security/vulnerability/CVE-2022-0691","summary":"Authorization Bypass Through User-Controlled Key in unshiftio/url-parse","details":"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.\n\nIf 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.\n\nThis 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:\n```js\nconst parse = require('url-parse')\nconst express = require('express')\nconst app = express()\nconst port = 3000\n\nurl = parse(\\\"\\\\bjavascript:alert(1)\\\")\n\nconsole.log(url)\n\napp.get('/', (req, res) => {\n if (url.protocol !== \\\"javascript:\\\") {res.send(\\\"<a href=\\\\'\\\" + url.href + \\\"\\\\'>CLICK ME!</a>\\\")}\n })\n\napp.listen(port, () => {\n console.log(`Example app listening on port ${port}`)\n })\n```","published":"2022-02-21T00:00:00Z","modified":"2026-10-28T02:30:40.353371365Z","cvss":{"score":6.5,"severity":"MEDIUM","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"},"epss":{"score":0.0222,"percentile":0.83131,"asOf":"2026-11-23"},"cisaKev":null,"exploitsKnown":1,"affectedPackages":[{"ecosystem":"npm","name":"url-parse","fixedVersion":"1.5.9"}],"fix":{"url":"https://github.com/unshiftio/url-parse/commit/0e3fb542d60ddbf6933f22eb9b1e06e25eaa5b63","label":"unshiftio/url-parse@0e3fb54"},"references":[{"type":"WEB","url":"https://huntr.dev/bounties/57124ed5-4b68-4934-8325-2c546257f2e4"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/0xxx/CVE-2022-0691.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-0691"},{"type":"ADVISORY","url":"https://security.netapp.com/advisory/ntap-20220325-0006/"},{"type":"FIX","url":"https://github.com/unshiftio/url-parse/commit/0e3fb542d60ddbf6933f22eb9b1e06e25eaa5b63"},{"type":"ARTICLE","url":"https://lists.debian.org/debian-lts-announce/2023/02/msg00030.html"},{"type":"WEB","url":"https://github.com/github/advisory-database/pull/6765"},{"type":"PACKAGE","url":"https://github.com/unshiftio/url-parse"},{"type":"WEB","url":"https://security.netapp.com/advisory/ntap-20220325-0006"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-10-28T02:30:40.353371365Z"}}