Gitlab Open Redirect Vulnerability
The GitLab OAuth authorisation endpoint accepted an arbitrary redirect_uri and the callback then redirected the user to that external site. An attacker could use this to send users to a phishing page that appears to come from GitLab.
GitLab
Originally disclosed on GitLab
- Fixed in 5 months
- Disclosed after 5 months
HackerOne report #1711497 by burpheart on 2022-09-25, assigned to @dcouture:
Report | How To Reproduce
Report
Summary
An open redirection vulnerability in gltab oauth.
Steps to reproduce
(No browser rendering required. Requests can be initiated invisibly using html img tags.)
2. visit https://gitlab.com/login/oauth/callback and Redirected to https://hackerone.com/?code
Or something like this for one click. The link could be a redirection.
{{media:0}}
<a href="https://gitlab.com/login/oauth/callback">click here</a>
Impact
By modifying untrusted URL input to a malicious site, an attacker may successfully launch a phishing scam and steal user credentials.
Examples
- visit https://gitlab.com/login/oauth/authorize?redirect_uri=https://hackerone.com/
- visit https://gitlab.com/login/oauth/callback and Redirected to https://hackerone.com/?code
What is the current bug behavior?
Visit oauth callback Redirected to https://hackerone.com/?code
What is the expected correct behavior?
Callback URLs that pass the check are redirected.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab 15.4.0-ee and GitLab.com
Results of GitLab environment info
System information
System:
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.7.5p203
Gem Version: 3.1.6
Bundler Version:2.3.15
Rake Version: 13.0.6
Redis Version: 6.2.7
Sidekiq Version:6.4.2
Go Version: unknown
GitLab information
Version: 15.4.0-ee
Revision: abbda55531f
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 13.6
URL: http://gitlab.example.com
HTTP Clone URL: http://gitlab.example.com/some-group/some-project.git
SSH Clone URL: [email protected]:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 14.10.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Impact
An http parameter may contain a URL value and could cause the web application to redirect the request to the specified URL. By modifying the URL value to a malicious site, an attacker may successfully launch a phishing scam and steal user credentials. Because the server name in the modified link is identical to the original site, phishing attempts have a more trustworthy appearance.
How To Reproduce
Please add reproducibility information to this section:
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 authorisation endpoint did not validate the redirect_uri against an allowlist before the callback used it.
Impact
An attacker could launch a phishing scam and steal user credentials, and the link looks trustworthy because the server name is the original site.
What the attacker needed
Victim clicks a crafted link
How it was found
- Visit the OAuth authorise URL with an external redirect_uri.
- Visit the OAuth callback URL.
- Observe the browser being redirected to the external site with a code parameter.
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 when a website takes a link parameter and sends you to whatever address is in it, even one outside the site. Here GitLab's login flow did that, so a crafted link could bounce a user to a fake page after they trusted the GitLab address.
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.