Summary
Authorization Bypass through user-controlled key in url-parse. When no port number is provided in the “url”, url-parse is unable to find the correct hostname.
Product
NPM url-parse prior to 1.5.8.
Impact
This issue may lead to SSRF, Open Redirect or any other vulnerability which depends on the hostname field of the parsed url.
Steps to reproduce
var PAYLOAD = "http://example.com:";
// Expected hostname: example.com
// Actual hostname by url-parse: example.com:
console.log(Url(PAYLOAD));
Expected result:
slashes: true,
protocol: 'http:',
hash: '',
query: '',
pathname: '/',
auth: '',
host: 'example.com:',
port: '',
hostname: 'example.com:',
password: '',
username: '',
origin: 'http://example.com:',
href: 'http://example.com:/'
}Remediation
Update url-parse to version 1.5.8.
Credit
This issue was reported by @r0hansh through huntr.dev.