How I Locked a User Out of Their Own Account — My First Bug Bou
The application lacked uniqueness validation on email and phone numbers, allowing two accounts to share the same identifiers. Because the login query fetched the first matching record, an attacker who registered first could change their profile to the victim's email and phone, locking the victim out and logging in as them.
So this is my first ever bug bounty writeup. And honestly, I didn’t expect my first real finding to be this interesting.
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 the database lacked a UNIQUE constraint on email and phone, and the authentication query used LIMIT 1, which returned the first inserted row, so the attacker's older record always matched.
Impact
The attacker could take over the victim's account and permanently lock the victim out, even preventing password reset; the text notes the attack only works if the attacker registers first.
What the attacker needed
Attacker registers before victim; attacker has an account; victim has an account
The fix
The application should add a UNIQUE constraint on email and phone, reject conflicting updates, require verification when changing contact details, handle ambiguous auth queries, and return generic error messages.
How it was found
- Attacker registers an account with their own email and phone.
- Victim registers an account with their own email and phone.
- Attacker logs in and updates their profile email and phone to the victim's details.
- Victim tries to log in with their own email and password but fails because the system checks the attacker's password.
- Attacker logs in with the victim's email and the attacker's password, succeeding.
- Victim tries password recovery but gets an error about multiple accounts.
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.
This is a business logic flaw where the system allowed two accounts to have the same email and phone number. When logging in, the system always picked the first account it found, so an attacker could take over a victim's account by copying their details. The victim then could not log in or reset their password.
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.