Skip to content
OAuth / SSO Disclosed report Intermediate

Oauth Web Application Flow vulnerability

GitLab's OAuth2 web flow issued authorization codes to users with unverified email addresses, letting an attacker register with a fake email; this could let them impersonate the email owner on third-party apps trusting GitLab.

GitLab

Originally disclosed on GitLab

Critical View original
  • Fixed in 6 months
  • Disclosed after 6 months

HackerOne report #743556 by peet86 on 2019-11-21, assigned to @jeremymatos:

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

Authentication via Oauth2 Web application flow grants authorization code for non(email)verified users.
Gitlab doesn't care about the user's verification state, authorizes Oauth requests without checking the authenticity of the user's primary identifier (email).

  • One can enter a non existing email address while sign up on Gitlab.com. (correct)
  • At this point the user has a Gitlab account logged in on gitlab.com. The gitlab user is not yet (email) verified though. (correct)
  • When the user requests Oauth authorization from a web application Gitlab authorizes it and claims the user is real. (vulnerability)
  • After the redirect the Web application the user receives the authorization code without any warning, status. (vulnerability)

Steps to reproduce

  1. Start an Oauth Web Application Flow in an incognito window (no active gitlab sessions) from a previously registered oauth application.
  2. Register a new Gitlab account with a non existing / fake email https://gitlab.com/users/sign_in
  3. Gitlab authorizes the Oauth authorization request and returns with the authorization code.

Impact

  1. Gitlab Oauth authorizes non verified. possibly fake users with (possibly fake) email addresses.

Eg. [email protected], [email protected]

  1. Gitlab claims [email protected] or [email protected] are valid users and returns with the email addresses when scope=read_user+profile requested from a web app. (after the succesful authorization).

  2. Gitlab as Oauth Provider compromises millions of web applications around the world. The vulnerability affects all Oauth clients which are trusting Gitlab as a social authentication provider. Many of these web applications expecting that Gitlab authorization fails with non-verified users and does not allow api access for user with possibly fake unique identifiers (email addresses).

Examples

Not project related. Please just follow the steps above.

What is the current bug behavior?

Oauth authorization SUCCESS.

What is the expected correct behavior?

When a primary email address for a user account has not been verified, Oauth authorization should FAIL.

Similar Oauth flow on Github.com and many other Oauth providers fail. With those providers it's not possible to use not yet verified accounts for Oauth flows.

Relevant logs and/or screenshots

    • F640441
  1. After click on Authorize the Oauth client app receives authorization code as query string.

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

This bug happens on GitLab.com

Impact

Please read Impact section in the description.

Also please note while this is not necessarily a security leak for Gitlab, many different type of account hijacking is possible in other Oauth dependent web applications which are trusting Gitlab as an Oauth Provider. Eg:

  • The attacker registered with [email protected] on gitlab.com could hijack a user account which belongs to the real owner of [email protected] in a web application where social accounts are connected with (verified)email + password accounts.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

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 OAuth authorization flow did not check whether the user's primary email address had been verified before issuing an authorization code.

Impact

An attacker could use a fake email to obtain OAuth authorization from GitLab and potentially hijack accounts on third-party applications that trust GitLab as an identity provider and link social accounts by email.

What the attacker needed

A GitLab account with an unverified email; a third-party app trusting GitLab OAuth

The fix

GitLab should reject OAuth authorization requests when the user's primary email address has not been verified.

How it was found

  1. Start an OAuth web application flow in an incognito window from a registered OAuth application.
  2. Register a new GitLab account using a non-existent or fake email address.
  3. GitLab authorizes the OAuth request and returns an authorization code.

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 websites to let you log in using another service, like GitLab. When you do, GitLab tells the website who you are, including your email. This report says GitLab would do that even if you never proved you owned the email address you signed up with. So someone could pretend to be [redacted] without access to that mailbox, and other sites might trust that.

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.