Skip to content
Access control Disclosed report Intermediate

Privilege escalation from any user (including external) to gitlab admin when admin impersonates you

When an administrator impersonated a user, that user could see the impersonation session in their own active sessions list and switch to it. By then pressing the stop-impersonating control, the user ended up holding the administrator's session and became an admin.

skavans Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 47 hours
  • Fixed in 30 days
  • Paid in 30 days
  • Disclosed after 19 months
## Summary by the researcher

My Telegram channel about being the full-time bug bounty hunter, my tips and tricks:
🇺🇸 [BugBountyPLZen](https://t.me/+mY0ndZYzGbYxYmYy)

Мой Telegram-канал про фуллтайм баг-�
антинг, советы и методики:
🇷🇺 [BugBountyPLZ](https://t.me/+WYgyG5n2_kM1Yzdi)

## The report

**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:

1. Sign into gitlab app as some user (`attacker`)
1. Go to the active sessions settings tab and revoke all the sessions besides the current active one
1. Sign into gitlab app in other browser as administrator (`admin`)
1. Go to users admin section and impersonate `attacker` user
1. Update the active sessions tab as `attacker` and make sure the second session appeared there (this is the admin logged into your account)

{{media:0}}

1. Inspect the `Revoke` button and make sure you see the session ID there. Copy it.

████
1. Go to index page of gitlab as `attacker` (http://gitlab.bb/ in my case), I do not know why, but it is important step
1. Clear `attacker` browser's cookie
1. Open the developer console as `attacker` and manually set `_gitlab_session` to the copied one with:

```javascript
document.cookie = "_gitlab_session=█████";
```

9. Refresh the attacker's page and make sure you are now inside the impersonated session

{{media:1}}

10. Click `Stop impersonating` at the top-right corner as `attacker` and 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.

The original report as published on HackerOne, by skavans. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 impersonation session was listed in the impersonated user's own active sessions and the stop-impersonating action restored the admin session to whoever held that session cookie, without checking who was ending it.

Impact

Any authenticated user could escalate to administrator and gain complete access to all projects and services, but only if an administrator impersonates their account.

What the attacker needed

An account on the instance; admin impersonates the attacker's account; attacker can read their own session list

How it was found

  1. Sign in as the ordinary user and revoke all other sessions except the current one.
  2. Sign in as administrator in a different browser and impersonate the ordinary user.
  3. As the ordinary user, refresh the active sessions tab and note the new session that appeared.
  4. Inspect the revoke control to read the session identifier and copy it.
  5. Visit the site index, clear cookies, then set the session cookie to the copied value and refresh.
  6. Press the stop-impersonating control and observe that you are now the administrator.

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.

Impersonation is a feature where an administrator can temporarily act as another user to help them. The site keeps a separate session for that, and normally only the admin should be able to end it. Here the ordinary user could grab that session and end the impersonation themselves, which handed them the admin's logged-in state.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by skavans

View all

8 more disclosed reports, best first.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.