Skip to content
Access control Write-up Intermediate

Facebook Bug Bounty: secondary damage (revisited) why I really like reporting to Facebook too :)

Philippe Harewood Follow

Published on philippeharewood.com

If you read Josip Franjković blog, you’d remember this report http://josipfranjkovic.blogspot.com/2013/11/facebook-bug-bounty-secondary-damage.html. Turns out this isn’t just a one hit wonder.

Philippe, on philippeharewood.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. 5 min read.

Context

This write-up revisits a theme Josip Franjković had already described in a 2013 post on "secondary damage" in Facebook bug bounties: a report that looks like a small documentation or access-control inconsistency can turn out to expose a real bug, and can therefore be worth more than it first appears. The target here is the Facebook Ads API and, specifically, the boundary between the Ads API and the Business Manager API.

The documented rule is that a developer-level Ads API application should not have access to Business Manager API calls. The access limits page cited in the report states this explicitly, and the researcher quotes it as saying that Development and Basic level applications should not be able to make these calls. The feature under test is the Business Manager API, which among other things lets a caller read a business ID and change properties such as the business vertical.

Setup

The researcher was digging into Ads endpoints in connection with Facebook's double bounty for Ads code, and noticed inconsistencies in the Ads API documentation. Two applications are used in the proof of concept:

Application ID Name Notes
458290410972131 NotLeepingTest No ads_management permission
269335163238875 AnyLeepingTest Has ads_management permission

The business object used throughout is ID 1506156432945949, named 00Agency. The precondition is simply an application at developer level access, which per the documentation should not reach Business Manager endpoints.

Finding it

The starting point was the ad level limits page, which says a developer Ads API should not have access to Business Manager API calls. While working through Ads endpoints, the researcher found behaviour that contradicted that statement: the account's business ID could be inspected, and Business changes such as modifying the vertical could be executed, despite the level limit.

Exploitation

Step 1: call the business ID without ads_management

The first attempt uses the application without the ads_management permission and issues a GET against the business ID:

HTTP
HTTP GET /1506156432945949

The response is an OAuth error:

JSON
{"error": {
"message": "(#294) Managing advertisements requires the extended permission ads_management and an application that is whitelisted to access the Ads API",
"type": "OAuthException",
"code": 294}}

An error is returned, as the documented limit would lead one to expect, but not the error the researcher expected: the ID is associated with the business, not with Ads, so the permission error is not the one that should apply here.

Step 2: repeat with an application that has ads_management

The second attempt uses the application with the ads_management permission, essentially satisfying the error message from step 1, and calls the same business ID:

HTTP
HTTP GET /1506156432945949

This time the call succeeds:

JSON
{"id": "1506156432945949", "name": "00Agency"}

The researcher expected an error stating that the application is only at Developer Level access when at least Standard Level access is required. One possible explanation considered was that Developer Level might allow read access, even though the documentation does not explicitly say so, which would account for the successful read.

Step 3: try a write call

To test whether the access extends beyond reads, the researcher takes a write call from the Business Manager documentation. The documented form is:

Bash
curl
-F "vertical=RETAIL"
-F "access_token=<ACCESS_TOKEN>"
"https://graph.facebook.com/<business_id>"

This changes the vertical of the business from ADVERTISING to RETAIL. Applied to the researcher's own application and business, the call becomes:

Bash
curl
-F "vertical=RETAIL"
-F "access_token=ACCESS_TOKEN"
"https://graph.facebook.com/1506156432945949"

The response contains only the ID of the business, which the researcher notes is probably not a good indicator of success or failure.

Step 4: verify the change

To confirm whether the write actually took effect, the researcher reads the relevant properties back:

HTTP
/1506156432945949?fields=vertical,vertical_id

The response shows the new value:

JSON
{"vertical": "RETAIL", "vertical_id": 14, "id": "1506156432945949"}

The vertical is now RETAIL, and the vertical ID has changed from 1 (ADVERTISING) to 14 (RETAIL). The proof of concept therefore shows that the Business Manager API can be used from an application at developer level access, even though the access limits page explicitly states that Development and Basic level applications should not be able to do this.

Root cause

Facebook's own explanation, given after the report was triaged, is that there are a few Business Manager API endpoints which are accessible to more applications than they should be, and that the team was in the process of locking them down. In other words, those endpoints were accessible to more applications than they should be. The researcher's view is that finding one of these endpoints by comparing applications for access would likely have been a long process of trial and error.

Impact

The proof of concept demonstrates that an application at developer level access, with the ads_management permission, could read a business object and modify its vertical. The report does not go further than that: it does not describe what other Business Manager operations were reachable, nor which other applications or businesses were affected. Facebook's second response notes that the documentation was updated to reflect when access is actually allowed, and that the team had found additional areas of concern in these APIs while investigating, which were being fixed. The researcher observes that a documentation change alone would normally not be enough for a bounty, but that these additional issues qualified.

Fix

Two changes are described. First, the documentation was updated to reflect when access is actually allowed. Second, Facebook stated that the Business Manager API endpoints which were accessible to more applications than they should be were in the process of being locked down by the team. The report does not describe the technical details of the lock-down.

Variants to test

  1. Compare the documented access level for an API against what a lower-level application can actually do. A positive result is a call that succeeds where the documentation says it should be rejected.
  2. Take a read that succeeds at a lower level and repeat it as a write, using a documented write call for the same object. A positive result is a write that changes state, confirmed by reading the property back.
  3. When a permission error names a specific permission, satisfy that permission with a second application and retry the same call. A positive result is a different response, especially a successful one, rather than the expected level error.
  4. When a write returns only an object ID, verify the effect with a follow-up read of the changed fields. A positive result is a changed value and a changed numeric identifier, as with the vertical moving from 1 to 14 here.

Timeline

  • Oct 30, 2014 at 6:50 AM: report sent
  • Nov 5, 2014 at 2:02 AM: first response from Facebook
  • Nov 21, 2014 at 4:02 PM: second response from Facebook
  • Dec 30, 2014 at 3:07 PM: bounty awarded by Facebook
  • Jan 9, 2015 at 3:19 PM: clarification from Facebook about the actual bug

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. 12 min read.

What happened, in plain words

A security researcher found that a Facebook tool meant for advertisers could do more than its documentation said it should. Facebook's own documentation listed a set of access levels, and said that applications at the lowest levels should not be able to reach a different set of tools called the Business Manager API. In practice, an application at the lowest level could read a business record and even change one of its settings. Facebook confirmed the problem, updated the documentation, said the affected endpoints were being locked down, and paid a bounty.

The report is a follow-up to an earlier post by another researcher, Josip Franjković, about what he called "secondary damage" in bug bounties. The idea is simple: a report that starts as a small inconsistency in documentation or access rules can turn out to expose a real bug, and so be worth more than it first looked. This report is a second example of that pattern.

Before going further, a few words that will come up constantly.

  • An API (Application Programming Interface) is a way for one piece of software to talk to another. Think of it as a service counter: you walk up, ask for something in a fixed format, and get an answer back in a fixed format. You do not go into the kitchen yourself; you ask the counter.
  • An endpoint is one specific counter in that building. https://graph.facebook.com/1506156432945949 is an endpoint: a particular address that accepts particular requests.
  • A token (here an access_token) is like a wristband you get at the door of an event. You show it with every request so the server knows who you are and what you are allowed to do. It is a secret: anyone who has your wristband can act as you.
  • A permission is a specific thing your wristband lets you do, such as "manage advertisements".
  • GET and write (often POST) are the two basic kinds of request. A GET asks to read something and should not change anything. A write asks to change something. The names come from the HTTP protocol that browsers and APIs use.
  • curl is a command-line tool for sending requests to a server. It is the same kind of request your browser sends when you load a page, just typed out by hand.
  • JSON is a text format for structured data, made of curly braces, names and values. When an API answers, it usually answers in JSON.
  • OAuth is a standard way of granting an application limited access to an account without handing over the password. An OAuthException is an error raised by that system.
  • Access levels are tiers of trust. Facebook's Ads API documentation described levels such as Development, Basic and Standard, with more capability at higher levels.
  • Business Manager is Facebook's tool for organisations to manage their business assets in one place. Its API lets a caller read a business record and change properties on it, such as the business vertical, which is the industry category the business belongs to (for example ADVERTISING or RETAIL).

The vulnerability class here is a logic flaw combined with broken authorisation. A logic flaw means the software follows its rules but the rules themselves, or the way they are checked, are wrong. Broken authorisation means the check that decides whether you are allowed to do something does not actually stop you. There is no memory corruption, no clever payload: the server simply lets a request through that it should have refused.

The setup

The researcher was looking into Ads endpoints in connection with Facebook's double bounty for Ads code, and noticed inconsistencies in the Ads API documentation. Two applications were used in the proof of concept:

Application ID Name Notes
458290410972131 NotLeepingTest No ads_management permission
269335163238875 AnyLeepingTest Has ads_management permission

An application here means a registered Facebook app: a piece of software with its own ID and its own set of permissions. The first app does not have the permission to manage advertisements. The second one does. Having two apps lets the researcher compare what each one is allowed to do, which is the whole trick of this report.

The business record used throughout is ID 1506156432945949, named 00Agency. The starting condition is simply an application at developer level access, which per the documentation should not be able to reach Business Manager endpoints at all.

Finding it

The starting point was the ad level limits page. It says that a developer-level Ads API application should not have access to Business Manager API calls. While working through Ads endpoints, the researcher found behaviour that contradicted that statement: the account's business ID could be inspected, and business changes such as modifying the vertical could be executed, despite the level limit.

In everyday terms: the sign on the door says "staff only", but the door opens when you push it.

Exploitation

Step 1: call the business ID without ads_management

The first attempt uses the application without the ads_management permission and issues a GET against the business ID:

HTTP
HTTP GET /1506156432945949

Line by line: HTTP GET says this is a read request. /1506156432945949 is the path, the address of the business record on the server. Nothing else is sent, no body, no extra parameters. The purpose of this step is to see what the server says when an application that lacks the ads permission asks for a business record.

The response is an OAuth error:

JSON
{"error": {
"message": "(#294) Managing advertisements requires the extended permission ads_management and an application that is whitelisted to access the Ads API",
"type": "OAuthException",
"code": 294}}

Line by line: the outer braces hold one object with a single key, error. Inside it, message is the human-readable explanation: managing advertisements requires the extended permission ads_management and an application that is whitelisted for the Ads API. type says the error came from the OAuth system, and code is the numeric error code, 294.

An error is returned, as the documented limit would lead one to expect, but not the error the researcher expected. The ID is associated with the business, not with Ads, so a permission error about managing advertisements is not the one that should apply here. This mismatch is the first clue: the error returned is not the one the researcher expected for a business ID.

Step 2: repeat with an application that has ads_management

The second attempt uses the application with the ads_management permission, essentially satisfying the error message from step 1, and calls the same business ID:

HTTP
HTTP GET /1506156432945949

This is the same request as before, byte for byte. The only thing that changed is which application, and therefore which token, is making the call. The reasoning is: the error told me I need ads_management, so let me give it ads_management and see what happens next.

This time the call succeeds:

JSON
{"id": "1506156432945949", "name": "00Agency"}

Line by line: id is the business record's identifier, the same number that was in the URL. name is the business's display name, 00Agency. That is the whole answer: the record was read successfully.

The researcher expected an error stating that the application is only at Developer Level access when at least Standard Level access is required. One possible explanation considered was that Developer Level might allow read access, even though the documentation does not explicitly say so, which would account for the successful read. In other words: maybe reading is fine at this level and only writing is restricted. That possibility is what the next step tests.

Step 3: try a write call

To test whether the access extends beyond reads, the researcher takes a write call from the Business Manager documentation. The documented form is:

Bash
curl
-F "vertical=RETAIL"
-F "access_token=<ACCESS_TOKEN>"
"https://graph.facebook.com/<business_id>"

Line by line: curl is the command-line tool. -F tells curl to send a form field, the same kind of field you fill in on a web page. The first field, vertical=RETAIL, is the new value to set. The second field, access_token=<ACCESS_TOKEN>, carries the wristband; the angle brackets are a placeholder meaning "put your real token here". The last line is the URL, with <business_id> as a placeholder for the record to change. This is a write request: it asks the server to change the vertical from whatever it is now to RETAIL.

Applied to the researcher's own application and business, the call becomes:

Bash
curl
-F "vertical=RETAIL"
-F "access_token=ACCESS_TOKEN"
"https://graph.facebook.com/1506156432945949"

Line by line: the placeholders are now filled in. The business ID is the real one, 1506156432945949. The token is the access token for the application with ads_management. The request asks the server to set this business's vertical to RETAIL.

The response contains only the ID of the business, which the researcher notes is probably not a good indicator of success or failure. That is an important habit: a server saying "OK" or echoing back an ID does not prove anything changed. You have to look.

Step 4: verify the change

To confirm whether the write actually took effect, the researcher reads the relevant properties back:

HTTP
/1506156432945949?fields=vertical,vertical_id

Line by line: the path points at the same business record. The question mark starts the query string, the part of a URL that carries parameters. fields=vertical,vertical_id asks the server to return only two properties: the vertical's name and its numeric ID. Asking for specific fields keeps the answer small and focused on what was changed.

The response shows the new value:

JSON
{"vertical": "RETAIL", "vertical_id": 14, "id": "1506156432945949"}

Line by line: vertical is now RETAIL, the value that was sent in the write. vertical_id is 14, the numeric code for RETAIL. id is the business record again. The vertical is now RETAIL, and the vertical ID has changed from 1 (ADVERTISING) to 14 (RETAIL).

That is the proof: the write confirms the Business Manager API was reachable at developer level. The proof of concept shows that the Business Manager API can be used from an application at developer level access, even though the access limits page explicitly states that Development and Basic level applications should not be able to do this.

What Facebook said

Facebook's first response was that the behaviour was interesting, and that the Business Manager team would be asked about it, since they may have wanted to be more restrictive about who can use their APIs.

Facebook's second response said the documentation had been updated to reflect when access is actually allowed, and that while digging into these APIs the team had found some areas of concern which were being fixed. It added that normally just a documentation change would not be enough for a bounty, but these additional issues should qualify. The researcher notes that a documentation change to clarify access is a modest outcome, and that the generosity here is appreciated.

Facebook's explanation of the actual bug was that there are a few Business Manager API endpoints which are accessible to more applications than they should be, and that the team was in the process of locking them down. The researcher's view is that finding one of these endpoints by comparing applications for access would likely have been a long process of trial and error.

Why it matters

The proof of concept demonstrates that an application at developer level access, with the ads_management permission, could read a business object and modify its vertical. The report does not go further than that: it does not describe what other Business Manager operations were reachable, nor which other applications or businesses were affected. What it does show is the value of taking a small inconsistency seriously. A mismatch between what the documentation promises and what the server actually does is a lead, and following it from a read to a write turned a documentation question into a confirmed authorisation bug.

How the fix worked

Two changes are described. First, the documentation was updated to reflect when access is actually allowed. Second, Facebook stated that the Business Manager API endpoints which were accessible to more applications than they should be were in the process of being locked down by the team. The report does not describe the technical details of the lock-down.

Things to try yourself

These are the general lessons, phrased as things you can test on any API you are allowed to test:

  1. Compare the documented access level for an API against what a lower-level application can actually do. A positive result is a call that succeeds where the documentation says it should be rejected.
  2. Take a read that succeeds at a lower level and repeat it as a write, using a documented write call for the same object. A positive result is a write that changes state, confirmed by reading the property back.
  3. When a permission error names a specific permission, satisfy that permission with a second application and retry the same call. A positive result is a different response, especially a successful one, rather than the expected level error.
  4. When a write returns only an object ID, verify the effect with a follow-up read of the changed fields. A positive result is a changed value and a changed numeric identifier, as with the vertical moving from 1 to 14 here.

Timeline

  • Oct 30, 2014 at 6:50 AM: report sent
  • Nov 5, 2014 at 2:02 AM: first response from Facebook
  • Nov 21, 2014 at 4:02 PM: second response from Facebook
  • Dec 30, 2014 at 3:07 PM: bounty awarded by Facebook
  • Jan 9, 2015 at 3:19 PM: clarification from Facebook about the actual bug

Glossary

  • API: a fixed way for one piece of software to ask another for data or actions, like a service counter with set requests and set answers.
  • Endpoint: one specific address on a server that accepts particular requests.
  • GET: an HTTP request that asks to read something and should not change anything.
  • Write request: a request that asks the server to change something, typically a POST.
  • HTTP: the protocol browsers and APIs use to exchange requests and responses.
  • curl: a command-line tool for sending HTTP requests by hand.
  • JSON: a text format for structured data using braces, names and values.
  • Token / access token: a secret string sent with each request that identifies who is calling and what they may do, like a wristband at an event.
  • Permission: a specific capability granted to an application, such as ads_management.
  • OAuth: a standard for granting an application limited access to an account without sharing the password.
  • OAuthException: an error raised by the OAuth system, usually about permissions or tokens.
  • Access level: a tier of trust (for example Development, Basic, Standard) that determines what an application may do.
  • Business Manager: Facebook's tool for organisations to manage business assets, with its own API for reading and changing business records.
  • Vertical: the industry category a business belongs to, such as ADVERTISING or RETAIL, stored with both a name and a numeric ID.
  • Logic flaw: a bug where the software follows its rules but the rules, or the way they are checked, are wrong.
  • Broken authorisation: a bug where the check that decides whether you may do something fails to stop you.
  • Proof of concept (PoC): a minimal set of steps that demonstrates a bug actually works.
  • Query string: the part of a URL after the question mark that carries parameters, such as fields=vertical,vertical_id.
  • Whitelist: a list of applications explicitly allowed to use a feature.
  • Bounty: a payment made by a company to a researcher who reports a valid security bug.

More by Philippe Harewood

View all

12 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.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.