0 click Facebook Account Takeover and Two-Factor Authentication Bypass
A GraphQL mutation allowed confirming a new email or phone number without proving ownership, and a mobile recovery flow parameter could be manipulated to send a victim's OTP to the attacker's phone, enabling account takeover. The same email-confirmation flaw could also disable two-factor authentication on another account.
Published on medium.com
In September I decided to search in recovery flow processes in web and mobile Facebook application.
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
This write-up covers two related issues in Facebook's account recovery and contact-point confirmation flows, found in September 2022: a GraphQL mutation that confirms a new email or phone number on an account without proving ownership of it, and a flaw in the Android password recovery flow that let a recovery code issued for one account be used to reset the password of another. The first issue was later extended into a two-factor authentication bypass.
The researcher began by searching the recovery flow at https://www.facebook.com/recover/account/. The Android application implements the same flow against the b-graph.facebook.com GraphQL endpoint.
Setup
The researcher worked against the web recovery page and the Android Facebook application, using Burp Suite to intercept and modify requests. The flow involved the attacker's own CUID and a victim account whose phone number is known. The report does not give application versions or device details.
Finding it
While going through the recovery flow on the web, the researcher found a GraphQL mutation that confirms a new email address on an account without any proof of ownership over that address. The request carries the actor id, the contact point to confirm, and a CUID, and the server accepts it as a confirmation.

The screenshot shows the recovery page at https://www.facebook.com/recover/account/ where the search began.
The mutation was submitted as a report and triaged. The researcher then moved to the Android application and the password recovery flow that uses a phone number.
Exploitation
Step 1: Confirm an email without ownership
The GraphQL mutation below confirms an arbitrary contact point. The contactPoint value is the email to be confirmed, actor_id identifies the acting account and cuid is the encrypted user id.
&variables={"input":{"client_mutation_id":"7","actor_id":"<actorid>","contactPoint":"<[redacted]>","cuid":"<cuid>"}}&server_timestamps=true&doc_id=7719778831396560
The important part is contactPoint: it is attacker-controlled and the mutation does not require the caller to demonstrate control of that address.
Step 2: Start the Android password recovery flow
The researcher switched to the Android application and went through the password recovery flow using a phone number. The first request is:
POST /recover_accounts HTTP/2
Host: b-graph.facebook.com
q=0XXXXXX
The response body contains several boolean parameters. Using Burp Suite interception, the researcher flipped them from false to true one at a time, starting with the last one:
"is_shared_phone_no_signal":false
Step 3: Observe the follow-up request
With is_shared_phone_no_signal set to true, the next request in the flow carries a shared_phone_number parameter in its body:
POST /cuid_[CUID]/recovery_codes HTTP/2
Host: b-graph.facebook.com
contactpoints=%5B%22%22%5D&device_id=1e4dfed2–6d97–4500-b73a-6f6a64699d27&src=&use_google_sms_retriever_content=true&client_rate_limiting_rejected_nonce=false&client_has_permission=false&shared_phone_number=0XXXXXXXX&password_reset_cp_nonce_recovery_flow=shared_phone_no_signal_account_recovery&should_use_flash_call=false&auto_conf_flow_type=&family_device_id=61e39cf8-ee26–4070-b14d-1007da3e5a18&locale=en_US&client_country_code=US&fb_api_req_friendly_name=accountRecoverySendConfirmationCode&fb_api_caller_class=SendConfirmationCodeHelper&[redacted]&[redacted]&access_token=350685531728%[redacted]
The shared_phone_number value is the phone number supplied by the client.
Step 4: Receive the OTP and change the CUID
The researcher received an 8 digit OTP code. He then changed the CUID in the path to another value, obtained from a second recover_accounts request:
POST /recover_accounts HTTP/2
Host: b-graph.facebook.com
q=06XXXXX
The same 8 digit OTP arrived, but on the second phone number. Testing with a different phone number belonging to another account produced the same code again, without modifying the shared_phone_number value.
Step 5: Reset the victim's password
The flow works as follows:
- Put the victim's phone number in
shared_phone_number. - Use the attacker's own CUID (the encrypted user id).
- Receive an 8 digit OTP that allows changing the password of the victim's account.
The password change is then submitted against the victim's CUID:
POST /cuid_[cuid-victim] HTTP/2
Host: b-graph.facebook.com
code=[8 digit OTP]&new_password=[password]
The report was triaged on the Friday and fixed on the Saturday.
Step 6: Extend the email confirmation bug to 2FA bypass
While the account takeover report was being investigated, the researcher returned to the email confirmation bug and tried confirming a phone number on another account using the same mutation:
&variables={"input":{"client_mutation_id":"7","actor_id":"<actorid>","contactPoint":"0XXXXXX","cuid":"<cuid>"}}&server_timestamps=true&doc_id=7719778831396560
He used the mutation while connected to the other account and received a notification that his phone was confirmed on that account. The unexpected result was that two-factor authentication was disabled on his account. This additional impact was sent to the Meta team.
Root cause
Two separate design mistakes are visible in the report.
In the confirmation mutation, the server accepts a contactPoint supplied by the client and marks it confirmed without any verification that the caller controls that address or number. The actor_id and cuid are both client-supplied, so the mutation can be pointed at a contact point the caller does not own.
In the Android recovery flow, the code received was the same regardless of the CUID used, and the password change was submitted against the victim's CUID. The two are not bound together: the code issued for one phone number is accepted for a different account's CUID. Setting is_shared_phone_no_signal to true made a shared_phone_number parameter appear in the next request. The report does not describe the server-side check that should have tied the code to the account.
For the 2FA bypass, confirming a phone number through the mutation appears to have side effects on the account's authentication settings, disabling two-factor authentication.
Impact
An attacker who knows a victim's phone number can take over the account: request a recovery code with the victim's number in shared_phone_number and their own CUID, receive the OTP on their own phone, then submit it against the victim's CUID with a new password. The researcher initially thought the account takeover was limited to accounts not protected by 2FA, but confirming a phone number through the mutation disabled 2FA on his account.
The email confirmation issue on its own lets an attacker confirm an arbitrary email or phone number on an account without proving ownership.
Meta's team found no evidence of abuse after a thorough investigation and internal follow-up.
Fix
The account takeover was fixed on 17 September 2022. The additional 2FA impact was confirmed on 24 September 2022 and fixed on 28 September 2022.
Timeline
| Date | Event |
|---|---|
| 13 September 2022 | Email confirmation report sent |
| 15 September 2022 | Email confirmation report triaged |
| 16 September 2022 | Account takeover report sent and triaged |
| 17 September 2022 | Account takeover fixed |
| 19 September 2022 | Bounty of 3000 USD rewarded before the fix |
| 22 September 2022 | Additional 2FA impact sent |
| 24 September 2022 | 2FA impact confirmed |
| 28 September 2022 | 2FA impact fixed |
| 15 December 2022 | Bounties rewarded for the account takeover and 2FA issues |
Variants to test
- Client-controlled contact points in confirmation mutations. Look for GraphQL mutations that take a
contactPointor similar field alongside an actor or user id. A positive result is a confirmation notification or state change on an address or number you do not control. - Recovery codes not bound to the account. In any recovery flow, request a code for your own number and then redeem it against a different account identifier in the path or body. A positive result is a code issued for one identity being accepted for another.
- Client-set boolean flags that unlock parameters. Flip boolean fields in recovery responses from
falsetotrueand watch for new parameters in subsequent requests, as withis_shared_phone_no_signalandshared_phone_number. A positive result is a new parameter that the server honours. - Authentication settings changed by contact-point confirmation. Confirm a phone number or email on an account and check whether 2FA or other security settings change. A positive result is a security setting being disabled as a side effect of confirmation.
What happened, in plain words
In September 2022, a security researcher found two related problems in how Facebook lets people recover a lost account. Both problems were in the same general area: the steps you go through when you have forgotten your password and need to prove the account is yours.
The first problem was that a GraphQL mutation would mark a new email address as confirmed on an account without any proof that the sender owned that address. The second problem was in the Android phone app: a recovery code that was supposed to be sent to one phone number could be used to reset the password of a completely different account. Later, the researcher found that the same confirmation request could also switch off two-factor authentication on an account.
To follow this, you need a few ideas explained from zero.
What an account recovery flow is. When you forget your password, a website cannot simply believe you are who you say you are. It asks you to prove it, usually by sending a short code to your email address or phone number. You type the code back in, and only then are you allowed to set a new password. This whole sequence of pages and requests is called the recovery flow. It is a chain of trust: each step is supposed to check the step before it.
What a request is. Your browser or phone app is constantly sending small messages to Facebook's computers and getting answers back. Each message is a request. When you fill in a form and press a button, your browser packages up what you typed and sends it. The reply is called the response.
What an API is. Think of a restaurant. The dining room (the website or app) is what you see. The kitchen (Facebook's servers) does the actual work. The waiter who carries your order to the kitchen and brings the food back is the API. Apps and websites do not talk to the kitchen directly; they send orders through the waiter. Facebook's waiter here is called GraphQL, which is simply a way of formatting those orders so the kitchen knows exactly what is being asked for.
What a parameter is. A parameter is one named piece of information inside a request, like a line on an order form: phone_number=..., code=..., new_password=.... Changing a parameter changes what you are asking for.
What a token or session is. After you log in, the server gives your browser or app a small pass, so it does not have to ask for your password on every single request. That pass is sent along with each request. If someone else gets hold of your pass, they can act as you.
What a CUID is. The CUID is an encrypted form of a Facebook user ID. If a request says "reset the password for CUID X", the server is supposed to make sure the person sending it has proved they own account X.
What an OTP is. A one-time password: the short numeric code sent by SMS or email during recovery. It is meant to be usable once, for one purpose, by one person.
What two-factor authentication (2FA) is. A second lock on the door. Even if someone steals your password, they still need a second proof, usually a code from your phone, to get in. If 2FA can be switched off without your knowledge, the second lock is gone.
What Burp Suite is. A tool that sits between your browser or phone and the server and lets you pause each request, look at it, change it, and send it on. It is like intercepting a letter, editing it, and putting it back in the envelope. The researcher used it to flip values inside requests.
What a vulnerability class means. Security people group similar mistakes under names. "Authentication bypass" means getting past a check that was supposed to stop you. "Account takeover" means getting control of someone else's account. "2FA bypass" means getting around the second lock. This report involves all three.
Now, step by step, here is what the researcher did.
Finding it
The researcher started by poking around the standard recovery page on the Facebook website, the one you reach when you click "forgot password".

The screenshot shows the recovery page at https://www.facebook.com/recover/account/, which is where the search began.
While going through that flow, he found a GraphQL request (an order sent to the kitchen) that would confirm a new email address on an account without any proof that the sender owned that address. In plain terms: the waiter accepted an order saying "mark this email as confirmed" and never checked whether the person placing the order actually had access to that email inbox.
The request looked like this:
&variables={"input":{"client_mutation_id":"7","actor_id":"<actorid>","contactPoint":"<[redacted]>","cuid":"<cuid>"}}&server_timestamps=true&doc_id=7719778831396560
Line by line, in plain words:
&variables=starts the part of the request that carries the actual data, the filled-in order form."input"is the section holding the details of what is being asked."client_mutation_id":"7"is a label the client attaches so it can match the reply to the request. It is bookkeeping, not a security check."contactPoint":"<[redacted]>"is the email address to be confirmed. This is the dangerous part: it is chosen by whoever sends the request, and the server does not check that they control it."cuid":"<cuid>"is the encrypted user ID of the account the confirmation is applied to.
Why this matters: a confirmation is supposed to mean "we checked, and this address belongs to this person". Here, the address was simply whatever the sender typed, and the server marked it confirmed anyway.
The researcher wrote this up and sent it to Facebook's security team, who triaged it. Triaged means the team looked at the report and accepted it as a real issue worth investigating, rather than dismissing it as a mistake or a duplicate.
He then moved to the Android phone app and the password recovery flow that uses a phone number.
Exploitation
Step 1: Confirm an email without ownership
This is the same request as above, and it is the first building block. The key field is contactPoint: it is under the sender's control, and the request does not require the sender to show they can receive mail at that address. The actor_id and cuid are also supplied by the client, so the request can be pointed at a contact point the sender does not own.
Why take this step: the researcher wanted to see whether the server would accept a confirmation with no proof at all. It did.
Step 2: Start the Android password recovery flow
He switched to the Facebook app on Android and went through the "forgot password" flow using a phone number. The first request in that flow is:
POST /recover_accounts HTTP/2
Host: b-graph.facebook.com
q=0XXXXXX
Line by line:
POST /recover_accounts HTTP/2means "send data to the address/recover_accountsusing version 2 of the HTTP protocol". POST is the kind of request used when you are submitting something, as opposed to just asking for a page.Host: b-graph.facebook.comsays which server the request is for.- The blank line separates the headers (the envelope details) from the body (the contents).
q=0XXXXXXis the body of the request.
Why take this step: this is simply the normal first move of the recovery flow. The researcher wanted to see what the server sent back, because the reply is where the next request's shape is decided.
The response body contained several true/false parameters. Using Burp Suite to intercept, he flipped them from false to true one at a time, starting with the last one:
"is_shared_phone_no_signal":false
Line by line:
"is_shared_phone_no_signal"is the name of a setting; the report does not explain what it means beyond its effect.:falseis its current value. A true/false value is called a boolean.
Why take this step: the reply told him which switches existed. Flipping them one by one is a systematic way to find out which switch changes the server's behaviour. He started with the last one simply as a starting point.
Step 3: Observe the follow-up request
With is_shared_phone_no_signal set to true, the next request in the flow carried a new parameter, shared_phone_number, in its body:
POST /cuid_[CUID]/recovery_codes HTTP/2
Host: b-graph.facebook.com
contactpoints=%5B%22%22%5D&device_id=1e4dfed2–6d97–4500-b73a-6f6a64699d27&src=&use_google_sms_retriever_content=true&client_rate_limiting_rejected_nonce=false&client_has_permission=false&shared_phone_number=0XXXXXXXX&password_reset_cp_nonce_recovery_flow=shared_phone_no_signal_account_recovery&should_use_flash_call=false&auto_conf_flow_type=&family_device_id=61e39cf8-ee26–4070-b14d-1007da3e5a18&locale=en_US&client_country_code=US&fb_api_req_friendly_name=accountRecoverySendConfirmationCode&fb_api_caller_class=SendConfirmationCodeHelper&[redacted]&[redacted]&access_token=350685531728%[redacted]
Line by line, in plain words:
POST /cuid_[CUID]/recovery_codes HTTP/2sends data to the recovery-codes address, whose path containscuid_[CUID].Host: b-graph.facebook.comis the same mobile GraphQL server as before.contactpoints=%5B%22%22%5Dis a list of contact points;%5B,%5Dand%22are the encoded forms of[,]and a double quote, so it decodes to[""].device_id=...identifies the phone or device making the request.src=is empty.shared_phone_number=0XXXXXXXXis the phone number supplied by the client. This is the parameter that appeared only after the switch was flipped.auto_conf_flow_type=is empty.
Why take this step: the researcher wanted to see what the switch unlocked. It unlocked a way to tell the server a phone number directly, rather than letting the server decide which number to use.
Step 4: Receive the OTP and change the CUID
He received an 8 digit OTP code. He then changed the CUID in the path to another value, which he obtained from a second recover_accounts request:
POST /recover_accounts HTTP/2
Host: b-graph.facebook.com
q=06XXXXX
Line by line:
POST /recover_accounts HTTP/2is the same starting request as in Step 2.Host: b-graph.facebook.comis the same server.q=06XXXXXis the body of the secondrecover_accountsrequest.
Why take this step: he wanted to see whether the code was tied to the account it was requested for, or only to the phone number. Changing the CUID in the path, while leaving the phone number alone, is the cleanest way to test that.
The same 8 digit OTP arrived, but on the second phone number. Testing with a different phone number belonging to another account produced the same code again, without modifying the shared_phone_number value.
In plain terms: the same code arrived regardless of which CUID was used, and the password change was submitted against the victim's CUID. The code was like a claim ticket that could be handed in at a different cloakroom.
Step 5: Reset the victim's password
The flow works as follows:
- Put the victim's phone number in
shared_phone_number. - Use the attacker's own CUID (the encrypted user id).
- Receive an 8 digit OTP that allows changing the password of the victim's account.
The password change is then submitted against the victim's CUID:
POST /cuid_[cuid-victim] HTTP/2
Host: b-graph.facebook.com
code=[8 digit OTP]&new_password=[password]
Line by line:
POST /cuid_[cuid-victim] HTTP/2sends data to the address for the victim's account, named by the victim's CUID in the path.code=[8 digit OTP]is the code that was received on the attacker's phone.new_password=[password]is the password the attacker wants to set.
The report does not describe the server-side check that should have tied the code to the account.
The report was triaged on the Friday and fixed on the Saturday.
Step 6: Extend the email confirmation bug to 2FA bypass
While the account takeover report was being investigated, the researcher went back to the email confirmation bug and tried confirming a phone number on another account using the same request:
&variables={"input":{"client_mutation_id":"7","actor_id":"<actorid>","contactPoint":"0XXXXXX","cuid":"<cuid>"}}&server_timestamps=true&doc_id=7719778831396560
Line by line:
&variables=begins the data section, as before."input"holds the details."client_mutation_id":"7"is the bookkeeping label."contactPoint":"0XXXXXX"is now a phone number instead of an email address. The Xs stand for digits removed before publishing."cuid":"<cuid>"is the account the confirmation is applied to.
He sent this request while logged in to the other account, and received a notification that his phone was confirmed on that account. The unexpected part was that two-factor authentication was switched off on his account. He sent this additional impact to the Meta team.
Why this matters: the confirmation request was not just marking an address as confirmed. It was also changing the account's security settings, and the change made the account less protected, not more.
Root cause
Two separate design mistakes are visible in the report.
In the confirmation request, the server accepts a contactPoint supplied by the client and marks it confirmed without any verification that the caller controls that address or number. The actor_id and cuid are both client-supplied, so the request can be pointed at a contact point the caller does not own.
In the Android recovery flow, the code received was the same regardless of the CUID used, and the password change was submitted against the victim's CUID. The two are not bound together: the code issued for one phone number is accepted for a different account's CUID. Setting is_shared_phone_no_signal to true made a shared_phone_number parameter appear in the next request.
For the 2FA bypass, confirming a phone number through the request appears to have side effects on the account's authentication settings, disabling two-factor authentication.
Impact
An attacker who knows a victim's phone number can take over the account: request a recovery code with the victim's number in shared_phone_number and their own CUID, receive the OTP on their own phone, then submit it against the victim's CUID with a new password. The researcher initially thought the account takeover was limited to accounts not protected by 2FA, but confirming a phone number through the request disabled 2FA on his account.
The email confirmation issue on its own lets an attacker confirm an arbitrary email or phone number on an account without proving ownership.
Meta's team found no evidence of abuse after a thorough investigation and internal follow-up.
Fix
The account takeover was fixed on 17 September 2022. The additional 2FA impact was confirmed on 24 September 2022 and fixed on 28 September 2022.
Timeline
| Date | Event |
|---|---|
| 13 September 2022 | Email confirmation report sent |
| 15 September 2022 | Email confirmation report triaged |
| 16 September 2022 | Account takeover report sent and triaged |
| 17 September 2022 | Account takeover fixed |
| 19 September 2022 | Bounty of 3000 USD rewarded before the fix |
| 22 September 2022 | Additional 2FA impact sent |
| 24 September 2022 | 2FA impact confirmed |
| 28 September 2022 | 2FA impact fixed |
| 15 December 2022 | Bounties rewarded for the account takeover and 2FA issues |
Variants to test
- Client-controlled contact points in confirmation requests. Look for GraphQL requests that take a
contactPointor similar field alongside an actor or user id. A positive result is a confirmation notification or state change on an address or number you do not control. - Recovery codes not bound to the account. In any recovery flow, request a code for your own number and then redeem it against a different account identifier in the path or body. A positive result is a code issued for one identity being accepted for another.
- Client-set boolean flags that unlock parameters. Flip boolean fields in recovery responses from
falsetotrueand watch for new parameters in subsequent requests, as withis_shared_phone_no_signalandshared_phone_number. A positive result is a new parameter that the server honours. - Authentication settings changed by contact-point confirmation. Confirm a phone number or email on an account and check whether 2FA or other security settings change. A positive result is a security setting being disabled as a side effect of confirmation.
Glossary
-
Account takeover: gaining control of someone else's account, usually by obtaining their password or a way to reset it.
-
API: the agreed way for one piece of software to ask another for something, like a waiter carrying orders between the dining room and the kitchen.
-
Authentication bypass: getting past a check that was supposed to prove who you are.
-
Boolean: a value that is either true or false.
-
Burp Suite: a tool that sits between your browser or app and the server, letting you pause, inspect and change requests before they are sent.
-
Contact point: an email address or phone number attached to an account.
-
CUID: an encrypted form of a Facebook user ID, used in requests to say which account is meant.
-
Device id: an identifier for a particular phone or device.
-
GraphQL: a way of formatting requests to a server so it knows exactly which operation and which fields are wanted.
-
Header: the envelope part of a request, carrying details like which server it is for, separate from the body.
-
HTTP/2: version 2 of the protocol browsers and apps use to talk to web servers.
-
Mutation: in GraphQL, a request that changes something on the server, as opposed to one that only reads.
-
One-time password (OTP): a short code sent to you during login or recovery, meant to be used once.
-
Parameter: one named piece of information inside a request, like a line on a form.
-
Path: the part of a web address after the server name, saying which resource is meant.
-
POST: the kind of HTTP request used to submit data to a server.
-
Rate limiting: a limit on how many requests can be made in a period of time.
-
Recovery flow: the sequence of steps a site uses to let you prove you own an account and set a new password.
-
Request: a message your browser or app sends to a server asking it to do something.
-
Response: the server's reply to a request.
-
Session: the state of being logged in, usually represented by a credential sent with each request.
-
Token: a credential, like a pass, that proves who is making a request without sending a password each time.
-
Triaged: reviewed and accepted by a security team as a real issue worth investigating.
-
Two-factor authentication (2FA): a second proof of identity, usually a code from your phone, required in addition to your password.
-
Vulnerability class: a named group of similar security mistakes, such as authentication bypass or account takeover.