GitLab · Report #493324
Privilege escalation from any user (including external) to gitlab admin when admin impersonates you
Summary
My Telegram channel about being the full-time bug bounty hunter, my tips and tricks: 🇺🇸 BugBountyPLZen
Мой Telegram-канал про фуллтайм баг-хантинг, советы и методики: 🇷🇺 BugBountyPLZ
How it was found
Summary: Hey team, I have discovered a way for any logged in user (attacker) to escalate his privileges to gitlab administrator if the real gitlab administrator impersonates attacker's account.
Description:
When the gitlab admin impersonates some user, he gets new _gitlab_session cookie and then clicking at Stop impersonating he gets his own admin's cookie back. The vulnerability is that the impersonated user (attacker in our case) can see impersonated session at the Active sessions so he can switch to it (manually setting it in cookie) and click Stop impersonating by himself. This is a way how he can become gitlab administrator.
Steps To Reproduce:
- Sign into gitlab app as some user (
attacker) - Go to the active sessions settings tab and revoke all the sessions besides the current active one
- Sign into gitlab app in other browser as administrator (
admin) - Go to users admin section and impersonate
attackeruser - Update the active sessions tab as
attackerand make sure the second session appeared there (this is the admin logged into your account) {F420971} - Inspect the
Revokebutton and make sure you see the session ID there. Copy it. ████ - Go to index page of gitlab as
attacker(http://gitlab.bb/ in my case), I do not know why, but it is important step - Clear
attackerbrowser's cookie - Open the developer console as
attackerand manually set_gitlab_sessionto the copied one with:
document.cookie = "_gitlab_session=█████";
- Refresh the attacker's page and make sure you are now inside the impersonated session {F420978}
- Click
Stop impersonatingat the top-right corner asattackerand make sure you are now logged in as gitlab admin. ███
Impact
Every gitlab authenticated user can escalate his privileges to admin ones and give complete access to all gitlab services, projects and abilities. Only he needs to do is ask admin to impersonate his account because of something works bad there.