Facebook email disclosure and account takeover
An endpoint for phone-call-based account recovery accepted a user identifier (CUID) and returned the associated user ID, allowing an attacker to determine which account an email or phone number belonged to. A second flaw in the same flow lacked rate limiting on the caller-ID parameter, enabling brute force to obtain a nonce and reset the victim's password.
Published on rikeshbaniyaaa.medium.com
I have a preference for apps over web when it comes to hunting, so in January I decided to dive deep into apk endpoints hoping to find something juicy.
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
Facebook and Messenger ship as Android apps, and the account recovery flow is one of the places where the mobile client talks to backend endpoints that are not exposed in the web UI. The feature in question is phone call recovery: instead of receiving an OTP by SMS, the user can choose to receive a phone call for account recovery. The report covers two related issues found in that flow: an email disclosure through the auth/flashcall_account_recovery endpoint, and an account takeover that became possible once the same endpoint turned out to have no rate limiting on the cli parameter.
Setup
The researcher prefers mobile apps over web for hunting, so in January the work started by downloading a number of Facebook and Messenger APKs of different versions. All endpoints were extracted with grep, sorted, and reviewed one by one. The analysis of the recovery flow itself was done by reading the smali files of the decompiled app.
Finding it
While going through the sorted endpoint list, one endpoint stood out:
POST auth/flashcall_account_recovery

The endpoint required three parameters:
cuid, encrypted_phone_numbers & cli
The cuid is described as an encrypted email or phone value that can be found easily. Supplying a victim's email to the account recovery endpoint returns the corresponding cuid:
POST /recover_accounts

Separately, while going through the normal Facebook password recovery flow, the researcher noticed that the endpoint responsible for sending the OTP code had a parameter named should_use_flash_call=false. With false, the user receives an OTP by SMS; with true, the user receives a phone call instead of the OTP for account recovery. The response to that request contained the required encrypted phone numbers.

The cli parameter was the unclear part. The only association that came to mind was "command line interface", and with no way to work out its meaning, the researcher supplied null instead.
Exploitation
Step 1: email disclosure via cuid
With cli set to null, the request to auth/flashcall_account_recovery returned the userID belonging to the user whose email had been supplied as the cuid. In other words, an attacker could supply anyone's email or phone as the cuid and, from the response, determine exactly who that email belonged to.

This was submitted quickly and was triaged and fixed within a day.
Step 2: understanding the flow
The researcher was curious about the endpoint because phone call recovery had never been used to reset a password, it was not present in the UI, and there was little information about the flow on Google or YouTube. Reading the smali files showed how the flow works:
- The user enters their email or phone.
- The user chooses the phone call recovery option.
- The user receives a phone call.
- The phone number that called is automatically supplied to the endpoint as:
POST /flash_call_recovery
cuid=x&enc_phone=x&cli=+1xxxxx
So cli is the phone number from which the recovery call was received in step 3, which explains the name phone call recovery. The researcher guesses that cli means something like caller identification.
In an ideal scenario, with all values valid, the response is:
{"id":"UserID","nonce":"XXXX","skip_logout_pw_reset":""}

The nonce value acts as an OTP code and is then supplied to the OTP verification endpoint. That endpoint validates the nonce and sets the new password.

Step 3: testing the parameters
In POST /flash_call_recovery, the researcher first tested whether supplying another user's valid cli together with the victim's cuid would work. It did not. Every parameter was flipped around in various combinations, and none of them worked.
Step 4: bruteforcing cli
The only remaining option was to bruteforce the cli. Given how strict Facebook is with rate limiting, including on non authentication endpoints, there was little hope this would succeed. To the researcher's surprise, the endpoint had no rate limit implemented.
The attack therefore works as follows:
- The user supplies the victim's
cuidandenc_phone_numberto the flashcall recovery endpoint. - The user bruteforces the
cli. - The user receives the
noncefrom the response. - The user supplies the
nonceto the OTP verification endpoint and sets a new password for the victim's account.
A video demonstrating how a default phone call account recovery process works accompanies the write-up.
Root cause
The email disclosure comes from the endpoint accepting a cuid derived from any email or phone and returning the matching userID. The account takeover depends on the same endpoint accepting a cli value that is guessable and on the absence of rate limiting on the endpoint, so a valid cli can be found by brute force and the resulting nonce can be used to reset the password. The report does not describe the server side code, so the exact implementation mistake is not stated.
Impact
An attacker could supply anyone's email or phone as the cuid and determine exactly who that email belonged to. With the bruteforce path, an attacker could obtain a nonce for a victim's account and use it at the OTP verification endpoint to set a new password, taking over the account. The takeover depends on the attacker being able to bruteforce cli successfully, which was possible because the endpoint had no rate limit. Facebook later found no evidence of abuse, and the issue was closed in September 2.
Fix
Both issues were fixed by Facebook. The email disclosure was triaged and fixed within a day of submission. The account takeover was triaged on April 30, 2021 at 3:32 PM and fixed the same day at 3:49 PM. The report does not describe the specific code changes.
Variants to test
- Look for recovery endpoints in mobile APKs that take an encrypted identifier and return a userID: a positive result is a response that maps an arbitrary email or phone to an account.
- Test recovery endpoints for parameters that are guessable, such as a caller ID or short numeric value: a positive result is a valid response without any rate limiting after many attempts.
- Compare the mobile recovery flow with the web flow for parameters that are hidden in the UI, such as
should_use_flash_call: a positive result is a response containing values not shown to the user.
Timeline
Timeline of Email Disclosure
Submitted: April 25, 2021 Triaged: April 27, 2021 Fixed: April 27, 2021
Timeline of Account Takeover
Submitted: April 29, 2021 Triaged: April 30, 2021 at 3:32 PM Fixed: April 30, 2021 at 3:49 PM

It took the researcher more time to verify the fix than Facebook took to release it. After a thorough investigation, Facebook found no evidence of abuse, and the issue was closed in September 2.
What happened, in plain words
Facebook and Messenger are phone apps. Behind the screens you tap, those apps talk to Facebook's computers over the internet. Each of those conversations goes to a specific address called an endpoint, and the app sends small pieces of information along with the request. Some of these endpoints are never shown in the normal website, so most people never see them.
One of those hidden conversations is the account recovery flow. If you forget your password, Facebook can send you a code to prove the account is yours. Usually that code arrives by text message (SMS). There is another option: Facebook can ring your phone instead of sending the OTP by SMS. That is called phone call recovery.
This report is about two problems found in that phone call recovery flow. The first problem let anyone type in an email address and learn which Facebook account it belonged to. The second, more serious problem let an attacker reset the password of someone else's account and take it over. Both were reported to Facebook and both were fixed.
Some words you will need
Before the steps make sense, here are a few ideas in everyday terms.
- An app (application) is a program you install, like Facebook or Messenger on a phone.
- An APK is the file format Android uses to install an app. It is like a zip file that contains the app's code and resources.
- An endpoint is a specific address on a server that accepts a particular kind of request. Think of a large office building: the street address is the server, and each department inside (accounts, messages, photos) is an endpoint. You have to knock on the right door with the right form.
- An API is the set of rules for how a program talks to a server: which endpoints exist, what information each one expects, and what it sends back. It is like a restaurant menu that also tells the kitchen exactly how each dish must be ordered.
- A parameter is one piece of information you send with a request, like a field on a form. For example, an email parameter carries the email address.
- A request is the message your app sends to the server. A response is the message the server sends back.
- POST is one type of request. It is used when you are sending information to the server, rather than just asking to view a page.
- A userID is the unique number or string that identifies one account. It is like a customer number in a shop: it is not your name, but it points to exactly one person.
- An OTP (one-time password) is a short code that works once and expires. The code you get by text when logging in is an OTP.
- A nonce is a value meant to be used only once. In this flow it works like an OTP.
- Rate limiting is a rule that stops someone from trying something thousands of times per minute. Think of a shop that only lets you try a wrong PIN three times before locking the card. Without it, a computer can guess very fast.
- Bruteforcing means trying every possible value until one works. If a value has only a few possibilities, a computer can go through them quickly.
- Smali is the human-readable form of the code inside an Android app after it has been unpacked. Reading it is like reading the blueprint of a machine you cannot open while it is running.
- grep is a command-line tool that searches text for a pattern. If you have a big pile of files and want every line containing the word "recover", grep finds them for you.
- Account takeover means someone else gains control of your account, usually by changing your password so you cannot log back in.
- Information disclosure means the system reveals information to someone who should not have it, such as whether an email is registered.
How the hunt started
The researcher prefers looking at phone apps rather than websites, because apps often talk to endpoints that the website never shows. In January the work began by downloading a number of Facebook and Messenger APKs of different versions.
All the endpoints inside those files were pulled out with grep, sorted, and then reviewed one by one. This is like emptying a box of business cards onto a table, sorting them alphabetically, and reading each one to see which departments exist inside a company.
The later analysis of how the recovery flow works was done by reading the smali files of the unpacked app.
Finding the endpoint
While going through the sorted list, one endpoint stood out:
POST auth/flashcall_account_recovery

Line by line:
POSTsays this is a request that sends information to the server, not just a page view.auth/flashcall_account_recoveryis the path, the department inside the building. The wordauthsuggests it belongs to login and account security.flashcallsuggests a quick phone call.account_recoverysays it is about getting back into an account.
The endpoint required three parameters:
cuid, encrypted_phone_numbers & cli
cuidis described as an encrypted email or phone value. Encrypted here means it is scrambled so it does not look like a plain email address, but it can still be produced and recognised by the system.encrypted_phone_numberscarries phone numbers in that same scrambled form.cliwas not understood at this point. The name gave no obvious clue.
The cuid can be found easily. Supplying a victim's email to the account recovery endpoint returns the matching cuid:
POST /recover_accounts

This is the ordinary "forgot password" step that many websites have. You type your email, the server looks it up, and it replies with something it needs for the next step. Here that something is the cuid. The important point is that the cuid can be found easily.
Separately, while going through the normal Facebook password recovery flow, the researcher noticed that the endpoint responsible for sending the OTP code had a parameter named should_use_flash_call=false.
- With
false, the user receives an OTP by SMS. - With
true, the user receives a phone call instead of the OTP for account recovery.
The response to that request contained the required encrypted phone numbers.

So the normal recovery screen, which looks simple to a user, is really sending a hidden switch (should_use_flash_call) and receiving scrambled phone numbers back. This is why looking at the traffic matters: the screen shows one thing, the request shows another.
The cli parameter was the unclear part. The only association that came to mind was "command line interface", the text prompt where you type commands on a computer. That made no sense for a recovery endpoint. With no way to work out its meaning, the researcher supplied null instead. null is a special value meaning "nothing" or "empty".
Step 1: learning who an email belongs to
With cli set to null, the request to auth/flashcall_account_recovery returned the userID belonging to the user whose email had been supplied as the cuid. In other words, an attacker could supply anyone's email or phone as the cuid and, from the response, determine exactly who that email belonged to.

Why this matters: many services deliberately avoid telling you whether an email is registered, because that alone lets someone build a list of who has an account. Here the endpoint went further and handed back the account identifier. The researcher submitted this quickly, and it was triaged and fixed within a day. Triaged means the security team confirmed the report was valid and started work on it.
Step 2: working out how phone call recovery works
The researcher was curious about the endpoint because phone call recovery had never been used to reset a password, it was not present in the UI (the screens a normal user sees), and there was little information about the flow on Google or YouTube. When a feature exists in the app but not on the screen, the only way to understand it is to read the app's code.
Reading the smali files showed how the flow works:
- The user enters their email or phone.
- The user chooses the phone call recovery option.
- The user receives a phone call.
- The phone number that called is automatically supplied to the endpoint as:
POST /flash_call_recovery
cuid=x&enc_phone=x&cli=+1xxxxx
Line by line:
POST /flash_call_recoveryis the endpoint that completes the phone call step.cuid=xcarries the scrambled email or phone, withxstanding in for the real value.enc_phone=xcarries the scrambled phone number, again withxas a placeholder.cli=+1xxxxxcarries a phone number in international format. The+1is a country code and thexcharacters stand in for the rest of the digits.
So cli is the phone number from which the recovery call was received in step 3, which explains the name phone call recovery. The researcher guesses that cli means something like caller identification. In other words, the app sends back the number that called you.
In an ideal scenario, with all values valid, the response is:
{"id":"UserID","nonce":"XXXX","skip_logout_pw_reset":""}

Line by line:
idis the account identifier, the same kind of userID seen earlier.nonceis a one-time value. Here it acts as the OTP code.skip_logout_pw_resetis an empty field in this response. The report does not explain what it does.
The nonce value acts as an OTP code and is then supplied to the OTP verification endpoint. That endpoint validates the nonce and sets the new password.

This is the key to the whole attack. The phone call is only a way of delivering a code. Once the code (the nonce) exists, the rest of the password reset is just a normal request that says "here is the code, now change the password". If someone can obtain the nonce without receiving the call, they can finish the reset themselves.
Step 3: testing the parameters
In POST /flash_call_recovery, the researcher first tested whether supplying another user's valid cli together with the victim's cuid would work. It did not. Every parameter was flipped around in various combinations, and none of them worked.
This is a normal part of testing: change one thing at a time and see what the server accepts. The test did not work. So a random or borrowed phone number would not do.
Step 4: guessing the caller number
The only remaining option was to bruteforce the cli. Given how strict Facebook is with rate limiting, including on non authentication endpoints, there was little hope this would succeed. Rate limiting is the shop-lock rule described earlier: after a few wrong tries, you are stopped. Facebook applies it widely, so an endpoint without it would be unusual.
To the researcher's surprise, the endpoint had no rate limit implemented. That means a computer could send request after request with different cli values and never be slowed down.
The attack therefore works as follows:
- The user supplies the victim's
cuidandenc_phone_numberto the flashcall recovery endpoint. - The user bruteforces the
cli. - The user receives the
noncefrom the response. - The user supplies the
nonceto the OTP verification endpoint and sets a new password for the victim's account.
In plain words: the attacker knows the victim's scrambled email and phone (easy to obtain, as shown earlier). The only unknown is the phone number that Facebook would call from. Because that number can be guessed by trying many values and nothing stops the attempts, the attacker eventually hits the right one, gets a valid nonce, and uses it to set a new password.
A video demonstrating how a default phone call account recovery process works accompanies the write-up.
Why it worked
The email disclosure comes from the endpoint accepting a cuid derived from any email or phone and returning the matching userID. The server answers the question "who is this?" for anyone who asks.
The account takeover depends on the same endpoint accepting a cli value that is guessable and on the absence of rate limiting on the endpoint, so a valid cli can be found by brute force and the resulting nonce can be used to reset the password. The report does not describe the server side code, so the exact implementation mistake is not stated.
What an attacker could do
An attacker could supply anyone's email or phone as the cuid and determine exactly who that email belonged to. That is already useful for linking an email to an account.
With the bruteforce path, an attacker could obtain a nonce for a victim's account and use it at the OTP verification endpoint to set a new password, taking over the account. The takeover depends on the attacker being able to bruteforce cli successfully, which was possible because the endpoint had no rate limit.
Facebook later found no evidence of abuse, and the issue was closed in September 2.
The fix
Both issues were fixed by Facebook. The email disclosure was triaged and fixed within a day of submission. The account takeover was triaged on April 30, 2021 at 3:32 PM and fixed the same day at 3:49 PM.
Things worth testing on other sites
These are patterns to look for, not instructions to attack anyone. Only test systems you are allowed to test.
- Look for recovery endpoints in mobile APKs that take an encrypted identifier and return a userID. A positive result is a response that maps an arbitrary email or phone to an account.
- Test recovery endpoints for parameters that are guessable, such as a caller ID or short numeric value. A positive result is a valid response without any rate limiting after many attempts.
- Compare the mobile recovery flow with the web flow for parameters that are hidden in the UI, such as
should_use_flash_call. A positive result is a response containing values not shown to the user.
Timeline
Timeline of Email Disclosure
Submitted: April 25, 2021 Triaged: April 27, 2021 Fixed: April 27, 2021
Timeline of Account Takeover
Submitted: April 29, 2021 Triaged: April 30, 2021 at 3:32 PM Fixed: April 30, 2021 at 3:49 PM

It took the researcher more time to verify the fix than Facebook took to release it. After a thorough investigation, Facebook found no evidence of abuse, and the issue was closed in September 2.
Glossary
- APK: the installable file format for an Android app, containing its code and resources.
- API: the set of rules describing how programs talk to a server: which endpoints exist, what they expect, and what they return.
- Account takeover: a situation where someone else gains control of your account, usually by changing your password.
- Bruteforce: trying every possible value until one works.
- cli: in this flow, the phone number from which the recovery call was received; the researcher guesses it means caller identification.
- cuid: an encrypted email or phone value used by the recovery endpoints.
- encrypted_phone_numbers / enc_phone: phone numbers in scrambled form, as used by the recovery endpoints.
- Endpoint: a specific address on a server that accepts a particular kind of request.
- grep: a command-line tool that searches text for a pattern.
- Information disclosure: revealing information to someone who should not have it.
- nonce: a value meant to be used only once; here it acts as the OTP code.
- null: a special value meaning nothing or empty.
- OTP: a one-time password, a short code that works once and expires.
- Parameter: one piece of information sent with a request, like a field on a form.
- POST: a request type used when sending information to the server.
- Rate limiting: a rule that stops someone from making too many attempts in a short time.
- Request: the message an app sends to a server.
- Response: the message a server sends back.
- Smali: the human-readable form of an Android app's code after unpacking.
- SMS: a text message sent to a phone.
- Triaged: confirmed as a valid issue by the security team, which then starts work on it.
- UI: the user interface, the screens a normal user sees.
- userID: the unique identifier for one account.