ESCALATED: Lack Of State Parameter On Github Import Project Oauth
The GitHub import flow on GitLab did not use a state parameter in its OAuth callback, so an attacker could take their own authorisation callback link and send it to a victim. When the victim opened it, the attacker's GitHub account became linked to the victim's import function, and the report says there was no way to disconnect it.
GitLab
Originally disclosed on GitLab
- Fixed in 2.6 years
- Disclosed after 2.6 years
HackerOne report #605576 by aryan2808 on 2019-06-10, assigned to jmatos_bgtvf:
Hi Gitlab Security Team,
Summary :
Gitlab Allow Users To Import Projects From Various Company Like Github , Importing Project From Github To Gitlab Suffers From Lack Of State Parameter Which Allows Attacker To Connect His Github To Victim Gitlab Import Project Function Moreover Interesting Thing Is There Is No Option to Disconnect Github Account On This Function.
Steps To Reproduce :
- Attacker Navigate To Create Project > Import Project > Github
URL : https://gitlab.com/import/github/new
-
Attacker Authorize His Github Account Via List Your Github Function.
-
As There Is No State Parameter On Request Attacker Capture The Request And Pass That Request To Victim.
-
Upon Opening Link Attacker Github Connect To Import Function For Forever , There Is No Option to Disconnect Github Account On This Function.
HTTP Request :
GET /users/auth/-/import/github/callback?code=2d162be301039cd44cf4 HTTP/1.1
Host: gitlab.com
Connection: close
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3
Referer: https://github.com/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie:
Mitigation :
Implement The State Parameter.
Thanks,
Aryan.
Impact
Attacker Could Connect His Github Account To Import Function For Forever
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 callback for the GitHub import flow did not include or verify a state parameter, so it accepted a callback that was not tied to the victim's own session.
Impact
The attacker's GitHub account could be connected to the victim's import function permanently, and the report states there is no option to disconnect it.
What the attacker needed
Attacker has a GitHub account; victim opens the crafted callback link
The fix
The state parameter should be implemented so the callback is tied to the user's own session.
How it was found
- The attacker goes to the GitHub import page under Create Project.
- The attacker authorises their own GitHub account through the import flow.
- The attacker captures the callback request, which has no state parameter, and sends it to the victim.
- The victim opens the link and the attacker's GitHub account becomes connected to the import function, with no option to disconnect it.
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 let a site connect to another service like GitHub, the site should add a random one-time code to the login link so it can tell that the person finishing the connection is the same person who started it. Here that check was missing, so an attacker could start the connection with their own GitHub account and hand the finishing link to someone else. The victim's GitLab account then ended up linked to the attacker's GitHub account.
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.