5 Ways to do Account Takeover in a Single Website
The website had five separate account takeover flaws: a JWT misconfiguration allowing user ID swapping, an OAuth misconfiguration allowing email swapping, no rate limit on OTP verification, OTP bypass via response manipulation, and an IDOR on reset password. An attacker could take over other users' accounts without their involvement.
Published on medium.com
Good day, everyone! I was hunting on one application yesterday and got five separate ATO’s, all without user involvement, and I was as surprised as you are, so I decided to make a write-up.
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.
Context
This is a write-up of five separate account takeover (ATO) findings on a single website, all of them achieved without any action from the victim. The author refers to the target as target.com because the site did not allow public disclosure, so the real hostname, endpoints and parameters are not given anywhere in the report.
The application used JWT tokens for authentication, offered a password reset flow that relied on a 4 digit OTP sent by email, and supported social sign in through Facebook and Google. The report does not name the product, the platform or the technology stack beyond those observations.
Setup
The researcher created a second account to obtain its user id for the JWT step. Tools used were Burp Suite (Intruder is mentioned) and jwt.io for decoding tokens. No versions are given.
Preconditions for the five findings, as they appear in the report:
- The JWT payload contains a user id that the server trusts for identity.
- A failed login response leaks the user id.
- The Google sign in flow accepts a client controlled email in the intercepted request.
- The OTP verification endpoint has no rate limiting.
- The OTP check result can be manipulated in the response, and the new password request carries an encrypted user id but no OTP field.
Finding it
The author starts every hunt by looking for ATO. After creating an account, the JWT was copied and decoded at jwt.io. The decoded token looked something like this:

Seeing a user id inside the payload made the author about 50% certain there was a weakness. The next problem was obtaining other users' ids. A password reset request was checked first, but it did not disclose the user id; it leaked something else, which the report says will be described later. A login attempt with a wrong password was then checked, and its response did leak the user id:

Exploitation
ATO 1: JWT misconfiguration
- Create account 1 and copy its JWT.
- Decode the JWT at jwt.io and note the user id in the payload.
- Trigger a failed login and read the user id from the response.
- Create account 2, obtain its user id, and go to jwt.io to replace the user id in the payload and obtain a new JWT.
- Log in with account 1's credentials but the updated JWT. The session lands in account 2.

The report does not show the token itself, the signing algorithm, or whether the signature was recomputed with a known key. What it does show is that the server accepted a token whose payload had been edited to another user's id, which is the whole of the takeover.
ATO 2: OAuth misconfiguration
The author normally tests Facebook OAuth only, and on this target FB OAuth was not working. Google sign in had never produced a bug before, so it was tried anyway. The Google sign in request was intercepted and a sign in with the researcher's own Google account was performed. The intercepted request looked like this:

At that point the author was certain of another ATO. The email in the request was changed and the request was forwarded, and the response signed the session into a different account.

The report does not reproduce the request or name the parameter that carried the email, so the exact field is not available here. The behaviour described is that the identity asserted by the client in the OAuth exchange was trusted by the server.
ATO 3: no rate limit on OTP verification
The reset password function used a 4 digit OTP for verification:

Burp was started and 1000 payloads were sent to see whether any rate limiting existed and whether the OTP could be brute forced. The report states that this produced the third ATO. The exact request, the payload list and the response are not shown.
ATO 4: OTP bypass through response manipulation
The response after submitting one correct OTP was inspected in Intruder:

There was no access token in it, and the OTP was only validated at the beginning of the flow. The author then submitted a wrong OTP and changed the response to the one obtained after entering the proper OTP:

The author changed the wrong OTP response to the one from a correct OTP.
ATO 5: IDOR on reset password
A reset password request returned a response like this:

The OTP arrived by email and was entered. When the new password was submitted, the request was captured:

The captured request had no OTP field, but it did carry a user id. The id was encrypted but was being leaked in the response, so it could be replaced with another account's id. Replacing it with the other account's id changed that account's password.
Root cause
The five findings share one theme: the server trusts values that the client can supply or edit.
- The JWT payload's user id is used as the identity without the server binding it to the authenticated session, so an edited payload is accepted. Whether the signature was verified at all, or whether the key was guessable, is not stated.
- The email in the intercepted Google sign in request was changed and the session landed in a different account.
- The OTP endpoint has no rate limiting, so a 4 digit space can be enumerated.
- The OTP was only validated at the beginning of the flow, so editing the response skipped the later check.
- The new password request identifies the account by an encrypted user id that was leaked in the response, and it does not require the OTP, so the id can be swapped for another user's.
Impact
Each of the five issues is an account takeover that requires no action from the victim. An attacker who can reach the relevant endpoints can log in as another user (JWT), sign in as another user through Google (OAuth), brute force a reset OTP, skip OTP verification by editing the response, or change another user's password through the IDOR. The report notes that these five were the ones that did not require user input, and that other issues such as CSRF were present but not covered.
Fix
Based on the findings, the changes that would address them are: bind the JWT identity to the authenticated session and verify the signature server side; derive the OAuth identity from the provider's verified assertion rather than a client supplied email; rate limit and lock out OTP verification attempts; enforce the OTP result on the server rather than in the response; and require the OTP on the new password request while using a server side reference to the account instead of a client supplied encrypted id.
Variants to test
- Decode your own JWT and look for a user id, email or role in the payload. A positive result is a token whose edited payload is accepted by the server.
- Send a login request with a wrong password and inspect the response for a user id or other identifiers. A positive result is an id you can use in step 1.
- Intercept the Google (or other provider) sign in request and look for an email or identifier field. A positive result is a changed value that signs you into another account.
- Send a large batch of OTP guesses to the verification endpoint and watch for lockouts or throttling. A positive result is a valid OTP found within the batch.
- Submit a wrong OTP and edit the response to the one returned for a correct OTP. A positive result is the flow continuing to the next step.
- Capture the new password request after a reset and look for a user id or token. A positive result is a swapped value that changes another account's password.
What happened, in plain words
A security researcher spent a day testing one website and found five different ways to take over someone else's account. Account takeover, usually shortened to ATO, means logging in as another person without their permission and without them doing anything at all. The victim does not click a link, does not approve a login prompt, and does not need to be online. The attacker simply sends requests to the website and the website hands over the account.
The website did not allow the researcher to publish its real name, so throughout the report it is called target.com. That means the real address, the exact pages and the exact field names are not written down anywhere. What we do have is the sequence of ideas: how each weakness was spotted, what was sent, and why it worked.
Before going further, a few words that will come up constantly.
A website is a program running on a computer somewhere that your browser talks to. Your browser sends a request, the server sends back a response. That is the whole relationship.
An API is the part of a website that answers requests with data rather than with a pretty page. Think of a restaurant: the dining room is the website you see, the kitchen door where orders are passed through is the API. You can talk to the kitchen directly if you know how to knock, and that is exactly what tools like Burp Suite let you do.
A request is the message your browser sends: which page you want, what you are sending with it, and who you claim to be. A response is the message that comes back: the page, the data, or an error.
A token is a small piece of text that proves who you are, a bit like a cloakroom ticket. You show it, the server checks it, and you get your coat. A JWT (JSON Web Token) is one particular kind of token that carries information inside it, written in a format anyone can read. It is not encrypted by default, only signed, which is like a sealed envelope with a glass window: you can read the contents, and the seal is supposed to stop you changing them.
An OTP (one time password) is a short code, usually a few digits, sent to your email or phone to prove you own it. It expires quickly and should only work once.
OAuth is the system that lets you press "Sign in with Google" or "Sign in with Facebook" instead of typing a password. The website asks the provider who you are, and the provider answers.
Burp Suite is a program that sits between your browser and the website and lets you read and edit every request and response. Two of its features are used here: Repeater, which lets you send the same request again and again with small changes, and Intruder, which sends a request many times automatically with different values each time.
jwt.io is a free web page that decodes JWTs so you can read what is inside them, and lets you edit the contents and produce a new token.
With those words in hand, here is how the day went.
Setting up
The researcher made two accounts on the target. Account 1 was the attacker's own account, the one used to log in. Account 2 was a second account the researcher created to obtain its user id. Having both is essential: you need a real second account to prove that you really ended up inside it, rather than just assuming you would.
The tools were Burp Suite and jwt.io. No versions are mentioned, and it does not matter for understanding the story.
Each of the five findings depended on one specific weakness being present. In the order they appear:
- The JWT contains a user id, and the server believes whatever user id is in the token.
- A failed login tells you the user id of the account you tried.
- The Google sign in flow accepts an email address that the browser sends, rather than one Google confirms.
- The page that checks the OTP code has no limit on how many times you can try.
- The final step of the password reset can be edited in the response, and the request that sets the new password carries an encrypted user id but no OTP at all.
Finding it
The researcher starts every hunt by looking for account takeover, because it is the most valuable thing a website can get wrong. After creating an account, the first move was to copy the JWT the site had issued and paste it into jwt.io to read it. The decoded token looked something like this:

A JWT has three parts separated by dots. The middle part is the payload, and it is just text that has been encoded, not hidden. Reading it is not an attack; it is the same as reading the label on a parcel. What matters is what is written there. In this case the payload contained a user id, a number or string that identifies which account the token belongs to.
Seeing a user id in the payload made the researcher about 50% certain there was a weakness. The reasoning is simple: if the server decides who you are by reading that id, and if the server does not properly check that the token has not been altered, then changing the id changes who you are. The remaining question was where to get somebody else's id.
The first idea was the password reset page. You type your email, the site looks up the account, and it might send back information about it. Here it did not reveal the user id. It leaked something else instead, which the report says will be described later.
The second idea worked. A login attempt with a deliberately wrong password was sent, and the response contained the user id:

This is worth pausing on. When you type the wrong password, the site should say "wrong password" and nothing more. Instead it answered with the identifier of the account you were trying to log into. That is like a bank teller telling a stranger your account number when they guess your PIN incorrectly. On its own it is a small leak; combined with a token the server trusts blindly, it is the missing half of the attack.
Exploitation
ATO 1: JWT misconfiguration
- Create account 1 and copy its JWT.
- Decode the JWT at jwt.io and note the user id in the payload.
- Trigger a failed login and read the user id from the response.
- Create account 2, obtain its user id, and go to jwt.io to replace the user id in the payload and obtain a new JWT.
- Log in with account 1's credentials but the updated JWT. The session lands in account 2.

Step by step, in plain words. You log in normally as account 1 and the site hands you a token. You read the token and find the user id inside it. You then send a login attempt with a wrong password, and the response tells you a user id. You go back to jwt.io, swap account 1's id for account 2's id, and the tool produces a new token. Finally you log in with account 1's email and password, but you replace the token the site gives you with your edited one. The site reads the id from the token, believes it, and treats you as account 2.
The report does not show the token itself, the signing algorithm, or whether the signature was recomputed with a known key. What it does show is that the server accepted a token whose payload had been edited to another user's id. That single acceptance is the whole takeover. The lesson for a beginner is that a token is only as trustworthy as the server's check of it. If the server reads the contents and skips the check, the contents are whatever the attacker wants them to be.
ATO 2: OAuth misconfiguration
Normally the researcher only tests Facebook sign in, and on this target Facebook sign in was not working. Google sign in had never produced a bug before, so it was tried anyway. The Google sign in request was intercepted in Burp, and a sign in was performed with the researcher's own Google account. The intercepted request looked like this:

When you press "Sign in with Google", your browser is sent to Google, you approve, and Google sends you back to the website with a message saying who you are. That message is the thing being intercepted here. The researcher intercepted the Google sign in request and saw an email address in it.
At that point the researcher was certain of another takeover. The email in the request was changed to a different address and the request was forwarded, and the response signed the session into a different account.

The report does not reproduce the request or name the field that carried the email, so the exact parameter is not available. The behaviour described is that the identity asserted by the client in the OAuth exchange was trusted by the server. In everyday terms: the bouncer asked "who are you?" and accepted the answer written on a piece of paper the visitor was holding, instead of checking with the office that issued the invitation. The fix in principle is that the site must ask Google directly, not believe the browser.
ATO 3: no rate limit on OTP verification
The reset password function used a 4 digit OTP for verification:

A 4 digit code has 10,000 possible values, from 0000 to 9999. That is a lot for a person to guess by hand, and almost nothing for a computer. The defence that makes such a short code safe is a rate limit: the server refuses to accept more than a handful of attempts in a given time, and often locks the account after a few failures. Without that limit, an attacker can simply try every value.
Burp was started and 1000 payloads were sent to see whether any rate limiting existed and whether the OTP could be brute forced. The report states that this produced the third takeover. The exact request, the list of payloads and the response are not shown. The reasoning is straightforward: if a thousand guesses go through without the server complaining, then ten thousand will too, and one of them will be the right code.
ATO 4: OTP bypass through response manipulation
The response after submitting one correct OTP was inspected in Intruder:

There was no access token in it, and the OTP was only validated at the beginning of the flow. This is the key observation. A properly built reset flow issues a short lived token after the OTP is confirmed, and every later step requires that token. Here the response carried no such token, and the OTP was only validated at the beginning of the flow. The author then submitted a wrong OTP and changed the response to the one obtained after entering the proper OTP:

Response manipulation means editing the answer the server sends back before your browser sees it. It sounds odd, because normally the server is the authority. But if the website's own pages decide what to do next by reading the response, and the response can be edited in transit by the person holding the browser, then the person decides what happens next. It is like a form that says "approved" in a box the applicant fills in themselves.
The author changed the wrong OTP response to the one from a correct OTP. The server had already done its check at the start and never asked again.
ATO 5: IDOR on reset password
A reset password request returned a response like this:

The OTP arrived by email and was entered. When the new password was submitted, the request was captured:

The captured request had no OTP field, but it did carry a user id. The id was encrypted but was being leaked in the response, so it could be replaced with another account's id. Replacing it with the other account's id changed that account's password.
IDOR stands for Insecure Direct Object Reference. It means the server identifies which record to act on using a value the client sends, and never checks that the client is allowed to touch that record. Think of a hotel where your room key is a number written on a card: if you can write a different number on the card, you can open a different room. Encryption does not help here, because the encrypted value is handed out by the server itself. It is a locked box whose key is taped to the lid.
The flow is worth spelling out because it is the most subtle of the five. You ask to reset your password. The site replies with something that includes an encrypted user id. You receive the OTP by email and enter it. You then submit a new password, and that request contains the encrypted user id but no OTP. You replace the encrypted id with the user id of another account and send the request. The server changes the password of the account whose id you supplied. The victim never sees a code, never approves anything, and loses the account.
Root cause
The five findings share one theme: the server trusts values that the client can supply or edit.
- The JWT payload's user id is used as the identity without the server binding it to the authenticated session, so an edited payload is accepted. Whether the signature was verified at all, or whether the key was guessable, is not stated.
- The email in the intercepted Google sign in request was changed and the session landed in a different account.
- The OTP endpoint has no rate limiting, so a 4 digit space can be enumerated.
- The OTP was only validated at the beginning of the flow, so editing the response skipped the later check.
- The new password request identifies the account by an encrypted user id that was leaked in the response, and it does not require the OTP, so the id can be swapped for another user's.
Impact
Each of the five issues is an account takeover that requires no action from the victim. An attacker who can reach the relevant endpoints can log in as another user through the JWT, sign in as another user through Google, brute force a reset OTP, skip OTP verification by editing the response, or change another user's password through the IDOR. The report notes that these five were the ones that did not require user input, and that other issues such as CSRF were present but not covered. The report does not give severity ratings, CVSS scores or bounty amounts.
Fix
Based on the findings, the changes that would address them are: bind the JWT identity to the authenticated session and verify the signature server side; derive the OAuth identity from the provider's verified assertion rather than a client supplied email; rate limit and lock out OTP verification attempts; enforce the OTP result on the server rather than in the response; and require the OTP on the new password request while using a server side reference to the account instead of a client supplied encrypted id.
Variants to test
- Decode your own JWT and look for a user id, email or role in the payload. A positive result is a token whose edited payload is accepted by the server.
- Send a login request with a wrong password and inspect the response for a user id or other identifiers. A positive result is an id you can use in step 1.
- Intercept the Google or other provider sign in request and look for an email or identifier field. A positive result is a changed value that signs you into another account.
- Send a large batch of OTP guesses to the verification endpoint and watch for lockouts or throttling. A positive result is a valid OTP found within the batch.
- Submit a wrong OTP and edit the response to the one returned for a correct OTP. A positive result is the flow continuing to the next step.
- Capture the new password request after a reset and look for a user id or token. A positive result is a swapped value that changes another account's password.
Glossary
- Account takeover (ATO): logging in as another person without their permission and without any action from them.
- API: the part of a website that answers requests with data rather than with a page; the kitchen door behind the dining room.
- Brute force: trying every possible value of a short secret until one works.
- Burp Suite: a program that sits between your browser and a website so you can read and edit every request and response.
- CSRF: cross site request forgery, a class of attack where another site makes your browser send a request you did not intend; mentioned in the report but not covered.
- CVSS: a standard scoring system for the severity of a vulnerability; the report gives no scores.
- Endpoint: a specific address on a server that accepts a particular kind of request.
- IDOR: insecure direct object reference, where the server acts on a record identified by a value the client sends without checking that the client may touch it.
- Intruder: the Burp Suite feature that sends a request many times automatically with different values.
- JWT (JSON Web Token): a token made of three dot separated parts whose middle part, the payload, is readable text carrying claims such as a user id.
- jwt.io: a free web page that decodes JWTs and lets you edit them and produce a new one.
- OAuth: the system behind "Sign in with Google" and "Sign in with Facebook", where a provider vouches for your identity to another site.
- OTP (one time password): a short code sent to your email or phone to prove you own it, meant to be used once and to expire quickly.
- Payload: the middle part of a JWT, containing the claims such as the user id.
- Rate limit: a cap on how many requests a server will accept in a period, used to stop guessing attacks.
- Repeater: the Burp Suite feature that lets you resend one request with small changes.
- Request: the message your browser sends to a server, saying what it wants and who it claims to be.
- Response: the message a server sends back, containing a page, data or an error.
- Response manipulation: editing the server's answer before the browser acts on it, so the page believes something the server never said.
- Signature: the part of a JWT that is supposed to prove the contents were not altered; it only helps if the server actually checks it.
- Token: a piece of text that proves who you are, like a cloakroom ticket.
- User id: the value that identifies a particular account on a site.