Authentication Bypass via a Flawed State Machine
The application issues a new session cookie after login but before role selection, and the admin panel only checks for that cookie rather than verifying the user's role. An attacker can use the fresh session cookie to access the admin interface and delete the user carlos.
medium.com
Published on medium.com
The lab demonstrates how a login system can be undermined when it relies on a fragile sequence of states instead of enforcing proper authentication at every step.
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
Likely the server issued a session cookie before the role-selection step and did not enforce role-based authorization on the admin endpoint, relying only on the presence of a session.
Impact
An attacker could access the admin interface and perform privileged actions such as deleting users, without completing the full login flow.
What the attacker needed
A valid low-privilege account; ability to intercept and modify HTTP requests
The fix
The application should not issue a fully privileged session before role selection, and the admin endpoint should explicitly verify the user's role.
How it was found
- Log in with the provided account and capture the role-selection request.
- Observe that the login response sets a new session cookie and redirects to the role selector.
- Resend the login request and extract the newly issued session cookie from the response.
- Duplicate the request, replace the session cookie with the new one, and change the path to /admin.
- Send the request to access the admin panel.
- Modify the request to delete the user carlos and send 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 write-up has not been written yet. The Original tab links to the source.
A state machine is a way of modelling a process as a series of steps. Here, the login process was supposed to go: enter credentials, choose a role, then access the site. But the server gave out a valid session cookie too early, before the role was chosen. That meant someone could skip the role step and go straight to the admin page using that early cookie.
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.