Skip to content
IDOR Write-up Intermediate

Disclose leads form details of any Facebook Business Account

Two GraphQL IDOR vulnerabilities in Facebook's Leads Center allowed a malicious user to disclose leads form details and the total number of leads captured for any Facebook Page or Business Account. An attacker could spy on competitors and copy profitable lead ads without advertising spend.

Amine Aboud Follow

Published on amineaboud.medium.com

By chaining two GraphQL IDOR vulnerabilities affecting the Facebook Leads Center a malicious user could have exposed the leads form details of any Facebook Page or Facebook Business Account.

Amine Aboud, on amineaboud.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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

Facebook Lead Ads let a business collect contact details from people who tap an ad. The form pops up pre-populated with the person's Facebook contact information, and the business receives a qualified lead. Advertisers manage these forms and their captured leads through the Facebook Leads Center, which is backed by the GraphQL endpoint at https://www.facebook.com/api/graphql/.

The report describes two GraphQL IDOR vulnerabilities in that Leads Center. Chained together, they let a malicious user expose the leads form details of any Facebook Page or Facebook Business Account, and then the total number of leads captured through paid advertising by that Page.

Setup

The report does not describe any particular account setup, tooling or versions. The only precondition it states is that the requests must be sent with the required CSRF parameters, and that the attacker needs to know the targeted Facebook Page ID. The second step additionally needs the leads form ID, which the first step leaks.

Finding it

The researcher does not describe how the vulnerabilities were first noticed. What the report shows is that the Leads Center GraphQL operations take object identifiers (pageID and form_id) directly from the request variables and return data for whatever object those identifiers name, without checking that the caller is authorised for that object. That is the classic IDOR pattern: the identifier is the only thing standing between the caller and someone else's data.

Exploitation

Step 1: leak the leads form details of any Page

Send a POST request to https://www.facebook.com/api/graphql/ with the required CSRF parameters and the following parameters in the request body:

HTTP
&variables={"pageID":"X"}&doc_id=3388026827877743

pageID is the targeted Facebook Page ID, substituted for X. doc_id selects the persisted GraphQL document that the Leads Center uses for this operation. The returned response discloses the leads form details of the targeted Facebook Page, including the form ID that the second step needs.

Step 2: leak the number of captured leads

Send a POST request to the same endpoint with the required CSRF parameters and the following additional parameters in the request body:

HTTP
&variables={"pageID":"X","start_time":null,"end_time":null,"reminder_start_time":1610481600,"reminder_end_time":1610568000,"stage_id":null,"owner_id":null,"form_id":"X","label_id":null,"name_search_term":null,"answer_search_term":null,"email_search_term":null,"notes_search_term":null,"phone_search_term":null,"adgroup_id":null,"campaign_id":null,"campaign_group_id":null,"pageSize":20,"expiring_type":null,"is_unread":false}&doc_id=3547538925278909

Here pageID is again the Facebook Page ID, and form_id is the targeted leads form ID leaked by the first GraphQL IDOR. The returned response displays the total number of leads captured through paid advertising by the targeted Facebook Page.

Root cause

Both operations are GraphQL IDORs: the server resolves the object named in the request variables and returns its data without verifying that the authenticated caller owns or has access to that object.

Impact

Advertisers spend time, energy and money optimising their leads campaigns and running A/B tests to find the ad that performs. By exposing the leads form details and the total number of leads captured through paid advertising, a malicious advertiser could spy on a targeted Facebook Page or a competitor and copy all the winning, profitable lead ads without investing a single dollar in advertising. The report frames this as something a malicious advertiser could have done; it does not claim that any data was actually taken.

Fix

Facebook fixed the issue in stages. The timeline in the report is:

Date Event
January 5, 2021 Report sent
January 6, 2021 Acknowledged by Facebook
January 13, 2021 Fixed by Facebook
January 13, 2021 Researcher added a new vulnerable GraphQL request to the report
January 15, 2021 Fixed by Facebook
January 15, 2021 Researcher added another vulnerable GraphQL request to the report
January 21, 2021 Fixed by Facebook
February 1, 2021 Bounty awarded

Variants to test

  1. Swap the pageID in the first request for a Page you do not own. A positive result is a response containing that Page's leads form details.
  2. Take a form_id leaked from step 1 and use it in the second request with the matching pageID. A positive result is a response showing the total number of leads captured by that Page.
  3. Replay the same doc_id values against other GraphQL operations in the Leads Center, changing only the object identifiers. A positive result is data for an object you do not control.
  4. A positive result is any object-level data returned for an identifier you do not own.
  5. Vary the filter variables (start_time, end_time, stage_id, owner_id, label_id, search terms) while keeping a foreign pageID and form_id. A positive result is filtered lead data belonging to another Page.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

Facebook lets businesses run ads that collect contact details from people. A person taps the ad, a form pops up already filled in with their Facebook contact information, and the business receives what is called a lead. Businesses manage these forms and the leads they capture in a part of Facebook called the Leads Center.

The Leads Center talks to Facebook's servers through something called an API. An API is the way one piece of software asks another piece of software for information, a bit like a waiter taking your order to the kitchen and bringing the food back. Facebook's Leads Center uses a particular style of API called GraphQL, which works by sending a request that names exactly what data you want, and the server sends back just that.

The researcher found that two of these requests did not check who was asking. If you told the server which Facebook Page you wanted information about, it gave you that information, even if the Page belonged to someone else. The first request revealed the details of a Page's lead forms, including an internal identifier for each form. The second request, using that identifier, revealed how many leads the Page had captured through paid advertising.

By chaining the two requests, a malicious advertiser could have looked at a competitor's lead forms and lead counts, then copied the winning ads without spending anything on testing them. The report describes what could have happened; it does not say that anyone actually took data.

Background: what lead ads and the Leads Center are

Facebook Lead Ads are a type of advertisement. The report quotes Facebook's own description:

"Lots of people want to hear from your business, but filling in forms can be difficult on mobile. Facebook lead ads makes the lead generation process easy. People can simply tap your ad and a form pops up, it's already pre-populated with their Facebook contact information and ready to be sent directly to you. With just a few taps, they can get the information they want, and you generate a qualified lead for your business", Facebook.com

In everyday terms: a business pays Facebook to show an ad. When someone taps it, a short form appears with their name and contact details already filled in. They tap to send it, and the business gets a contact, called a lead. Advertisers then manage those forms and the leads they collected in the Leads Center.

Behind the Leads Center is the GraphQL endpoint at https://www.facebook.com/api/graphql/. An endpoint is simply the address on a server that accepts a particular kind of request, like a specific counter at a train station where you buy a particular ticket.

The vulnerability class: IDOR

IDOR stands for Insecure Direct Object Reference. It means a program takes an identifier supplied by the user, such as a Page ID or a form ID, and hands back the object that identifier points to, without checking that the user is allowed to see that object.

A simple comparison: imagine a hotel where room keys are numbered, and the front desk gives you any key you ask for as long as you say the room number. Nothing stops you from asking for a room that is not yours. In software, the identifier is the room number, and the missing check is the front desk asking whether you are the guest.

In this report, the identifiers are pageID and form_id. The server accepted them from the request and returned data for whatever they named.

What you need before starting

The report does not describe any particular account setup, tools or software versions. It states two preconditions:

  1. The requests must be sent with the required CSRF parameters. CSRF stands for Cross-Site Request Forgery. It is a protection where the server expects a special value in the request to prove the request really came from the site's own pages and not from a malicious page pretending to be you. The report says these parameters are required but does not list them.
  2. The attacker needs to know the targeted Facebook Page ID. A Page ID is the number Facebook uses internally to identify a Page.

The second step also needs the leads form ID, but that is not something you need to know in advance: the first step leaks it.

Finding it

What it shows is the pattern: the Leads Center's GraphQL operations take object identifiers straight from the request and return data for whatever object those identifiers name, without checking that the caller is authorised for that object. Authorised means having permission. The identifier is the only thing standing between the caller and someone else's data.

Step 1: leak the leads form details of any Page

The first request asks the Leads Center for the lead form details of a Page. Send a POST request to https://www.facebook.com/api/graphql/ with the required CSRF parameters and the following parameters in the request body:

HTTP
&variables={"pageID":"X"}&doc_id=3388026827877743

Line by line:

  • &variables={"pageID":"X"} is the part of the request that names the object you want. variables is a container for the values the request uses. pageID is the identifier of the Facebook Page. X is a placeholder: in a real request you put the targeted Page ID there.
  • &doc_id=3388026827877743 selects which stored GraphQL request the server should run. Facebook stores its GraphQL requests on the server and gives each one a number, called a document ID. This number is fixed and shared, so any user can ask for the same stored request.

Why this step: the goal is to see whether the server returns a Page's lead form details to someone who does not own that Page. If it does, the response includes the form ID, which the second step needs.

The returned response discloses the leads form details of the targeted Facebook Page.

Step 2: leak the number of captured leads

The second request asks how many leads a particular form has collected. Send a POST request to the same endpoint with the required CSRF parameters and the following additional parameters in the request body:

HTTP
&variables={"pageID":"X","start_time":null,"end_time":null,"reminder_start_time":1610481600,"reminder_end_time":1610568000,"stage_id":null,"owner_id":null,"form_id":"X","label_id":null,"name_search_term":null,"answer_search_term":null,"email_search_term":null,"notes_search_term":null,"phone_search_term":null,"adgroup_id":null,"campaign_id":null,"campaign_group_id":null,"pageSize":20,"expiring_type":null,"is_unread":false}&doc_id=3547538925278909

Line by line:

  • pageID is again the Facebook Page ID, substituted for X.
  • form_id is the targeted leads form ID, leaked by the first request. It is also shown as X in the report, but in practice it is the value from step 1.
  • start_time, end_time: both are null in the request.
  • reminder_start_time, reminder_end_time: two timestamps, 1610481600 and 1610568000. A timestamp is a number representing a moment in time.
  • stage_id, owner_id, label_id: all null in the request.
  • name_search_term, answer_search_term, email_search_term, notes_search_term, phone_search_term: all null in the request.
  • adgroup_id, campaign_id, campaign_group_id: all null in the request.
  • pageSize: 20 in the request.
  • expiring_type, is_unread: null and false in the request.
  • doc_id=3547538925278909 selects the stored GraphQL request for this operation, the same way the first step's doc_id did.

Why this step: the first request gave you the form ID. This request uses that form ID to ask for the leads listing, and the response shows the total number of leads captured through paid advertising by the targeted Facebook Page.

The returned response displays the total number of leads captured through paid advertising by the targeted Facebook Page.

Why it worked

Both requests are GraphQL IDORs. The server looks up the object named in the request variables and returns its data without checking that the logged-in caller owns or has access to that object.

The behaviour fits an object-level permission check that was absent or applied to the wrong object.

Impact

Advertisers spend time, energy and money optimising their lead campaigns and running A/B tests to find the ad that performs. A/B testing means showing two versions of something to different people and comparing which works better. By exposing the lead form details and the total number of leads captured through paid advertising, a malicious advertiser could spy on a targeted Facebook Page or a competitor and copy all the winning, profitable lead ads without investing a single dollar in advertising.

The report frames this as something a malicious advertiser could have done. It does not claim that any data was actually taken.

The fix

Facebook fixed the issue in stages. The timeline in the report is:

Date Event
January 5, 2021 Report sent
January 6, 2021 Acknowledged by Facebook
January 13, 2021 Fixed by Facebook
January 13, 2021 Researcher added a new vulnerable GraphQL request to the report
January 15, 2021 Fixed by Facebook
January 15, 2021 Researcher added another vulnerable GraphQL request to the report
January 21, 2021 Fixed by Facebook
February 1, 2021 Bounty awarded

Variants to test

These are ways to check whether the same pattern appears elsewhere. Each one describes what a positive result would look like.

  1. Swap the pageID in the first request for a Page you do not own. A positive result is a response containing that Page's leads form details.
  2. Take a form_id leaked from step 1 and use it in the second request with the matching pageID. A positive result is a response showing the total number of leads captured by that Page.
  3. Replay the same doc_id values against other GraphQL operations in the Leads Center, changing only the object identifiers. A positive result is data for an object you do not control.
  4. A positive result is any object-level data returned for an identifier you do not own.
  5. Vary the filter variables (start_time, end_time, stage_id, owner_id, label_id, search terms) while keeping a foreign pageID and form_id. A positive result is filtered lead data belonging to another Page.

Glossary

  • API: the way one piece of software asks another for information or actions, like a waiter carrying orders between you and the kitchen.
  • GraphQL: a style of API where the request names exactly which data it wants and the server returns that data.
  • Endpoint: the specific address on a server that accepts a particular kind of request.
  • POST request: a request that sends data to a server, usually to ask it to do something or return something based on that data.
  • Request body: the part of a request that carries the data being sent.
  • Parameter: a named value in a request, such as pageID or doc_id.
  • Variable: in GraphQL, a named value supplied with a request that the stored query uses.
  • doc_id: the number that selects which stored GraphQL request the server should run.
  • Page ID: the number Facebook uses internally to identify a Facebook Page.
  • Form ID: the number that identifies a particular lead form.
  • Lead: a person's contact details collected through an ad form, passed to the business.
  • Leads Center: the part of Facebook where advertisers manage lead forms and the leads they captured.
  • IDOR (Insecure Direct Object Reference): a flaw where a program accepts an identifier from the user and returns the object it names without checking the user is allowed to see it.
  • Authorisation: the process of checking whether a user has permission to do or see something.
  • Object-level authorisation: an authorisation check made on each individual object, such as a specific Page or form, rather than only on the user's account.
  • CSRF (Cross-Site Request Forgery): an attack where a malicious site makes your browser send a request you did not intend; CSRF parameters are values the server expects to prove a request came from its own pages.
  • CSRF parameters: the values a server requires in a request to confirm it came from the site's own pages.
  • Timestamp: a number representing a moment in time.
  • A/B test: showing two versions of something to different people and comparing which performs better.
  • Bounty: a reward paid by a company to someone who reports a security problem to it.

More by Amine Aboud

View all

2 more disclosed reports, best first.

More from Meta

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

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.