Getting any Facebook user's friend list and partial payment card details
The GraphQL endpoint accepted persisted query IDs (doc_id) without a user token, bypassing a whitelist and allowing retrieval of any user's friend list regardless of privacy settings. Separately, the Graph API allowed querying another user's payment card details via a field called payment_modules_options, exposing partial card data.
Published on josipfranjkovic.com
Facebook has a GraphQL endpoint which can only be used by some of their own first-party applications. Generally, you need a user (or page) accesstoken to query the GraphQL endpoint.
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 endpoint did not enforce authentication for certain persisted query IDs, and the Graph API lacked proper authorization checks on the payment_modules_options field.
Impact
An attacker could retrieve any user's friend list regardless of privacy settings and obtain partial payment card details, including BIN, last four digits, expiry, card type, cardholder name, and zip code.
What the attacker needed
A first-party app client token; knowledge of victim's user ID; a valid access token from a first-party app
The fix
Facebook fixed the friend list leak and the whitelist bypass, and also fixed the payment card details leak.
How it was found
- Send a request to the GraphQL endpoint using a first-party app's client token and a persisted query ID (doc_id) for the friend list query.
- Include the victim's user ID in the variables parameter.
- Observe the response containing the victim's friend list.
- For payment details, send a request to the Graph API with the victim's user ID, an attacker's access token, and the field payment_modules_options.payment_type(payment_settings).
- Specify an invalid payment_type to retrieve all possible payment types.
- Observe the response containing partial payment card details.
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.
Facebook's servers have special endpoints that apps use to fetch data. The researcher found that one endpoint would accept a saved query identifier without checking who was asking, so anyone could get someone else's friend list. Another endpoint let an attacker ask for another person's saved payment card details by changing the user ID in the request.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.