Skip to content
Account takeover Write-up Intermediate

How I Bypassed 2FA by Mutating My Profile Phone Number in Graphql

The GraphQL profile update endpoint accepted a pre-2FA authentication token and allowed the phone number used for OTP delivery to be changed. An attacker with valid credentials could set their own phone number, receive the OTP, and fully bypass 2FA to take over the account.

Mohamed Elmorsy Follow

Published on medium.com

How a simple phone number update in Graphql request compeletly bypassed 2fa protection and gave full account control.

Mohamed Elmorsy, 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.

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 GraphQL profile update endpoint did not require a fully authenticated session and allowed the phone number used for OTP delivery to be changed without additional verification.

Impact

2FA could be rendered entirely ineffective, allowing an attacker with valid credentials to take over the account and access sensitive business data without victim interaction.

What the attacker needed

Valid user credentials; 2FA enabled on the target account; attacker-controlled phone number

The fix

The GraphQL profile update endpoint should require a fully authenticated session and additional verification before allowing the phone number used for OTP delivery to be changed.

How it was found

  1. Enable 2FA on the account and log out.
  2. Log in and observe that 2FA prompts for a code.
  3. Capture the pre-2FA JWT issued before the second factor is completed.
  4. Send a GraphQL profile update request using that pre-2FA token to change the phone number to one under the attacker's control.
  5. Return to the 2FA page, request a new code, and receive it on the attacker-controlled phone.
  6. Enter the received code to complete login and bypass 2FA.

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.

Two-factor authentication (2FA) is a second check, like a code sent to your phone, after you enter your password. Here the app let someone change the phone number that receives that code before the second check was finished. So an attacker who knew the password could point the code at their own phone and get in.

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 Mohamed Elmorsy

View all

2 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.