Skip to content
Open redirect Disclosed report Intermediate CVE-2022-1233

URL Confusion When Scheme Not Supplied in medialize/uri.js

URI.js parses a URL without a scheme and with excessive slashes (like ///www.example.com) differently from browsers, treating the hostname as null and the path as /www.example.com. An attacker could use this to cause a redirect to an unintended host, as shown by the example that redirects to http://www.example.com.

medialize/URI.js

Originally disclosed on huntr

Medialize is a Javascript URL mutation library. When parsing a URL without a scheme and with excessive slashes, like ///www.example.com, URI.js will parse the hostname as null and the path as /www.example.com. Such behaviour is different from that exhibited by browsers, which will parse ///www.example.com as http://www.example.com instead. For example, the following will cause a redirect to http://www.example.com: A fix was released in version 1.19.11.

From the GitHub Advisory Database (GHSA-g694-m8vq-gv9h, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the library's URL parser does not follow the same rules as browsers for handling URLs without a scheme and with excessive slashes, leading to a different interpretation of the host and path.

Impact

An attacker could cause a redirect to an unintended host, as demonstrated by the example redirecting to http://www.example.com.

What the attacker needed

Use of URI.js for URL parsing; attacker-supplied URL without scheme

The fix

The issue was fixed in version 1.19.11.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A URL normally has a scheme (like http) and a host (like example.com). When you write a URL without a scheme but with extra slashes, browsers assume the scheme is http and treat the first part as the host. URI.js instead treats the whole thing as a path, so it thinks the host is empty. This difference can make a program redirect to a different site than intended.

What is Open redirect?

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.

More from medialize/URI.js

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.