Chaining an IDOR Bug into an Account Takeover
The /auth/v1/sync endpoint returned user data and tokens for any supplied auth_guid without authentication, and the /sessions endpoint authenticated users based solely on token and user_id values, allowing an attacker to log in as another user by swapping these values.
medium.com
Published on medium.com
While testing, I came across this API endpoint: POST /auth/v1/sync. This endpoint is triggered during the registration and login flow and is responsible for linking a GUID to a user account, and it has multiple functionalities depending on the "event" in the body.
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 both endpoints lacked proper authorization checks, trusting client-supplied identifiers (auth_guid, token, user_id) without verifying the session or ownership.
Impact
An attacker could obtain another user's authentication tokens and use them to log in as that user, achieving account takeover.
What the attacker needed
Knowledge of a valid auth_guid; ability to intercept requests
How it was found
- Send a request to /auth/v1/sync with a chosen auth_guid, removing Cookie and Csrf-Token headers.
- Observe that the response contains the user's data and tokens.
- Send a request to /sessions with the token and user_id from the sync response, again without cookies or CSRF token.
- Replace token and user_id with values from another account and observe successful authentication.
- Intercept a normal login request, swap token and user_id with those of a second account, and forward to log in as that 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.
An IDOR (Insecure Direct Object Reference) is when a website lets you access data by simply changing an identifier in a request, without checking if you're allowed. Here, the sync endpoint gave back personal details and login tokens for any user ID you provided. Then, the login endpoint trusted those tokens without checking the session, so an attacker could use someone else's token to log in as them.
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.