Skip to content
OAuth / SSO Disclosed report Intermediate

Oauth2 authentication flow doesn't enforce HTTPS redirect URL

The OAuth2 authorisation flow on GitLab.com allowed third-party applications to register a non-HTTPS redirect URI. An attacker who can observe network traffic could capture the authorisation code (or tokens in the implicit flow) and impersonate the user.

GitLab

Originally disclosed on GitLab

  • Fixed in 2 months
  • Disclosed after 2 months

HackerOne report #1000099 by xgbi on 2020-10-06, assigned to @ankelly:

Report | Attachments

Report

> NOTE! Thanks for submitting a report! Please replace all the (parenthesized) sections below with the pertinent details. Remember, the more detail you provide, the easier it is for us to triage and respond quickly, so be sure to take your time filling out the report!

Summary

The Oauth login that allows 3rd party apps to access the Gitlab API allows for non-HTTPS return URLs, exposing the authorization code, and possibly the authorization tokens if the Oauth2 flow is implicit.

Steps to reproduce

(Step-by-step guide to reproduce the issue, including:)

I encountered this on Shuttleops.io, they have an HTTP redirect_uri:

1/ Go to https://app.shuttleops.io/signin
2/ Click on the gitlab icon, it redirects you to https://gitlab.com/oauth/authorize?client_id=03cf4a803ac636e5b443ebd78291dc7ea35d1196d23d94323e9f2901997c3f01&redirect_uri=http://app.shuttleops.io/login/oauth2/code/gitlab&response_type=code&scope=api&state=xxx%3D

3/ If you click authorize, you are redirected to an HTTP page with the authorization_code passed in plain text over the internet.

This is very sensitive information, and if you allow implicit authentication flow, then the actual authentication tokens are passed in clear text.

Impact

If you click authorize, you are redirected to an HTTP page with the authorization_code passed in plain text over the internet.

This is very sensitive information, and if you allow implicit authentication flow, then the actual authentication tokens are passed in clear text.

Since any app can select broad requirements, anybody sniffing the network at that time can catch the auth token and impersonate the user on Gitlab with the authorizations of the app.

Examples

See the HAR attached. I have since revoked the authorizations of the App.

What is the current bug behavior?

You should NOT be able to specify a non-HTTPS redirect_url in Oauth2 authorize request.

What is the expected correct behavior?

You should see an error if you reach the authorize page without an HTTPS scheme in the redirect uri.

Relevant logs and/or screenshots

See Oauth Threat Model RFC: https://tools.ietf.org/html/rfc6819#page-27 where it is said that you should validate redirect_uri to make sure that secure return channel is used

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Impact

An attacker could impersonate anybody accepting a third party application, and benefit the 3rd party application authorizations (the scopes).

This could be very broad since Gitlab allows 3rd party apps to have R/W access on the API

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 authorisation server did not validate that the redirect_uri used HTTPS, allowing insecure return channels.

Impact

An attacker who can sniff network traffic could capture the authorisation code or tokens and impersonate the user, gaining the permissions granted to the third-party app.

What the attacker needed

Victim uses a third-party app with HTTP redirect; attacker can sniff network traffic

The fix

The OAuth2 authorisation server should reject redirect URIs that do not use HTTPS.

How it was found

  1. Go to the third-party application's sign-in page.
  2. Click the GitLab icon to start the OAuth flow.
  3. Observe that the authorisation request includes an HTTP redirect_uri.
  4. Click authorise and note that the authorisation code is sent over HTTP.

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.

OAuth is a way for you to let a third-party app access your account without giving it your password. When you approve the app, GitLab sends a special code back to the app's website. If that website uses plain HTTP instead of secure HTTPS, anyone on the same network can see that code and use it to act as you.

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.