Web Security Series #5 — Exploiting Broken Access Control via T
The account update API accepted a token belonging to one user while the request body named a different user, so the server changed the other user's bio. An authenticated attacker could modify another user's account data by supplying their own valid token with the victim's username.
Published on medium.com
Access control mechanisms are essential for ensuring that users can only perform actions that they are authorized to execute. When these mechanisms are improperly implemented, attackers may manipulate requests to perform actions on resources that belong to other users.
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 server trusted the client-supplied username parameter and never verified that the token owner matched the account being modified.
Impact
An authenticated user could modify another user's account data, which the text says can lead to account takeover, privilege escalation and exposure of sensitive information.
What the attacker needed
A valid account token; knowledge of the victim's username
The fix
The server should verify that the token owner matches the resource being modified and perform authorization checks server-side on every request.
How it was found
- Log in as Jeremy to obtain a valid token.
- Decode the token payload to confirm it belongs to Jeremy.
- Retrieve Jeremy's own account details using his token.
- Update Jeremy's own bio to confirm the endpoint works.
- Send an update request using Jeremy's token but with Jessamy's username.
- Observe that the server accepts the request and changes Jessamy's bio.
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 you a token that proves who you are. This API used the token to check that you were logged in, but it did not check that the account named in the request was actually yours. So one logged-in user could change another person's profile by simply putting that person's username in the request.
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.