Skip to content
OAuth / SSO Disclosed report Intermediate

Oauth2 and Gitlab-Page problem

GitLab

Originally disclosed on GitLab

  • Fixed in 3 hours
  • Disclosed after 3 hours

HackerOne report #1035398 by ledz1996 on 2020-11-16, assigned to @dcouture:

Report | Attachments | How To Reproduce

Report

Summary

There is problem with the current existing Gitlab-Pages and Gitlab

  • Stealing Oauth2 Token from gitlab-pages

For the first problem, It is very simple to add a A record pointing your custom domain to your designated host. You just have to do the verification step to get it done.

Subsequent request to the following request will return an oauth2 token for the designated domain:
https://projects.gitlab.io/auth?domain=http://test123.testforgitlab.xyz&state=DePkz40iQTvpMnc_WvgsdA==

Steps to reproduce
  1. Create a Project and a .gitlab-ci.yml to use Gitlab-pages
###  This file is a template, and might need editing before it works on your project.  
###  Full project: https://gitlab.com/pages/plain-html  
pages:  
  stage: deploy  
  script:  
    - mkdir .public  
    - echo  "1234" > .public/hehe.html  
    - cp -r * .public  
    - mv .public public  
  artifacts:  
    paths:  
      - public  
  only:  
    - master

  1. Configure custom domain for pages and do the verification step but instead of adding CNAME to <user>.gitlab.io, you change it to your address with A Record. I used test123.testforgitlab.xyz as my customdomain
gitlab-2.png
gitlab-2.png From the original on GitLab
gitlab-3.png
gitlab-3.png
  1. Login as another user and navigate to the following URL

https://projects.gitlab.io/auth?domain=http://test123.testforgitlab.xyz&amp;state=DePkz40iQTvpMnc_WvgsdA==

  1. Without user's consent, later on a request sent to http://test123.testforgitlab.xyz with Oauth2 Code, this code is exactly the same as the code for authorizing Gitlab-Pages as seen in Burp. This is the main issue.
gitlab4.png
gitlab4.png From the original on GitLab

Mitigations

For the first problem, I think you should separate the token for Oauth2 Gitlab and Oauth2 Gitlab-pages. For example, the Oauth2 generated for the project.gitlab.io should be different to user's gitlab-pages.

Impact

Leakage of tokens, Misleading authorization message.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

How To Reproduce

Please add reproducibility information to this section:

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.

What is known

A high-severity OAuth / SSO bug in gitlab.com. GitLab made it public on 19 November 2020.

About 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.

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

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.