Skip to content
Access control Write-up Intermediate

Hacking Facebook Pages

A Facebook Graph API endpoint for managing business page permissions did not properly validate the business parameter, allowing a third-party application with manage_pages permission to add any user as a page admin and remove the legitimate admin. An attacker could thus take over a Facebook page and permanently remove the real owner's admin access.

Laxman Muthiyah Follow

Published on thezerohack.com

Bounty$2,500 View original

A security vulnerability in Facebook business manager endpoint allows a third party application to hack Facebook account page with limited permissions and the victim will permanently lose admin access to the page.

Laxman Muthiyah, on thezerohack.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

Facebook Pages are managed through roles: a page can have a manager, editor, analyst and other role types. Third-party applications acting on a user's behalf are, by design, not allowed to add or modify those page admin roles. An application can post statuses, publish photos and perform other page operations, but it cannot add or remove admins. The reason is straightforward: if an application could add an admin, it could add an arbitrary user to the page and then remove the real owner, permanently locking the legitimate owner out.

Separately, Facebook exposes a business manager endpoint for business pages, called userpermissions, which does allow adding or removing business page admin roles for people who already handle the Facebook business. The vulnerability described here is that this endpoint could be reached in a way that bypassed the restriction on ordinary, non-business pages.

Setup

The precondition is an application holding the manage_pages permission granted by a page admin. The requests use an application access token carrying the manage_pages permission. The requests target the Graph API host graph.facebook.com and use the page identifier, the target user identifier, the associated business identifier and the application access token.

Finding it

The researcher started from the documented behaviour of the business endpoint: a request to /<page_id>/userpermissions with a role, a user, a business and an access_token adds the named user as an admin of the business page. That request works as intended for business pages.

The interesting observation came during testing: removing the business parameter from the request did not produce an error. Instead, the call still succeeded, which meant the endpoint could add anyone as a new page admin, and could also delete the actual page admin, on a non-business page, as long as the application held manage_pages permission. In other words, the check that should have limited this endpoint to business pages was not enforced when the parameter was absent.

Exploitation

Step 1: add the target user as manager

The following request makes the target user an admin of the page.

HTTP
POST /<page_id>/userpermissions HTTP/1.1
Host :  graph.facebook.com
Content-Length: 245

role=MANAGER&user=<target_user_id>&business=<associated_business_id>&access_token=<application_access_token>

The response is:

Text
true

role=MANAGER sets the role being granted, user is the account being added, business ties the request to the associated business, and access_token is the application token carrying manage_pages.

Step 2: drop the business parameter

After a few minutes of testing, the researcher found that removing the business parameter from the request did not throw any error. The same call then added anyone as a new page admin and allowed deleting the actual page admin on a non-business page where the application had manage_pages permission.

Step 3: final proof of concept of page takeover

The takeover request, without the business parameter:

HTTP
POST /<page_id>/userpermissions HTTP/1.1
Host :  graph.facebook.com
Content-Length: 245

role=MANAGER&user=<target_user_id>&access_token=<application_access_token>

The response is:

Text
true

Step 4: remove the victim

With the attacker's chosen user now a manager, the original admin is removed with a DELETE on the same endpoint:

HTTP
Delete /<page_id>/userpermissions HTTP/1.1
Host :  graph.facebook.com
Content-Length: 245

user=<target_user_id>&access_token=<application_access_token>

The response is:

Text
true

At that point, in the author's words, the target page is hacked.

Root cause

The endpoint was written for business pages, where adding and removing admin roles is a legitimate operation for users who already handle the business. The report does not describe the server-side implementation, so the exact check that was missing is not stated. The restriction that keeps third-party applications from touching page roles on ordinary pages was therefore not applied on this path. The report does not describe the server-side implementation, so the exact check that was missing is not stated; the behaviour is consistent with the business context being optional rather than required.

By default the application interface does not allow third-party applications to add or modify page admin roles.

Impact

Any application holding manage_pages permission from a page admin could add an arbitrary user as a manager of that admin's pages and then delete the real admin, on non-business pages. The author's summary is blunt: whatever the application is, if it has the manage_pages permission of the admin, it could take over all of that admin's Facebook pages in a fraction of seconds. The victim permanently loses admin access to the page.

The condition is the permission grant: the attack works where the application has manage_pages for the admin in question.

Fix

The vulnerability was reported to the Facebook security team and is completely fixed. The researcher notes that even with the fix in place, users should be aware of the permissions they grant to applications: when manage_pages is requested, the application will be able to manage the user's pages, including posting statuses and publishing photos. Users can still modify the permissions granted to other applications in their Facebook settings.

Laxman Muthiyah
Laxman Muthiyah From the original on thezerohack.com

The image accompanies the acknowledgement of the fix from Facebook after a few emails.

Variants to test

  1. Remove optional scoping parameters from role or membership endpoints and see whether the call still succeeds. A positive result is a true response where the request should have been rejected for missing context.
  2. Try the same endpoint against a non-business object with a token that only carries the delegated permission, not an admin session. A positive result is a role change on an object the token should not be able to administer.
  3. Attempt the DELETE form of the membership call with only the target user and the application token. A positive result is removal of an existing admin without an owner-level session.
  4. Compare behaviour with and without the business identifier on the same page and token, and check whether error handling differs. A positive result is identical success responses in both cases.

Timeline

The researcher received $2,500 USD through Facebook's bug bounty programme.

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

What happened, in plain words

Facebook Pages are the public profiles that businesses, bands and organisations use on Facebook. A page is not run by one person alone: it has a set of people with different jobs, called roles. One person might be a manager, another an editor, another an analyst. Each role comes with different powers, and the manager role is the most powerful one because a manager can change who else is on the list.

Facebook also lets outside developers build applications that work with Facebook on a user's behalf. When you install such an application, it asks for permissions: a list of things it is allowed to do for you. One of those permissions is called manage_pages, and it lets the application look after your pages, for example by posting statuses or publishing photos.

There is an important rule in that design. An application is not supposed to be able to add or change the admin roles on a page. The reason is easy to see: if an application could add an admin, it could quietly add some other account as an admin and then remove the real owner, and the real owner would be locked out for good.

Separately, Facebook has a feature for businesses, called Business Manager, with its own programming interface. That interface has an address, called an endpoint, named userpermissions, and it does allow adding or removing admin roles on business pages, for people who already help run the business.

The bug in this report is that this business endpoint could be reached in a way that skipped the rule protecting ordinary, non-business pages. A third-party application with only the manage_pages permission could use it to add an account of the attacker's choosing as a manager of someone's page, and then delete the real admin. The victim permanently loses admin access to the page.

Laxman Muthiyah
Laxman Muthiyah From the original on thezerohack.com

The pieces you need to know first

Before walking through the attack, here are the few ideas it relies on, explained from zero.

An API and an endpoint. An API is a way for one piece of software to talk to another, a bit like a waiter in a restaurant: you give an order in a fixed format, the kitchen does the work, and the waiter brings back the result. An endpoint is one specific dish on that menu, one address that accepts one kind of order. Here the endpoint is /<page_id>/userpermissions on the host graph.facebook.com, which is Facebook's Graph API, the programming interface behind most of Facebook.

A request and a response. When software talks to an API it sends a request: a method (what kind of action, such as POST to create something or DELETE to remove something), an address, some headers (extra information about the request) and sometimes a body (the details). The server answers with a response, which here is simply the word true when the action worked.

An access token. A token is a short string of characters that proves who is asking. Think of a cloakroom ticket: you do not carry your coat around, you carry the ticket, and whoever holds the ticket can collect the coat. In the same way, an application does not need your password; it holds a token that was issued when you granted it permission. The token in these requests is an application access token, and it carries the manage_pages permission.

Permissions. A permission is a specific, named allowance. manage_pages means "this application may manage your pages". You grant permissions through a dialog box when you install an application, and you can change them later in your Facebook settings.

The vulnerability class. This is a broken authorisation problem, also called broken access control. Authorisation means deciding whether the person or program asking is allowed to do the thing it is asking for. When that decision is missing or can be avoided, the result is broken authorisation. A simple comparison: a hotel key card that opens your own room should not open every room on the floor, and if it does, the lock is checking that the card is valid but not which room it belongs to. Here the endpoint accepted a request that should have been limited to business pages.

Privilege escalation. Privilege means how much power an account has. Escalation means getting more power than you were given. Adding an account as a manager when it should only have been able to post photos is an escalation.

The setup

The precondition for the whole attack is an application that holds the manage_pages permission granted by a page admin. The requests use an application access token carrying the manage_pages permission.

The requests all go to the Graph API host graph.facebook.com, and they use four pieces of information: the page identifier, the target user identifier (the account to be added), the associated business identifier, and the application access token.

Finding it

The researcher started from how the business endpoint is documented to behave. A request to /<page_id>/userpermissions carrying a role, a user, a business and an access_token adds the named user as an admin of the business page. For business pages, that is the intended behaviour, and it works.

The interesting moment came during testing. Removing the business parameter from the request did not produce an error. The call still succeeded. That meant the endpoint could add anyone as a new page admin, and could also delete the actual page admin, on a non-business page, as long as the application held manage_pages. In plain terms, the check that should have kept this endpoint limited to business pages was not enforced when the parameter was absent.

Exploitation

Step 1: add the target user as manager

The following request makes the target user an admin of the page.

HTTP
POST /<page_id>/userpermissions HTTP/1.1
Host :  graph.facebook.com
Content-Length: 245

role=MANAGER&user=<target_user_id>&business=<associated_business_id>&access_token=<application_access_token>

The response is:

Text
true

Line by line:

  • POST /<page_id>/userpermissions HTTP/1.1 is the first line of the request. POST is the method, the verb that says "create or change something". The address is the page identifier followed by the endpoint name userpermissions. HTTP/1.1 is the version of the web protocol being used.
  • Host : graph.facebook.com tells the server which site the request is for. Facebook runs many services, and this header points at the Graph API.
  • Content-Length: 245 says how long the body of the request is, in bytes, so the server knows where the body ends.
  • The blank line separates the headers from the body.
  • role=MANAGER&user=<target_user_id>&business=<associated_business_id>&access_token=<application_access_token> is the body. It is a list of name and value pairs joined by &. role=MANAGER sets the role being granted. user is the account being added. business ties the request to the associated business. access_token is the application token carrying manage_pages.

Why this step: it is the documented, legitimate use of the endpoint, and it establishes that the request format works. You have to know what normal looks like before you can spot what is abnormal.

Step 2: drop the business parameter

After a few minutes of testing, the researcher found that removing the business parameter from the request did not throw any error. The same call then added anyone as a new page admin and allowed deleting the actual page admin on a non-business page where the application had manage_pages permission.

Why this step: the business parameter is what marks the request as a business page operation. If the server treats it as optional, then leaving it out may let the same powerful action run against pages that were never meant to be reachable this way. Removing one input and watching whether the answer changes is one of the simplest and most effective tests in security work.

Step 3: final proof of concept of page takeover

The takeover request, without the business parameter:

HTTP
POST /<page_id>/userpermissions HTTP/1.1
Host :  graph.facebook.com
Content-Length: 245

role=MANAGER&user=<target_user_id>&access_token=<application_access_token>

The response is:

Text
true

Line by line:

  • The method, address, host and content length are the same as before.
  • The body now has only three pairs. role=MANAGER still grants the manager role, user is still the account being added, and access_token is still the application token. The business pair is gone.
  • The response true means the server accepted the request and performed the change, even though the request no longer says which business it belongs to.

Why this step: this is the proof. The same action that was supposed to be limited to business pages now works on an ordinary page, using only the permission an application was already given.

Step 4: remove the victim

With the attacker's chosen user now a manager, the original admin is removed with a DELETE on the same endpoint:

HTTP
Delete /<page_id>/userpermissions HTTP/1.1
Host :  graph.facebook.com
Content-Length: 245

user=<target_user_id>&access_token=<application_access_token>

The response is:

Text
true

Line by line:

  • Delete is the method, the verb that says "remove something". The address is the same endpoint on the same page.
  • The body now has only two pairs: user, the account to be removed, and access_token, the application token.
  • The response true means the removal succeeded.

Why this step: adding an account as manager is only half of a takeover. The other half is removing the real owner, so that the owner can no longer undo the change. Once both have happened, the attacker-controlled account holds a manager role and the legitimate admin has lost access.

Root cause

The endpoint was written for business pages, where adding and removing admin roles is a legitimate operation for people who already help run the business. The report does not describe the server-side implementation, so the exact check that was missing is not stated. The rule that keeps third-party applications from touching page roles on ordinary pages was therefore not applied on this path.

The behaviour is consistent with the business context being optional rather than required. By default the application interface does not allow third-party applications to add or modify page admin roles.

Impact

Any application holding manage_pages permission from a page admin could add an arbitrary user as a manager of that admin's pages and then delete the real admin, on non-business pages. The author's summary is blunt: whatever the application is, if it has the manage_pages permission of the admin, it could take over all of that admin's Facebook pages in a fraction of seconds.

The condition is the permission grant: the attack works where the application has manage_pages for the admin in question. The report does not describe any other precondition.

Fix

The vulnerability was reported to the Facebook security team and is completely fixed. The researcher notes that even with the fix in place, users should be aware of the permissions they grant to applications. When manage_pages is requested, the application will be able to manage the user's pages, including posting statuses and publishing photos. Users can still modify the permissions granted to other applications in their Facebook settings.

Laxman Muthiyah
Laxman Muthiyah From the original on thezerohack.com

The image accompanies the acknowledgement of the fix from Facebook after a few emails.

Variants to test

  1. Remove optional scoping parameters from role or membership endpoints and see whether the call still succeeds. A positive result is a true response where the request should have been rejected for missing context.
  2. Try the same endpoint against a non-business object with a token that only carries the delegated permission, not an admin session. A positive result is a role change on an object the token should not be able to administer.
  3. Attempt the DELETE form of the membership call with only the target user and the application token. A positive result is removal of an existing admin without an owner-level session.
  4. Compare behaviour with and without the business identifier on the same page and token, and check whether error handling differs. A positive result is identical success responses in both cases.

Timeline

The researcher received $2,500 USD through Facebook's bug bounty programme.

Glossary

  • API: a fixed way for one piece of software to ask another to do something, like a menu of orders a kitchen will accept.
  • Endpoint: one specific address on an API that accepts one kind of request.
  • Request: the message software sends to a server, made of a method, an address, headers and sometimes a body.
  • Response: the message the server sends back, here the word true when an action worked.
  • Method: the verb at the start of a request, such as POST to create or change something and DELETE to remove something.
  • Header: extra information attached to a request, such as which host it is for or how long the body is.
  • Body: the part of a request that carries the details, here the name and value pairs.
  • Parameter: one named value in a request, such as role or user.
  • Access token: a string that proves who is asking, like a cloakroom ticket, so the application does not need your password.
  • Application access token: a token issued to an application when a user grants it permissions.
  • Permission: a named allowance, such as manage_pages, that a user grants to an application.
  • manage_pages: the permission that lets an application manage a user's pages, for example by posting statuses and publishing photos.
  • Facebook Page: the public profile a business or organisation uses on Facebook.
  • Page role: a job on a page, such as manager, editor or analyst, each with different powers.
  • Admin: a person with the highest level of control over a page, including who else is on the role list.
  • Business Manager: Facebook's feature for businesses, with its own interface for managing business pages.
  • Graph API: Facebook's programming interface, reached at graph.facebook.com.
  • Authorisation: the decision about whether the person or program asking is allowed to do the thing it is asking for.
  • Broken authorisation / broken access control: a flaw where that decision is missing or can be avoided.
  • Privilege escalation: getting more power on an account or page than you were given.
  • Proof of concept: a concrete request that demonstrates a vulnerability really works.
  • Page takeover: gaining control of a page and locking the real owner out.
  • Bug bounty programme: a scheme where a company pays researchers who report security flaws to it.
  • Disclosed: made public, here the date the report was published.

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.