Skip to content
Account takeover Write-up Intermediate

Pre Account Takeover By Reversing A Weak Email Verification Token Algorithm

The email verification token was built from two sequential numbers, so an attacker could create accounts with their own email before and after the victim's email to narrow the possible token values and brute-force the correct one. This allowed the attacker to verify any email address and pre-register an account, leading to account takeover when the real owner later signed in with a linked social login.

Craig Hays Follow

Published on infosecwriteups.com

I spoofed access to other people’s email in order to pre-steal user accounts before they are first registered. Here’s how I did it.

Craig Hays, on infosecwriteups.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.

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

The email verification token was generated from two sequential numeric values, making it predictable and brute-forceable within a narrow range.

Impact

An attacker could verify any email address and pre-register an account, leading to account takeover when the real owner later signed in with a linked social login; the attack also inadvertently verified other users' email addresses within the guessed range.

What the attacker needed

Ability to create accounts; victim has not yet registered; victim later uses social login

The fix

The token should be replaced with a long, random string instead of sequential numbers.

How it was found

  1. Create an account with an email address you own.
  2. Create an account with the email address you don't own but want to validate.
  3. Create an account with another email address you own.
  4. Extract the P1 and P2 parameters from the two verification links you received to set upper and lower bounds.
  5. Brute-force the possible P1 and P2 combinations within those bounds by sending GET requests to the verification URL.
  6. The correct token verifies the target email address.

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.

When you sign up, the app sends a link to your email to prove it's yours. This app made that link using two numbers that always went up, so by signing up with your own email just before and after the victim's, you could guess the victim's link. That let the attacker claim the victim's email before they even signed up.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

More by Craig Hays

View all

3 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.