Lack Of State Parameter On Bitbucket Import Project Oauth
The Bitbucket import OAuth flow lacked a state parameter, so an attacker could trick a victim into linking the attacker's Bitbucket account to the victim's GitLab import function. This connection persisted with no option to disconnect.
GitLab
Originally disclosed on GitLab
- Fixed in 2 months
- Disclosed after 2 months
HackerOne report #1447984 by aryan2808 on 2022-01-12, assigned to GitLab Team:
Report | Attachments | How To Reproduce
Report
Hi Gitlab Team,
Summary :
Gitlab Allow Users To Import Projects From Various Git sites , Importing Project From Bitbucket To Gitlab Suffers From Lack Of State Parameter Which Allows Attacker To Connect His Bitbucket To Victim Gitlab Import Project Function Moreover Interesting Thing Is There Is No Option to Disconnect Bitbucket Account On Import Function.
Steps To Reproduce :
-
Attacker Navigate To Create Project > Import Project > Bitbucket
-
Attacker Authorize His Bitbucket Account
-
As There Is No State Parameter On Request(Connected in http request section) Attacker Capture The Request And Pass That Request To Victim.
-
Upon Opening Link Attacker Bitbucket Connect to Victim Import Function For Forever , There Is No Option to Disconnect Bitbucket Account On This Function.
HTTP Request :
[redacted]
P.S : Previously submitted same report(#605576) for github oauth thinking root cause are same hence fixing github oauth will also fix other oauth application but that doesn't seem to case.
Mitigation :
Implement The State Parameter.
Thanks,
Aryan Rupala.
Impact
Attacker Could Connect His Bitbucket Account To Import Function For Forever
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
[redacted]
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
The OAuth authorisation request for the Bitbucket import did not include a state parameter, so the callback could be forged.
Impact
An attacker could permanently connect their Bitbucket account to a victim's GitLab import function, with no option to disconnect.
What the attacker needed
Victim clicks a crafted link; attacker has a Bitbucket account
The fix
The state parameter should be implemented in the OAuth flow.
How it was found
- The attacker goes to Create Project > Import Project > Bitbucket.
- The attacker authorises their own Bitbucket account.
- The attacker captures the OAuth request and sends it to the victim.
- When the victim opens the link, the attacker's Bitbucket account is connected to the victim's import function permanently.
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.
When you connect two accounts, the website should use a random code (called a state parameter) to make sure the connection request really came from you. Without it, an attacker can give you a prepared link that secretly links their account to yours. Here, that meant the attacker's Bitbucket account stayed connected to the victim's GitLab import, and there was no way to remove it.
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.