The Race That Confirmed the Wrong Email
*AI disclosure: This article was drafted with AI assistance as an analytical case study of a public disclosure. It is not my own discovery.*


AI-generated illustration
A 2016 Facebook disclosure shows why a confirmation secret must bind to one contact value under a lock
AI disclosure: This article was drafted with AI assistance as an analytical case study of a public disclosure. It is not my own discovery.
Email confirmation is supposed to prove control of a single address. Josip Franjković reported that a race in Facebook’s registration contact-point flow could make a confirmation message delivered to an address he controlled complete a different, unused address he did not. Facebook fixed the issue on 10 May 2016. The write-up does not state a bounty for this specific report.
Disclaimer: * Educational and defensive use only. Patched in 2016. This article intentionally omits reproduction details.*
Vulnerability Overview
- Type: Race condition in contact-point confirmation
- CWE (analytical mapping, not from the source): CWE-362, CWE-367
- CVE: Not stated in the disclosure
- Severity/CVSS: Not reported. Bounty: not stated in the disclosure
What Happened (high level)
The researcher first noticed unexpected confirmation behavior while testing Facebook’s mobile registration flow in February, then produced a reliable demonstration on 20 April. Concurrent updates to an account’s pending contact point were not serialized against each other. A confirmation artifact generated during that overlap could be delivered for one address and applied to another.
He described the result simply: an unused email address could be marked confirmed on an account without the researcher receiving mail at that unused address. Facebook shipped a fix on 10 May 2016. This article does not reconstruct the interleaving.
The same post collects other race-condition cases; those are separate bugs.
Impact
Confirming an email the account holder does not control undermines recovery, identity proof, and any downstream check that treats a confirmed address as a trusted channel. An unused address that becomes confirmed can later be used to reset access or to impersonate ownership of that identity.
Remediation & Defense-in-Depth (my own analysis)
1. Bind each confirmation secret to one exact contact value. Store the normalized address, the account, and the purpose on the token itself. Verification must look up that triple, not “the latest pending email on this account.”
2. Serialize writes to pending identity fields. Take a row lock on the account or on the token before changing a contact point or consuming a secret. Two overlapping updates should not retarget an in-flight token.
3. Persist counters and consumption, then commit before raising. A check-then-act gap lets parallel requests slip through. Raising inside a transaction can roll back the attempt counter. Decide under the lock, commit, then raise.
# Pseudocode: bind, lock, persist the attempt, commit, THEN raise
def confirm_contact(account_id, submitted_contact, submitted_code):
contact = normalize(submitted_contact)
with db.transaction():
token = (db.query(Token)
.filter_by(account_id=account_id,
purpose="confirm_email",
contact=contact)
.with_for_update()
.one_or_none())
verdict = "invalid"
if token and not token.used and not token.expired():
token.attempts += 1
ok = hmac.compare_digest(token.code_hash,
hash_code(submitted_code))
if ok:
acct = (db.query(Account)
.filter_by(id=account_id)
.with_for_update()
.one())
acct.email = token.contact # only the bound value
token.used = True
verdict = "ok"
if verdict != "ok":
raise InvalidConfirmation()
4. Expire and notify. Give secrets a short lifetime, consume them on success or lockout, and tell the user when a contact point is added or confirmed.
5. Test the overlap directly. A concurrency test should submit two distinct contact values at the same time and assert that each secret confirms only itself.
Key Takeaways
- A confirmation code that is not bound to one contact value is a race waiting to happen.
- Commit the attempt counter and the consumption flag before you raise an error.
- Overlapping writes to identity fields need tests, not just code review.
Credit & Sources
Research by Josip Franjković: Race conditions on the web (12 July 2016). Facts about this Facebook case come from that post; analysis, code and remediation are original suggestions.
First published by Adam Hale on Medium.
Sources
Share
Reactions
Comments
Your name and comment appear on this article for other readers.
Corrections and tips:[email protected]

