Skip to content
OAuth / SSO Disclosed report Intermediate

Lot of custom installations suffer from oauth2 covert redirect

Several public GitLab instances had OAuth2 integrations configured with overly permissive redirect URIs, enabling a covert redirect. An attacker could combine this with a stored XSS to take over accounts of users who logged in via GitHub.

GitLab

Originally disclosed on GitLab

  • Fixed in 9 months
  • Disclosed after 9 months

HackerOne report #891085 by rpadovani on 2020-06-04, assigned to @dcouture:

Summary

Not an issue, but a place of improvement for Gitlab

Taking a look to public custom installations of Gitlab, I found 3 installations out of 5 I checked that suffer from OAuth2 Covert redirect. Paired with any XSS vulnerability, it allows an account takeover of users who used Github to access the instance.

The five instances:

I know that it is already documented over the Gitlab documentation to use the proper callback url, but clearly is not enough. Of course, you shouldn't create statistics from such a few checks, but the situation is worrisome nonetheless: a small misconfiguration and your custom instance can suffer from accounts takeover.

There are a few things that Gitlab can do to improve, IMO, and probably more can come in mind to your engineers.

  • Create a check in the admin panel: after GitHub as been added as login method, the admins of the instance have an alert about a having to check if the integration has been properly setup. When they click over it, it will try to login with a callback to a non-valid url that works as sentinel: if the sentinel is hit, then a big critical warning is shown to fix the OAuth integration
  • Since Gitlab receives telemetric from custom installation, it knows which Gitlab instances have a Github OAuth, I imagine: therefore you can have a bot that does the check for you, and you can then message the administrators.

I strongly suggest to do not leave the situation as it is, because there is clearly some problem. At least, shown a warning to admin to double check their installation.

Impact

Given any stored XSS on any page over the custom installation, it allows an account takeover of users who used Github to access the instance

Impact

Given any stored XSS on any page over the custom installation, it allows an account takeover of users who used Github to access the instance

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

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 OAuth2 callback URL was not restricted to the exact instance domain, allowing redirects to arbitrary URLs.

Impact

If a stored XSS exists on the same instance, an attacker could take over accounts of users who logged in with GitHub; otherwise the misconfiguration alone may not be directly exploitable.

What the attacker needed

Custom GitLab instance with GitHub OAuth; misconfigured callback URL; a stored XSS on the instance

The fix

GitLab should add an admin panel check that tests the OAuth callback with a sentinel URL and warns administrators, or use telemetry to detect and notify affected instances.

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.

OAuth2 is a way to log in using another service, like GitHub. A covert redirect happens when the login flow can be tricked into sending the user's secret login code to an attacker's site. Here, some GitLab installations were set up so loosely that an attacker could steal that code, and if they also found a way to run their own script on the site, they could take over the victim's account.

What is OAuth / SSO?

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.