Skip to content
Access control Write-up Beginner

Improper Session Invalidations: When Admin Privileges Linger

A platform did not invalidate active sessions when an admin's role was downgraded or the account was deleted, so the session token kept the original admin role. An attacker with such a session could continue performing admin actions such as viewing, creating, editing and deleting users and changing system settings.

medium.com

Published on medium.com

Even more shocking: deleting a user account does not terminate active sessions. Scenario:

Mantosh Sah, on medium.com

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 session token embedded the user's role and the backend did not re-validate the current role or account status on each request, nor invalidate sessions on role change or deletion.

Impact

A demoted or deleted admin could keep full administrative access, including managing users and changing system settings, and could extend that access indefinitely through the refresh endpoint.

What the attacker needed

Two admin accounts on the platform; ability to change another admin's role; ability to delete a user account

The fix

The platform should invalidate or update active sessions whenever a role changes or an account is deleted, and re-check the current role and account status on every request rather than trusting the role stored in the token.

How it was found

  1. Create two admin accounts, Admin A and Admin B, and log both in.
  2. As Admin A, downgrade Admin B from admin to regular user.
  3. In Admin B's still-active session, perform admin actions such as viewing, creating or deleting users.
  4. Call the cookie refresh endpoint and observe that the role in the token stays admin while the expiry extends.
  5. As Admin A, delete Admin B's account and confirm Admin B's session still allows admin actions.

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 you log in, the server gives your browser a session token that proves who you are. This platform put your role (admin or user) inside that token and never checked it again on later requests. So even after an admin was demoted or deleted, their old token still said 'admin' and the server kept trusting it.

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.

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.