The Day I Became Everyone: How User Swapping Turned Me into a Dig
The API trusted a client-supplied user context header, so a low-privileged token could be paired with another user's identifier to read their profile and data. The author also claims the same weakness appeared in query parameters, JSON bodies and a session cookie, allowing access to admin data and fund transfers.
Free Link🎈
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 trusted client-supplied identity values (headers, parameters, body fields and a cookie) instead of deriving the user from the validated token.
Impact
An attacker with a basic account could read other users' data, transfer another user's funds, and reach admin-only configuration and database export endpoints.
What the attacker needed
A low-privileged account; knowledge of another user's identifier
The fix
The author says the issues were fixed by removing client-supplied user context headers, binding sessions server-side, adding consistent authorization checks and audit logging, and training developers.
How it was found
- Send a request to the profile endpoint with your own token and a user context header naming another user.
- Observe that the response returns the other user's profile data.
- Repeat with query parameters, JSON body fields and a session cookie on other endpoints.
- Point the context header at an admin account and request the database export endpoint.
- Run the same technique across many discovered user identifiers to gauge scale.
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.
An application programming interface (API) is how apps talk to a server. The server is supposed to check who you are from your login token, but here it also believed a header the client sends saying which user you are. So anyone could simply claim to be someone else and the server handed over that person's data.
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.