The Ghost Email: How I Took Over Any Account With a Missing Check
The 2FA setup endpoint accepted an arbitrary email address without verifying it belonged to the logged-in user, allowing an attacker to enable 2FA on any account using their own email. An attacker could register with a victim's email (no verification required), enable 2FA tied to the attacker's email, and lock the victim out of their account.
Hacking
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 web application that lets people register with only an email address and a password. There is no email verification step at signup: once you submit the form, you are in immediately.
The same application offers several ways to enable two-factor authentication (2FA) on an account. One of those methods is email based: the application sends a one-time password (OTP) to an email address, and once the feature is enabled the user is asked for that OTP on every login.
The gap between those two behaviours, no verification at signup but verification for 2FA, is where the whole problem lives.

Setup
The write-up does not describe any special tooling, versions or infrastructure. The only precondition that matters is a normal account on the application, because every request below is authenticated with the attacker's own bearer token. The attacker also needs an email inbox they control, to receive the OTP that the server sends.
Finding it
While exploring the 2FA setup flow, the researcher noticed two endpoints:
POST /api/v2/auth/two_step/sendPOST /api/v2/auth/two_step/enable
The first sends an OTP to an email address. The second enables 2FA using that OTP. That raised a simple question: what happens if the server is asked to send an OTP to an email address that does not belong to the authenticated account?
Exploitation
Step 1: ask the server to send an OTP to an arbitrary address
The request was sent with the attacker's own token:
POST /api/v2/auth/two_step/sendAuthorization: Bearer <my_token>{ "email": "[redacted]"}
The server accepted it and reported that the OTP had been sent. It did not check whether [redacted] belonged to the authenticated account, and it did not check whether the address was registered at all. It simply sent the code.
Step 2: enable 2FA with the OTP from the attacker's inbox
The attacker collected the OTP from their own inbox and called the enable endpoint:
POST /api/v2/auth/two_step/enableAuthorization: Bearer <my_token>{ "email": "[redacted]", "otp": "123456"}
The result was that 2FA was enabled on the victim's account, but tied to the attacker's email address.
Step 3: lock the victim out
Because the application does not verify email addresses during registration, an attacker can register an account using the victim's email address with no confirmation needed. Once inside that account, the attacker enables 2FA using their own email address, as above.
When the real victim tries to log in with their email and password, the application asks for an OTP. That OTP does not go to the victim's inbox, it goes to the attacker. A password reset does not help either: the flow eventually demands the 2FA code, and again only the attacker receives it.
The outcome is a full account lockout. The victim owns the email address, but the attacker owns the second factor.
Root cause
The send endpoint accepts an email address from the request body and dispatches an OTP to it without binding that address to the authenticated user. The enable endpoint then accepts the same address together with the OTP and enables 2FA against it. Neither endpoint appears to check ownership of the address, and the send endpoint does not even require the address to be registered.
Registration without email verification is what makes the attack practical: it lets an attacker create an account under someone else's address in the first place. The 2FA flow then trusts an address supplied by the client rather than deriving it from the account record, so the second factor can be pointed at the attacker's inbox. The report does not describe any server-side control that would have caught this.
Impact
An attacker can lock any account on the application out of its own login, under the conditions described: registration does not verify email ownership, and the 2FA email flow accepts an arbitrary address. The victim is locked out completely, including through the password reset path, because the second factor stays with the attacker.
Fix
The fix implied by the flow is to stop trusting a client-supplied address: derive the email for both send and enable from the authenticated account, and require the address to be verified before it can be used as a second factor. Verifying email ownership at registration would remove the precondition that lets an attacker claim someone else's address.
Variants to test
- Send an OTP to an address that is not registered at all. A positive result is a success response and a delivered code, which shows the endpoint does not validate the address against any account.
- Send an OTP to a second address you control while authenticated as a different account, then enable 2FA with it. A positive result is 2FA enabled on the first account but tied to the second address.
- Try the same pattern with an authenticator app instead of email. The report notes the same impact is achievable if the application lets you set up 2FA with an app such as Google Authenticator without requiring email verification. A positive result is a second factor enrolled on an account whose email was never confirmed.
- Walk the password reset flow after enabling 2FA on someone else's address. A positive result is a reset that cannot be completed without the OTP held by the attacker, confirming the lockout survives recovery.
What happened, in plain words
A website let people create an account with just an email address and a password. Nobody checked that the email address really belonged to the person signing up. You typed it in, you were in.
The same website also offered two-factor authentication, or 2FA. 2FA is a second proof of who you are at login, on top of your password. Think of a bank safe that needs both a key and a code: even someone who steals your key cannot open it without the code. One of the ways this site offered 2FA was by email: it sent a short numeric code, called a one-time password (OTP), to an email address, and from then on asked for that code at every login.
The researcher found that the part of the site that sends the OTP did not check whose email address it was sending to. It would send a code to any address you named, even one that was not registered on the site at all. The part that switches 2FA on then accepted that same address and the code.
Put those two things together and you get a lockout. An attacker signs up using the victim's email address, because signup never checks it. The attacker then turns on 2FA for that account, pointing it at the attacker's own inbox. The real victim still knows their password, but every login now asks for a code that only the attacker receives. Even a password reset runs into the same wall.

The target
The application is a web app: a program you use through a browser. It lets you register with an email address and a password, and there is no verification step at signup. Verification would normally mean the site emails you a link or a code and only activates the account once you click or type it. Here, submitting the form is enough.
The app offers several ways to enable 2FA. One of them is email based. You ask the site to send an OTP to an email address, you receive it, and you type it back in to switch the feature on. After that, every login asks for the OTP as well as the password.
The whole problem sits in the gap between those two behaviours: no verification when you sign up, but verification when you set up 2FA.
Setting up
The write-up does not describe any special tools, software versions or infrastructure. Two things are enough:
- A normal account on the application. Every request below is sent while logged in as the attacker, using the attacker's own token.
- An email inbox the attacker controls, to receive the OTP the server sends.
A token, in this context, is a long string the server gives you when you log in. Your browser sends it with every request so the server knows who you are, a bit like a wristband at an event: you show it at the door and you are let back in without proving who you are again. The write-up calls it a bearer token, meaning whoever carries it is treated as the account holder.
Finding it
While exploring the 2FA setup flow, the researcher noticed two endpoints:
POST /api/v2/auth/two_step/sendPOST /api/v2/auth/two_step/enable
An endpoint is one specific address on a server that accepts a particular kind of request, like a service counter in a large building: each counter does one job. An API is the collection of those counters, the way programs talk to each other over the network instead of showing a web page.
Line by line:
POSTis the type of request. It means "here is some data, please act on it", as opposed toGET, which means "please show me something"./api/v2/auth/two_step/sendis the path of the first endpoint. Reading it left to right: it is part of the API, version 2, under authentication, related to the two-step (2FA) feature, and its job is to send./api/v2/auth/two_step/enableis the second endpoint, whose job is to enable the feature.
The first endpoint sends an OTP to an email address. The second switches 2FA on using that OTP. That raised a simple question: what happens if the server is asked to send an OTP to an email address that does not belong to the logged-in account?
Exploitation
Step 1: ask the server to send an OTP to any address
The request was sent with the attacker's own token:
POST /api/v2/auth/two_step/sendAuthorization: Bearer <my_token>{ "email": "[redacted]"}
Line by line:
POST /api/v2/auth/two_step/sendis the request line: the method and the endpoint being called.Authorization: Bearer <my_token>is a header. Headers are small labelled lines attached to a request that carry extra information, like the address block on an envelope. This one carries the token.Beareris the scheme name, and<my_token>stands for the attacker's real token, which is not shown.{ "email": "[redacted]" }is the body, the actual data sent along with the request. It is written in JSON, a common text format for structured data: curly braces hold an object, and"email"is the field name with the address as its value.[redacted]is a placeholder address standing for one the attacker controls.
The server accepted it and said the OTP had been sent. It did not check whether [redacted] belonged to the logged-in account, and it did not check whether the address was registered at all. It just sent the code.
That is the missing check. The server took the address from the request, as supplied by whoever was calling, instead of looking up the address stored on the account.
Step 2: enable 2FA with the OTP from the attacker's inbox
The attacker collected the OTP from their own inbox and called the enable endpoint:
POST /api/v2/auth/two_step/enableAuthorization: Bearer <my_token>{ "email": "[redacted]", "otp": "123456"}
Line by line:
POST /api/v2/auth/two_step/enablecalls the second endpoint, the one that switches 2FA on.Authorization: Bearer <my_token>again identifies the attacker's own account.- The body now has two fields:
"email"is the same attacker-controlled address, and"otp"is the code that arrived in the attacker's inbox.123456is a placeholder for that code.
The result: 2FA was enabled on the victim's account, but tied to the attacker's email address. The account now has a second factor, and that second factor lives in the attacker's mailbox.
Step 3: lock the victim out
Because the application does not verify email addresses during registration, an attacker can register an account using the victim's email address with no confirmation needed. Once inside that account, the attacker enables 2FA using their own email address, as above.
When the real victim tries to log in with their email and password, the application asks for an OTP. That OTP does not go to the victim's inbox, it goes to the attacker. A password reset does not help either: the flow eventually demands the 2FA code, and again only the attacker receives it.
The outcome is a full account lockout. The victim owns the email address, but the attacker owns the second factor.
Why it works
The send endpoint takes an email address from the request body and sends an OTP to it without tying that address to the logged-in user. The enable endpoint then takes the same address together with the OTP and turns on 2FA against it. Neither endpoint appears to check who owns the address, and send does not even require the address to be registered.
Registration without email verification is what makes the attack practical: it lets an attacker create an account under someone else's address in the first place. The 2FA flow then trusts an address supplied by the client rather than taking it from the account record, so the second factor can be pointed at the attacker's inbox. The report does not describe any server-side control that would have caught this.
Impact
An attacker can lock any account on the application out of its own login, under the conditions described: registration does not verify email ownership, and the 2FA email flow accepts any address. The victim is locked out completely, including through the password reset path, because the second factor stays with the attacker.
Fix
The fix implied by the flow is to stop trusting an address supplied by the client: take the email for both send and enable from the logged-in account, and require the address to be verified before it can be used as a second factor. Verifying email ownership at registration would remove the precondition that lets an attacker claim someone else's address.
Variants to test
- Send an OTP to an address that is not registered at all. A positive result is a success response and a delivered code, which shows the endpoint does not validate the address against any account.
- Send an OTP to a second address you control while logged in as a different account, then enable 2FA with it. A positive result is 2FA enabled on the first account but tied to the second address.
- Try the same pattern with an authenticator app instead of email. The report notes the same impact is achievable if the application lets you set up 2FA with an app such as Google Authenticator without requiring email verification. A positive result is a second factor enrolled on an account whose email was never confirmed.
- Walk the password reset flow after enabling 2FA on someone else's address. A positive result is a reset that cannot be completed without the OTP held by the attacker, confirming the lockout survives recovery.
Glossary
- 2FA (two-factor authentication): a login that needs two separate proofs, usually a password plus a code, so a stolen password alone is not enough.
- API: the set of endpoints a program exposes so other programs can talk to it over the network.
- Authenticator app: a phone app that generates login codes, used as an alternative second factor to email.
- Bearer token: a string sent with requests that identifies the account; whoever holds it is treated as that account.
- Body: the part of a request that carries the actual data, such as an email address or a code.
- Client: the program making the request, here the attacker's tooling or browser, as opposed to the server that answers.
- Endpoint: one specific address on a server that accepts a particular kind of request and performs one job.
- Header: a labelled line attached to a request carrying extra information, such as the token that identifies the caller.
- JSON: a text format for structured data, using curly braces for objects and quoted names for fields.
- OTP (one-time password): a short code valid for a single use, sent to an email address or generated by an app.
- Password reset flow: the sequence of steps a site walks you through to set a new password when you have forgotten the old one.
- POST: a request type meaning "here is data, act on it", as opposed to fetching a page.
- Second factor: the additional proof required at login beyond the password.
- Server: the computer that runs the application and answers requests.
- Signup verification: the step where a site confirms you really control the email address you registered with.
- Token: see bearer token.
- Web app: a program you use through a browser rather than installing on your computer.