IDOR Bug Let Me Access Any User’s Account Without Permission
An API endpoint returned and modified user profiles based on a user ID supplied in the URL without checking that the ID belonged to the logged-in user. An attacker could read another user's personal data, change their phone number, and receive the victim's authentication token in the response, allowing account takeover.
medium.com
Published on medium.com
I found a bug on a government website where I could take over anyone’s account just by changing one number in the web address. No special tools needed.
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 API endpoint looked up and modified user records by the ID in the request path without verifying that the authenticated user owned that ID, and it also returned a new authentication token in the PATCH response.
Impact
An attacker could read another user's personal data, change their phone number, obtain their session token, and potentially lock them out by changing their email; the text claims over 78,000 users were at risk.
What the attacker needed
A free account; victim's user ID known or guessable; no special tools
The fix
The API should verify that the authenticated user owns the requested user ID before returning or modifying data, and it should not issue authentication tokens in response to data changes.
How it was found
- Create two normal user accounts, one as attacker and one as victim, and log in as the attacker.
- Request the current user's profile via the API to see the attacker's own ID.
- Replace the current-user path with the victim's user ID and request the profile to receive the victim's data.
- Send a PATCH request to the victim's user ID changing the phone number, and observe the response includes the victim's auth token.
- Use the victim's token to submit an email change request for the victim's account.
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 website often uses a number or code to identify your account, like a label on a folder. This bug means the website handed over or changed someone else's folder just because the attacker guessed or copied the label, without checking it was theirs. The attacker could then see private details and even get a key to log in as the victim.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.