Skip to content
Race condition Write-up Advanced

Account takeover on 8 years old public program

A race condition let the author verify an email address they did not own on a developer portal, and a trailing control character in the email field made the portal treat their account as the victim's. By combining both, the author could sign into another user's developer account.

Priyanshu Shakya Follow

Published on medium.com

This is the story of the account takeover that I found on 8 years old public program.

priyanshu shakya, on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

The target is a public program that had been running for eight years. It has two sites. The main website, www.example.com, is where users create an account and log in. A second site, developer.example.com, is for developers: you sign in there using your main account from www.example.com.

The normal sign-in flow on the developer site is:

  1. Go to developer.example.com.
  2. Click the sign in button.
  3. Select your account from the main website (www.example.com).
  4. If the email address on your main account is not verified, a popup asks you to verify it. A link is sent to that email address and you have to click it.
  5. You are logged in to developer.example.com.

The feature under test is therefore the email verification gate that sits between a main-site account and a developer-site session.

Setup

The researcher used a main-site account and the developer sign-in flow described above. The tooling was Burp Suite, in particular Repeater, its parallel-send group feature for race conditions, and the Repeater-based race condition tooling that PortSwigger has published and researched. The researcher also credits 0xacb for the tool recollapse, which is used later to fuzz the email field with unicode characters.

No versions, endpoints, parameters or headers are given in the report.

Finding it

The starting point was the email verification step in the developer sign-in flow. The researcher tried to bypass it, and succeeded. The bypass relies on sending two verification requests at the same moment: one for the original email address and one for a newly set email address, so that the verification state of one is applied to the other.

That first bug was reported on its own and accepted as p4 with a $200 reward. The researcher then reasoned that if a developer account could be created with a victim's email address, the same verification bypass would turn the bug into a full account takeover. The rest of the work is about getting a main-site account whose email is accepted as the victim's address while still being a separate account.

Exploitation

Step 1: bypass the email verification gate

  1. Go to www.example.com and create an account with the email [redacted].
  2. Go to developer.example.com, click sign in, select the account. The email verification popup appears; click send verification email.
  3. The verification email arrives. Open the verification link with Burp proxying the traffic, send the verification request to Repeater and drop the request.
  4. Still proxying through Burp, go to www.example.com, change the account email to [redacted], send that verification request to Repeater as well and drop it.
  5. Create a group in Repeater, move both requests into it and send them in parallel.
  6. The account ends up created with the verified email [redacted].
  7. The researcher now has a developer.example.com account with verified email [redacted].

Both requests are held unsent until the group is fired, so the two verification operations race against each other. The result is that the verification performed for one address is credited to the other, and the developer account is treated as verified.

Step 2: try the victim's address directly

With the bypass in hand, the plan was to create a developer account carrying the victim's email address and then verify it with the same trick. On www.example.com, changing the account email to the victim's address [redacted] failed with an error saying something went wrong. The application returned an error saying something went wrong.

Step 3: fuzz the email field with unicode

The researcher fuzzed the email field with unicode characters, using recollapse if desired. The following address was accepted:

Text
[redacted]%0f

After this, on www.example.com the researcher's account has the email [redacted]%0f while the victim's account has [redacted]. The two accounts are distinct and neither party can access the other's account.

Step 4: verify and take over

Signing in to developer.example.com with the email [redacted]%0f brings up the email verification prompt. The researcher verifies the email using the race from step 1. The developer session that results is the victim's developer account. Account takeover complete.

From the original on medium.com

Root cause

Two weaknesses combine.

First, the email verification step is not atomic with respect to the email address it is verifying. Two verification requests sent in parallel, one for the old address and one for the new one, let the verification of one address satisfy the check for the other. The report does not describe the server-side implementation.

Second, the email field accepts a value that normalises to the victim's address but compares as different. [redacted]%0f passes the uniqueness check against [redacted], so a second account can be created, yet the developer sign-in flow resolves it to the victim's developer account. The report does not state where or how the value is handled differently.

Impact

An attacker can take over the developer account of a user whose email address they know, provided the developer sign-in flow is reachable and the verification race works as described. The attacker does not need access to the victim's mailbox.

Fix

No fix is described in the report. The two changes implied by the findings are to make email verification atomic and bound to the exact address being verified, and to normalise and canonicalise the email value consistently before the uniqueness check and before account lookup, rejecting values that differ only by trailing or control characters.

Variants to test

  1. Race the verification of two addresses on other sign-in and linking flows. A positive result is a session or account marked verified for an address whose link was never clicked.
  2. Submit email addresses with trailing encoded characters such as %0f, %00, %20 or unicode lookalikes where an address is already taken. A positive result is a second account created alongside the original.
  3. After creating such a near-duplicate account, sign in to any downstream product that maps the address back to the original. A positive result is a session belonging to the original account.
  4. Test whether the uniqueness check and the login lookup normalise differently, for example by registering with mixed case or surrounding whitespace. A positive result is two accounts that resolve to the same identity at login.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

A security researcher found a way to take over someone else's account on a program that had been public for eight years. The program runs two websites. One is the main site, where anyone can create an account and log in. The other is a site for developers, where you sign in using your main account. The developer site only lets you in once the email address on your main account has been verified, meaning you have proved you can read messages sent to that address.

The researcher first found a way to skip that email check. They did it by sending two verification requests at exactly the same moment. That bug on its own was accepted as a low-severity issue (p4) and paid $200.

Then the researcher thought bigger. If they could create a developer account that carried the victim's email address, the same trick would let them verify it and walk straight into the victim's developer account. The main site refused to let them change their email to the victim's address, returning an error saying something went wrong. So they tried adding invisible characters to the end of the address. One of those, %0f, was accepted. The site now treated [redacted]%0f as a different address from [redacted], so the researcher had their own separate account. But when they signed in to the developer site with that address and verified it, they were logged in as the victim. The researcher verified the email with the race trick and was logged in as the victim. Account takeover complete.

This article walks through the same steps the researcher took, explaining each idea from scratch. You only need to be able to use a browser to follow along.

The two websites and the sign-in flow

The target is a public bug bounty program, meaning a company invites outside researchers to test its systems and pays for real security bugs they report. This particular program had been running for eight years.

There are two sites:

  • www.example.com is the main website. You create an account there and log in.
  • developer.example.com is a second site for developers. You do not create a separate password there; you sign in using your main account from www.example.com.

The normal sign-in flow on the developer site is:

  1. Go to developer.example.com.
  2. Click the sign in button.
  3. Select your account from the main website (www.example.com).
  4. If the email address on your main account is not verified, a popup asks you to verify it. A link is sent to that email address and you have to click it.
  5. You are logged in to developer.example.com.

Email verification is a common safety measure. When you sign up, the site sends a message to the address you gave. The message contains a link with a long random code in it. Clicking the link tells the site that whoever holds the account can also read mail at that address. This matters because an email address is often the thing that identifies a person across many services. If a site lets you into an account without proving you own the address, someone could claim an address that belongs to somebody else.

The feature under test here is that email verification gate: the checkpoint between a main-site account and a developer-site session. A session is simply the state of being logged in. When you log in, the server gives your browser a small piece of data (often called a cookie or a token) that it checks on every later request, so it knows who you are without asking for your password each time.

The tools the researcher used

The researcher used Burp Suite, a program that sits between your browser and a website and lets you look at, pause, change and resend the requests your browser makes. A request is the message your browser sends to a server, for example "please show me this page" or "please change my email address". A response is what the server sends back.

Two parts of Burp matter here:

  • Repeater lets you take a single request, edit it, and send it again as many times as you like, seeing the response each time. It is like being able to rewind and replay a conversation.
  • Repeater groups with parallel send let you put several requests into one group and fire them all at the same instant. This is used to test race conditions.

A race condition is a bug that appears when two operations happen at almost the same moment and interfere with each other. A simple everyday comparison: two people reach for the last seat on a train at the same time. Each one checks "is this seat free?" and both see "yes", so both sit down. The check and the action were not done as one indivisible step. Software has the same problem when it checks something and then acts on it, with a gap in between.

The researcher also credits 0xacb for a tool called recollapse, which is used later to try many variations of the email field with unicode characters. Unicode is the standard that assigns a number to every character in every writing system, including many invisible or unusual characters. Fuzzing means sending lots of slightly different inputs automatically to see which ones the server accepts.

The report does not give versions, endpoints, parameters or headers, so this article does not either.

Finding it

The starting point was the email verification step in the developer sign-in flow. The researcher tried to bypass it, and succeeded. The bypass relies on sending two verification requests at the same moment: one for the original email address and one for a newly set email address, so that the verification state of one is applied to the other.

That first bug was reported on its own and accepted as p4 with a $200 reward. Severity ratings like p4 are a rough scale used by bug bounty programs, where p1 is usually the most serious and higher numbers are less severe. The researcher then reasoned that if a developer account could be created with a victim's email address, the same verification bypass would turn the bug into a full account takeover. Account takeover means logging in as another person and having access to everything their account can do. The rest of the work is about getting a main-site account whose email is accepted as the victim's address while still being a separate account.

Exploitation

Step 1: bypass the email verification gate

  1. Go to www.example.com and create an account with the email [redacted].
  2. Go to developer.example.com, click sign in, select the account. The email verification popup appears; click send verification email.
  3. The verification email arrives. Open the verification link with Burp proxying the traffic, send the verification request to Repeater and drop the request.
  4. Still proxying through Burp, go to www.example.com, change the account email to [redacted], send that verification request to Repeater as well and drop it.
  5. Create a group in Repeater, move both requests into it and send them in parallel.
  6. The account ends up created with the verified email [redacted].
  7. The researcher now has a developer.example.com account with verified email [redacted].

Why each step was taken:

  • Step 1 gives the researcher a normal account to experiment with. Using a made-up address like [redacted] keeps the test harmless.
  • Step 2 starts the verification process so that a verification request exists to capture.
  • Step 3 is the key move. Normally, clicking the link in the email sends a request to the server saying "this address is verified". By proxying through Burp, the researcher can catch that request before it reaches the server and hold it. Dropping the request means the browser does not complete the action, but the researcher keeps a copy of the request in Repeater.
  • Step 4 does the same thing for a second address. The researcher changes the account's email to [redacted] and captures the verification request for that address too, again without letting it complete.
  • Step 5 fires both held requests at the same instant. This is the race. The server is asked to verify two different addresses for the same account at the same time.
  • Step 6 is the result: the account ends up with the verified email [redacted].
  • Step 7 confirms the researcher now has a developer account whose email is marked verified.

Both requests are held unsent until the group is fired, so the two verification operations race against each other. The result is that the verification performed for one address is credited to the other, and the developer account is treated as verified. In plain terms, the server checked one thing and then acted on another, and the two requests slipped through the gap between those two moments.

Step 2: try the victim's address directly

With the bypass in hand, the plan was to create a developer account carrying the victim's email address and then verify it with the same trick. On www.example.com, changing the account email to the victim's address [redacted] failed with an error saying something went wrong. The application refused the address because it was already in use.

This is a sensible protection. If two accounts could share one email address, the site would not know which account to log in when someone signs in with that address. So the site checks whether the address is already taken and refuses it. The researcher needed an address that the site would accept as new but that the developer site would still match to the victim.

Step 3: fuzz the email field with unicode

The researcher fuzzed the email field with unicode characters, using recollapse if desired. The following address was accepted:

Text
[redacted]%0f

What this value is: %0f is how a control character is written when it is encoded for use in a URL or a form field. The percent sign followed by two hexadecimal digits stands for one byte. 0f in hexadecimal is 15 in decimal, which is a control character that has no visible shape. So the string looks like the victim's address with something invisible stuck on the end.

After this, on www.example.com the researcher's account has the email [redacted]%0f while the victim's account has [redacted]. The two accounts are distinct and neither party can access the other's account.

Step 4: verify and take over

Signing in to developer.example.com with the email [redacted]%0f brings up the email verification prompt. The researcher verifies the email using the race from step 1. The developer session that results is the victim's developer account. Account takeover complete.

From the original on medium.com

The important point is that the researcher's account had the email [redacted]%0f while the victim's account had [redacted], and signing in to the developer site with the former led to the victim's developer account.

Root cause

Two weaknesses combine.

First, the email verification step is not atomic with respect to the email address it is verifying. Atomic here means all-or-nothing, done as a single indivisible step. Two verification requests sent in parallel, one for the old address and one for the new one, let the verification of one address satisfy the check for the other. The report does not describe the server-side implementation. Check-then-act means the server first asks "is this allowed?" and then later performs the action, with a window in between where things can change.

Second, the email field accepts a value that normalises to the victim's address but compares as different. Normalising means tidying a value into a standard form before using it, for example trimming spaces or decoding encoded characters. [redacted]%0f passes the uniqueness check against [redacted], so a second account can be created, yet the developer sign-in flow resolves it to the victim's developer account.

Impact

An attacker can take over the developer account of a user whose email address they know, provided the developer sign-in flow is reachable and the verification race works as described. The attacker does not need access to the victim's mailbox.

Fix

No fix is described in the report. The two changes implied by the findings are to make email verification atomic and bound to the exact address being verified, and to normalise and canonicalise the email value consistently before the uniqueness check and before account lookup, rejecting values that differ only by trailing or control characters. Canonicalise means to reduce a value to one agreed standard form, so that every part of the system sees the same thing.

Variants to test

  1. Race the verification of two addresses on other sign-in and linking flows. A positive result is a session or account marked verified for an address whose link was never clicked.
  2. Submit email addresses with trailing encoded characters such as %0f, %00, %20 or unicode lookalikes where an address is already taken. A positive result is a second account created alongside the original.
  3. After creating such a near-duplicate account, sign in to any downstream product that maps the address back to the original. A positive result is a session belonging to the original account.
  4. Test whether the uniqueness check and the login lookup normalise differently, for example by registering with mixed case or surrounding whitespace. A positive result is two accounts that resolve to the same identity at login.

Glossary

  • Account takeover: gaining control of another person's account, usually by logging in as them.
  • Atomic: done as a single indivisible step, so nothing can happen in between.
  • Bug bounty program: a scheme where a company invites outside researchers to test its systems and pays for real security bugs they report.
  • Burp Suite: a tool that sits between your browser and a website so you can inspect, pause, change and resend requests.
  • Canonicalise: reduce a value to one agreed standard form so every part of a system sees the same thing.
  • Check-then-act: a pattern where a system first checks whether something is allowed and then performs the action, leaving a gap in between.
  • Cookie: a small piece of data a site stores in your browser, often used to remember that you are logged in.
  • Developer site: in this report, developer.example.com, a second site where you sign in using your main account.
  • Email verification: proving you can read messages sent to an email address, usually by clicking a link sent to it.
  • Endpoint: a specific address on a server that accepts requests, such as a particular page or action.
  • Fuzzing: automatically sending many slightly different inputs to see which ones a system accepts.
  • Hexadecimal: a way of writing numbers using digits 0 to 9 and letters A to F, often used to write bytes.
  • Normalise: tidy a value into a standard form before using it, for example trimming spaces or decoding encoded characters.
  • p4: a severity rating used by bug bounty programs, where p1 is usually the most serious and higher numbers are less severe.
  • Parallel send: firing several requests at the same instant rather than one after another.
  • Proxying: routing your browser's traffic through another program so you can inspect and change it.
  • Race condition: a bug that appears when two operations happen at almost the same moment and interfere with each other.
  • recollapse: a tool credited in the report, used to fuzz the email field with unicode characters.
  • Repeater: a part of Burp Suite that lets you edit and resend a single request as many times as you like.
  • Request: the message your browser sends to a server, for example asking for a page or asking to change an email address.
  • Response: the message a server sends back to your browser.
  • Session: the state of being logged in, usually kept track of with a cookie or token.
  • Token: a piece of data, often random, that a server uses to recognise you or to authorise an action.
  • Unicode: the standard that assigns a number to every character in every writing system, including invisible and unusual characters.
  • URL encoding: writing special or invisible characters as a percent sign followed by two hexadecimal digits, such as %0f.

More by Priyanshu Shakya

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.