Skip to content
Open redirect Advisory Intermediate CVE-2020-12283

GHSL-2020-085: Open redirect vulnerability in Sourcegraph - CVE-2020-12283

The SafeRedirectURL function in Sourcegraph failed to properly validate redirect URLs, allowing an attacker to craft a URL that bypasses the check and redirects users to an arbitrary site. This could be exploited in the OAuth flow to steal a user's OAuth token.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

An open redirect vulnerability has been found on Sourcegraph due to improper validation in the SafeRedirectURL method, as a consequence an attacker could potentially redirect a victim to any arbitrary URL and access their OAUTH token.

pwntester, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

The SafeRedirectURL function only checked that the path started with a single slash, but did not account for paths starting with double slashes that could be interpreted as protocol-relative URLs by the browser.

Impact

An attacker could redirect a victim to an arbitrary URL, which in the context of Sourcegraph's OAuth flow may lead to token hijacks.

What the attacker needed

Victim clicks a crafted link; Sourcegraph OAuth flow in use

The fix

The vulnerability was fixed in Sourcegraph v3.14.4 and v3.15.1.

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.

An open redirect is a flaw where a website sends you to another site based on a link you click, without checking if that site is safe. Here, the check could be tricked by a specially formed link, so an attacker could send you to a fake login page and steal your login token for another service.

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 by Alvaro Muñoz

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

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.