Zero Click To Account Takeover
The email confirmation link contained a base64-encoded user identifier that could be swapped for another user's identifier, allowing an attacker to confirm an email address on a victim's account. The attacker could then reset the victim's password and take over the account.
Today, I want to explain one of my favorite reports which lead me to take over any user account without one click from user. My favorite endpoint for test is reset password function; In this endpoint we have a lot of different options for test.
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
The target is a site whose account system is built around phone numbers and email addresses. Registration is done with a phone number only. The password reset function accepts either a phone number or an email address:
- With a phone number, the site sends an OTP code.
- With an email address, the site sends a link containing a token.
Email confirmation is a separate flow: after registering with a phone number, the user submits an email address and the site shows a pop-up saying "click the link sent your email to confirm". The confirmation link is the object of this report.
Accounts are identified internally by a numeric Sub value carried in the JWT. The researcher's JWT body contained regular profile information such as name and phone number, plus a parameter "Sub": 123.

Setup
No special tooling is described beyond a browser and the ability to base64-decode strings. Two accounts are needed:
- An attacker account, registered with a phone number, whose JWT carries
"Sub": 123. - A victim account, registered afterwards, whose JWT carries
"Sub": 124.
The researcher notes that the Sub value grows by one with every new account created, so the identifier is sequential and predictable.
Finding it
The researcher's starting point is the reset password function, described as a favourite endpoint because it offers many options to test. While mapping the account flows, the interesting gap is that registration only requires a phone number, yet the reset flow accepts an email address. The question is where the email address is confirmed, and the answer is the confirmation link.
When the attacker submits an email address during registration, the site returns a link of this shape:
Link:[Site](https://site).com/YXJlIHlvdSBraWRkaW5nIG1l8J+kqA==/d2hhdCBleGFjdGx5IHlvdSB3YW50Pz8/[redacted]=
The path is made of three base64 segments. Decoding them one by one:
YXJlIHlvdSBraWRkaW5nIG1l8J+kqA==could not be decoded clearly and was guessed to be a token.d2hhdCBleGFjdGx5IHlvdSB3YW50Pz8/decodes to the email address used, for example[redacted].[redacted]=decodes to a number,123.
That third number is the same value as Sub in the attacker's JWT. The link therefore binds the confirmation to an account by a plain, sequential identifier that the user can read and rewrite.
Exploitation
Step 1: create both accounts
Register the attacker account, which receives "Sub": 123, then register the victim account, which receives "Sub": 124. Because the identifier increments by one per registration, the attacker can predict or observe the victim's value.
Step 2: request a confirmation link for the attacker's email
In the attacker account, submit an email address to receive the confirmation link. The link contains the attacker's Sub in its last segment.
Step 3: swap the Sub segment
Replace the last part of the link, the base64-encoded Sub, with the base64 encoding of the victim's Sub. The email segment stays as it is.
Step 4: open the poisoned link
Open the modified link in the browser. The researcher opens the modified link in the browser.
Step 5: request a password reset for the attacker's email
Back on the site, submit a reset password request for the email address used in step 2.
Step 6: receive the reset link
The site sends a link for changing the password to that email address, which the attacker controls.
Step 7: change the password
After changing the password through that link, the attacker is redirected to the victim account. After changing the password, the researcher was redirected to the victim account.
Root cause
The confirmation link carries the account identifier as a client-controlled, base64-encoded value, and the server trusts it when deciding which account to confirm the email address on. Because the identifier is sequential, any user can derive or guess another user's value and substitute it.
The first segment, which the researcher could not decode and guessed to be a token, did not prevent the substitution.
Impact
An attacker who controls an email address can take over any user account without one click from the user. The researcher was redirected to the victim account after the password change.
Fix
The report does not describe a fix.
Variants to test
- Decode every segment of confirmation and reset links. A positive result is a readable account identifier, email address or other predictable value that the server accepts when changed.
- Register two accounts in a row and compare identifiers in JWTs and in links. A positive result is a sequential value that appears in both places.
- Swap the identifier segment for another account's value and complete the flow. A positive result is being redirected into the other account after the password change.
- Change the email segment while keeping the identifier. A positive result is the server confirming or resetting against the account named by the identifier regardless of the email.
- Test whether the first segment, the guessed token, is actually validated. A positive result is the flow succeeding with that segment left untouched, altered or removed.
What happened, in plain words
A website let people create an account with just a phone number. Later, you could add an email address to that account, and the site would send a confirmation link to that email. The link contained three pieces of information, all encoded in a format called base64 (a way of turning text into a longer string of letters and numbers so it can travel safely in a web address). One of those pieces was a number that identified the account. The number was the same as a value called Sub inside a JWT (a kind of digital ID card the site gives you after you log in). Because the number went up by one for each new account, anyone could guess another person's number. By changing that number in their own confirmation link, an attacker could point the link at the victim's account. Then the attacker asked for a password reset for their own email and received a reset link. After using that link, the attacker was redirected to the victim account. No click from the victim was needed. This is called account takeover.

The target and its features
Before diving into the attack, let's understand what the site does. It has an account system built around phone numbers and email addresses. You register with a phone number only. There is a password reset function that accepts either a phone number or an email address:
- If you give a phone number, the site sends a one-time password (OTP) code.
- If you give an email address, the site sends a link containing a token (a secret string used to prove identity).
Email confirmation is a separate step. After registering with a phone number, you can submit an email address, and the site shows a pop-up saying "click the link sent your email to confirm". That confirmation link is the star of this report.
Accounts are identified internally by a numeric Sub value carried in the JWT. The researcher's JWT body contained regular profile information such as name and phone number, plus a parameter "Sub": 123.
Setting up
You don't need any special tools beyond a browser and the ability to base64-decode strings (many online tools do this, or you can use built-in browser developer tools). You need two accounts:
- An attacker account, registered with a phone number, whose JWT carries
"Sub": 123. - A victim account, registered afterwards, whose JWT carries
"Sub": 124.
The researcher notes that the Sub value grows by one with every new account created, so the identifier is sequential and predictable. Think of it like ticket numbers at a deli: each customer gets the next number, so you can guess what number the person after you will get.
Finding the weakness
The researcher's starting point is the reset password function, described as a favourite endpoint because it offers many options to test. (An endpoint is simply a URL where the site accepts requests, like a counter in a shop.) While mapping the account flows, the interesting gap is that registration only requires a phone number, yet the reset flow accepts an email address. The question is: where is the email address confirmed? The answer is the confirmation link.
When the attacker submits an email address during registration, the site returns a link of this shape:
Link:[Site](https://site).com/YXJlIHlvdSBraWRkaW5nIG1l8J+kqA==/d2hhdCBleGFjdGx5IHlvdSB3YW50Pz8/[redacted]=
This is a URL. The part after the domain name is the path, and it is made of three segments separated by slashes. Each segment is base64-encoded. Let's decode them one by one:
YXJlIHlvdSBraWRkaW5nIG1l8J+kqA==could not be decoded clearly and was guessed to be a token.d2hhdCBleGFjdGx5IHlvdSB3YW50Pz8/decodes to the email address used, for example[redacted].[redacted]=decodes to a number,123.
That third number is the same value as Sub in the attacker's JWT. The link therefore binds the confirmation to an account by a plain, sequential identifier that the user can read and rewrite. In other words, the link says "confirm this email for account number 123", and anyone can change 123 to another number.
Exploitation step by step
Step 1: create both accounts
Register the attacker account, which receives "Sub": 123, then register the victim account, which receives "Sub": 124. Because the identifier increments by one per registration, the attacker can predict or observe the victim's value. This is like knowing that the next customer will get ticket 124 because you just got 123.
Step 2: request a confirmation link for the attacker's email
In the attacker account, submit an email address to receive the confirmation link. The link contains the attacker's Sub in its last segment. This is a normal action: you are asking the site to send a confirmation email to an address you control.
Step 3: swap the Sub segment
Replace the last part of the link, the base64-encoded Sub, with the base64 encoding of the victim's Sub. The email segment stays as it is. For example, if the victim's Sub is 124, you would base64-encode the string "124" and put it in place of the original last segment. The link now claims to confirm the attacker's email for the victim's account.
Step 4: open the poisoned link
Open the modified link in the browser. The site processes the confirmation against the account named in the last segment. The researcher opens the modified link in the browser.
Step 5: request a password reset for the attacker's email
Back on the site, submit a reset password request for the email address used in step 2. The researcher submits a reset password request for the email address used in step 2.
Step 6: receive the reset link
The site sends a link for changing the password to that email address, which the attacker controls. The attacker can now open the link.
Step 7: change the password
After changing the password through that link, the attacker is redirected to the victim account. After changing the password, the researcher was redirected to the victim account.
Why it works (root cause)
The confirmation link carries the account identifier as a client-controlled, base64-encoded value, and the server trusts it when deciding which account to confirm the email address on. Because the identifier is sequential, any user can derive or guess another user's value and substitute it. The first segment, which the researcher could not decode and guessed to be a token, did not prevent the substitution.
Impact
An attacker who controls an email address can take over any user account without one click from the user. The researcher was redirected to the victim account after the password change.
Fix
The report does not describe a fix.
Variants to test
- Decode every segment of confirmation and reset links. A positive result is a readable account identifier, email address or other predictable value that the server accepts when changed.
- Register two accounts in a row and compare identifiers in JWTs and in links. A positive result is a sequential value that appears in both places.
- Swap the identifier segment for another account's value and complete the flow. A positive result is being redirected into the other account after the password change.
- Change the email segment while keeping the identifier. A positive result is the server confirming or resetting against the account named by the identifier regardless of the email.
- Test whether the first segment, the guessed token, is actually validated. A positive result is the flow succeeding with that segment left untouched, altered or removed.
Glossary
- Account takeover: A situation where an attacker gains full control over another person's account, often by changing the password or email.
- API: Application Programming Interface; a set of rules that lets one piece of software talk to another. In web security, it often refers to the endpoints a website exposes for actions like login or password reset.
- Base64: A way of encoding binary data as text using 64 characters, often used to safely include data in URLs or emails. It is not encryption; anyone can decode it.
- Cookie: A small piece of data stored by the browser and sent back to the server with each request, often used to keep you logged in.
- Endpoint: A specific URL where a web service accepts requests, like a counter in a shop.
- JWT (JSON Web Token): A compact, URL-safe token that contains claims (pieces of information) about a user, often used for authentication. It has three parts: header, payload, and signature.
- OTP (One-Time Password): A code that is valid for only one login session or transaction, often sent via SMS.
- Password reset: A feature that lets a user regain access to their account by proving ownership of an email or phone number.
- Sequential identifier: A number that increases by one for each new record, making it predictable.
- Sub: In JWT terminology, the "subject" claim, which identifies the principal (e.g. the user) that the token is about.
- Token: A piece of data used to authenticate a user or authorize an action, often a string that is hard to guess.
- Vulnerability: A weakness in a system that can be exploited to compromise security.