Story of Account Takeover : Using Social Login with Mass Assignment Vulnerability to hack accounts !
The Facebook social-login signup endpoint accepted a mobile parameter that was not intended to be set by the client, allowing an attacker to attach their own email to a victim's account by supplying the victim's phone number. This let the attacker take over the victim's account, and users could not later update or delete their email.
Published on kaif0x01.medium.com
Hey everyone, this is Mohammad Kaifaka mkahmadan 18 year old Security Researcher & Bug Hunter from Varanasi, India.
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 is a write-up of an account takeover found on a private bug bounty program. The program is referred to only as REDACTED. The target was a financial application with a mobile app in scope, in which users could sign up through email, phone number, or social login channels, namely Facebook and Google.
The feature at the centre of the report is Login with Facebook. When a user authorises the app on Facebook, the app sends the profile data it received to its own backend to create or attach an account. That backend endpoint is where the problem lived.
Setup
- The mobile app was downloaded directly from the Play Store, since the mobile app was in scope.
- The app had SSL Pinning, which was bypassed with a frida script.
- Burp Suite was used to intercept and modify traffic.
The report does not give the frida script, the app version beyond the appVersion value in the request, or the Burp version.
Finding it
The researcher started by checking the social login functionality. After authorising the app on Facebook, the app initiated an HTTP request to its backend. Intercepting that request showed a JSON body containing the profile fields returned by Facebook, plus a number of app-specific fields. Among them was a mobile parameter, which was empty in the normal request.
That parameter was the one vulnerable to mass assignment: the server accepted a value for a field that the client is not supposed to control through this flow.
Exploitation
Step 1: Start the social login
Click the login with Facebook button in the app.
Step 2: Intercept the request
Intercept the request using Burp Suite.
Step 3: Observe the signup request
After authorising the app on Facebook, the app initiated the following HTTP request:
The body carries fields including profile_picture, emailId, fname, lname, socialId, socialType, androidId, deviceToken, appVersion, and empty fields such as pincode, dob, mobile, city, gender, country and addressl2. The mobile field is empty in the captured request.
Step 4: Inject the victim's phone number
Enter the victim's account phone number as the value of the mobile parameter and forward the request.
Step 5: Result
The victim's account is now attached to the attacker's email.
Step 6: Why this is worse than it looks
Users cannot update or delete their email address on this application. Once the attacker's email is attached to the victim's account, the victim has no self-service way to remove it.
The report was rewarded by the company. The company's response was:
We are very grateful for your submission. Thank you for your excellent work.
Root cause
Mass assignment: the backend bound fields from the JSON body directly onto the user or account object without restricting which fields a social signup request is allowed to set. The social login flow accepted a mobile value from the client. An attacker could supply a phone number belonging to someone else in the mobile field.
The report does not describe the server-side code, so the exact binding mechanism is not stated; the behaviour is consistent with a handler that merges the request body into the account record and then looks up or updates the account by phone number.
Impact
An attacker who knows a victim's phone number can take over that victim's account by performing a Facebook social login with their own Facebook account and adding the victim's number in the mobile field. The victim's account then becomes associated with the attacker's email address. Because users cannot change or delete their email address, the victim cannot undo the association themselves.
The precondition is knowledge of the victim's phone number.
Fix
The appropriate fix is server-side: bind only an explicit allow-list of fields from the social login request (the profile data the provider actually returns and the app metadata the flow needs), and never accept account-identifying fields such as mobile from the client in this flow. Any linking of a social identity to an existing account by phone number should require proof of possession of that number, for example an OTP sent to it, rather than trusting a value in the request body.
Variants to test
- Other social login endpoints. Try the same body manipulation on Google login and on any other provider the app supports. A positive result is the same behaviour: the account tied to the injected identifier becomes linked to the attacker's identity.
- Other account-identifying fields. Add or modify fields such as
emailId,socialId,userIdor role-like fields in the signup body. A positive result is the server accepting a value the client should not control, visible in the resulting account state. - Profile update endpoints. Apply the same technique to endpoints that update a user profile, adding fields that are not shown in the UI. A positive result is a field changing on the server that the UI never offers.
- Nested objects and arrays. Where the body contains nested structures, try adding fields inside them. A positive result is any server-side value changing that the request had no business setting.
- Registration by email or phone. Repeat the mass assignment test on the non-social signup flows. A positive result is an account attribute (email, phone, verification flag) being set from the request rather than derived by the server.
What happened, in plain words
A security researcher found a way to take over other people's accounts in a financial mobile app. The app let people sign up with Facebook or Google. When someone signed up with Facebook, the app sent a request to its own server containing the Facebook profile details. That request also contained a field called mobile that was normally empty. The server accepted whatever value was put in that field. By putting a victim's phone number into mobile, the attacker could attach their own email address to the victim's account. Because users could not change or delete their email address in the app, the victim had no way to undo this. The researcher reported it and the company rewarded him.

Background: the app and the feature
The target was a financial app available on the Play Store. It allowed users to create an account in three ways: with an email address, with a phone number, or through a social login such as Facebook or Google. Social login means you click a button like "Login with Facebook", the app sends you to Facebook to confirm, and Facebook tells the app who you are.
The feature at the centre of this report is Login with Facebook. When you authorise the app on Facebook, the app receives your Facebook profile details (name, profile picture, email, and a Facebook user ID). It then sends those details to its own backend server to create or attach an account. That backend request is where the problem was.
Setting up the test
To test a mobile app, you need to see the traffic between the app and its server. The researcher did this:
- Downloaded the app directly from the Play Store, because the mobile app was in scope for the bug bounty program.
- The app used SSL Pinning, a technique that makes the app trust only a specific certificate for secure connections. This prevents tools like Burp Suite from reading the traffic. The researcher bypassed it with a frida script. Frida is a tool that lets you inject code into a running app to change its behaviour.
- Used Burp Suite, a tool that sits between the app and the server, to intercept and modify the requests.
The report does not include the frida script, the exact app version beyond the appVersion value in the request, or the Burp Suite version.
Finding the vulnerability
The researcher started by testing the social login functionality. After authorising the app on Facebook, the app sent an HTTP request to its backend. By intercepting that request with Burp Suite, the researcher could see the JSON body. JSON is a text format for sending data as name-value pairs, like a form but structured. The body contained the Facebook profile fields and some app-specific fields. One of those fields was mobile, and it was empty in the normal request.
That empty field was the clue. The app never needs to send a phone number during a Facebook login, because Facebook does not provide a phone number. So the server should not accept a value for it. But it did. This is a mass assignment vulnerability: the server takes the entire JSON body and assigns each field to the user account object without checking which fields the client is allowed to set. An attacker can add or change fields that were never meant to be controlled by the client.
Exploitation steps
Step 1: Start the social login
Click the login with Facebook button in the app. This begins the normal flow: the app opens Facebook, you log in and authorise the app, and Facebook sends you back to the app.
Step 2: Intercept the request
Set Burp Suite to intercept traffic. When the app sends the request to its server after Facebook authorisation, Burp catches it and holds it so you can view and modify it before it reaches the server.
Step 3: Observe the signup request
After authorising the app on Facebook, the app initiated the following HTTP request:
Let's break this down line by line.
POST /signup/users/socialLogin HTTP/1.1is the request line.POSTis the method used to send data to the server./signup/users/socialLoginis the path on the server that handles social signups.HTTP/1.1is the version of the HTTP protocol.Content-Type: application/json; charset=UTF-8tells the server that the body is JSON text encoded in UTF-8.Content-Length: 834is the size of the body in bytes.Host: api.redacted.comis the server's domain name. The real name is redacted in the report.Connection: closeasks the server to close the connection after the response.Accept-Encoding: gzip, deflatetells the server the client can accept compressed responses.User-Agent: okhttp/4.2.1identifies the client software. OkHttp is a library commonly used by Android apps for network requests.- The blank line separates the headers from the body.
- The body is a JSON object with many fields. Here is what each field means:
profile_picture: URL of the user's Facebook profile picture.emailId: the user's email address.socialType: which social provider was used, hereFBfor Facebook.fname: first name.pincode: postal code, empty.dob: date of birth, empty.mobile: phone number, empty in the normal request.city: city, empty.gender: gender, empty.androidId: a unique identifier for the Android device.deviceToken: a token for push notifications, shown asxxxx.appVersion: version of the app,1.0.0|10.country: country, empty.socialId: the user's Facebook ID.addressl2: second line of address, empty.lname: last name.
The key point is that mobile is empty. The app does not need it for a Facebook login, so the server should ignore it. But because of mass assignment, the server will accept any value placed there.
Step 4: Inject the victim's phone number
In Burp Suite, change the value of the mobile field from empty to the victim's phone number. Then forward the request to the server. The server receives the modified JSON and processes it as if the phone number were a legitimate part of the signup.
Step 5: Result
The victim's account is now attached to the attacker's email address. In other words, the account that belonged to the phone number supplied in mobile ends up linked to the email address in the attacker's own social login request.
Step 6: Why this is worse than it looks
Users cannot update or delete their email address on this application. Once the attacker's email is attached to the victim's account, the victim has no self-service way to remove it. The victim cannot simply change the email back or delete it.
The report was reported and rewarded by the company. The company's response was:
We are very grateful for your submission. Thank you for your excellent work.
Root cause
The root cause is mass assignment. The backend took the fields from the JSON body and bound them directly onto the user or account object without restricting which fields a social signup request is allowed to set. The mobile field is part of the account model, but the social login flow has no legitimate reason to accept it from the client, because the phone number is not something Facebook returns. Because the handler did not use an allow-list of acceptable fields, an attacker could supply a phone number belonging to someone else and have the server treat it as the identifier of the account to attach the social identity to.
The report does not describe the server-side code, so the exact binding mechanism is not stated. The behaviour is consistent with a handler that merges the request body into the account record and then looks up or updates the account by phone number.
Impact
An attacker who knows a victim's phone number can take over that victim's account by performing a Facebook social login with their own Facebook account and adding the victim's number in the mobile field. The victim's account then becomes associated with the attacker's email address. Because users cannot change or delete their email address, the victim cannot undo the association themselves.
The precondition is knowledge of the victim's phone number. The report does not state whether any further verification of the phone number takes place, and it does not give figures for how many accounts were affected.
Fix
The appropriate fix is server-side: bind only an explicit allow-list of fields from the social login request (the profile data the provider actually returns and the app metadata the flow needs), and never accept account-identifying fields such as mobile from the client in this flow. Any linking of a social identity to an existing account by phone number should require proof of possession of that number, for example an OTP sent to it, rather than trusting a value in the request body.
Variants to test
- Other social login endpoints. Try the same body manipulation on Google login and on any other provider the app supports. A positive result is the same behaviour: the account tied to the injected identifier becomes linked to the attacker's identity.
- Other account-identifying fields. Add or modify fields such as
emailId,socialId,userIdor role-like fields in the signup body. A positive result is the server accepting a value the client should not control, visible in the resulting account state. - Profile update endpoints. Apply the same technique to endpoints that update a user profile, adding fields that are not shown in the UI. A positive result is a field changing on the server that the UI never offers.
- Nested objects and arrays. Where the body contains nested structures, try adding fields inside them. A positive result is any server-side value changing that the request had no business setting.
- Registration by email or phone. Repeat the mass assignment test on the non-social signup flows. A positive result is an account attribute (email, phone, verification flag) being set from the request rather than derived by the server.
Glossary
- API: Application Programming Interface; a set of rules that lets one piece of software talk to another. In this context, the app talks to the server through API endpoints.
- Account takeover: A type of attack where an attacker gains control of someone else's account.
- Burp Suite: A tool used by security testers to intercept, inspect, and modify HTTP traffic between a client and a server.
- Frida: A dynamic instrumentation toolkit that lets you inject code into running apps to change their behaviour, often used to bypass security controls like SSL pinning.
- HTTP request: A message sent by a client (like a browser or app) to a server, asking for something or sending data.
- JSON: JavaScript Object Notation; a lightweight text format for exchanging data, using key-value pairs.
- Mass assignment: A vulnerability where a server automatically assigns all fields from a request to an internal object without checking which fields the client is allowed to set, allowing attackers to modify sensitive fields.
- OTP: One-Time Password; a code sent to a phone or email to verify possession.
- Private program: A bug bounty program that is not open to the public; only invited researchers can participate.
- SSL Pinning: A security mechanism where an app trusts only a specific certificate for secure connections, preventing interception by tools like Burp Suite.
- Social login: A feature that lets users log in to an app using their existing account from a social network like Facebook or Google.
- Token: A piece of data used to authenticate a user or device, often a string that is sent with requests to prove identity.
- User-Agent: A header in an HTTP request that identifies the client software making the request.