Privilege Escalation via Impersonation Features feature
The impersonation feature exposed the temporary session ID of the admin impersonating a user in the active sessions list. An attacker could replace their own session cookie with that ID, become the admin, and then stop impersonation to retain the admin's original session.
I’m going to share with you an interesting bug I found in one of Bugcrowd’s programs. It was in a program that had a “impersonating user” feature.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application exposed the impersonation session ID to the impersonated user and then trusted that ID to restore the admin's original session without further checks.
Impact
An attacker could escalate privileges to admin level and retain the admin's original session after impersonation ends.
What the attacker needed
A regular user account; an admin impersonates the attacker's account; attacker can inspect page source or intercept requests
How it was found
- Log in as a regular user.
- Revoke all sessions except the current one.
- Wait for an admin to impersonate the account.
- Inspect the revoke button or intercept the revoke request to obtain the session ID.
- Replace the current session cookie with the obtained session ID and refresh.
- Click 'Stop Impersonating' to restore the admin's original session.
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 write-up has not been written yet. The Original tab links to the source.
When an admin uses a 'login as' feature to see what a user sees, the system creates a temporary session. The bug is that this temporary session's ID was shown to the user being impersonated. By swapping their own session cookie for that ID, the user could take over the admin's session.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.