Skip to content
IDOR Write-up Intermediate

Delete saved credit cards from any Business Manager Account

A GraphQL mutation allowed any authenticated user to delete saved credit cards from any Business Manager account by supplying the target business ID and credit card ID, without being an admin or member of that business. An attacker could remove all saved payment methods, potentially stopping the victim's ads.

Rohit Kumar Follow

Published on medium.com

Rohit kumar

Rohit kumar, on 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. 3 min read.

Context

Business Manager lets a business add and manage credit cards, but the functionality is limited to authorised "Admins" of that particular Business. The report shows how a user with no admin role, and no role at all in the victim's Business, can delete saved credit cards from any Business Manager account.

Setup

The researcher defines two users and two businesses:

Role User Business
Victim USER A (Admin) Business A
Attacker USER B (Admin) Business B

USER B is not associated with Business A. To perform the attack, the attacker needs two identifiers: the victim's Business ID and the Credit Card ID.

The victim first adds a credit card from the USER A account in Business A using this link:

Text
https://business.facebook.com/settings/payment-methods/?business_id=BUSINESS_ID

Finding it

The payment-methods feature is meant to be restricted to Admins of the Business that owns the card. The mutation used to remove a funding source, [redacted], takes a biz_id and a fs_id from the client, and the request succeeds from an account with no relationship to the target Business. That made the removal action reachable from an account with no relationship to the target Business.

From the original on medium.com

Exploitation

Step 1: Use an unrelated account

From the USER B account, which is not associated with Business A, prepare the request. The only prerequisites are the Business ID and the Credit Card ID.

Step 2: Send the removal mutation

Send a POST request to the GraphQL endpoint with the variables {"biz_id":"BUSINESS_ID_HERE","fs_id":CREDIT_CARD_ID} on [redacted]:

Text
https://business.facebook.com/api/graphql/

The researcher provides the full request as a cURL command:

  • fb_api_req_friendly_name=[redacted], which selects the mutation that removes a funding source.
  • variables, URL-encoded, carrying biz_id (the target Business) and fs_id (the credit card to remove).

Step 3: Result

Running the request removes the credit card from any Business. The report does not include the server response.

Obtaining the identifiers

The attack needs the Business ID and the Credit Card ID. The researcher lists ways to get the Credit Card ID:

  1. If you were an admin of Business A in the past and someone removed you from it, you can get the Business ID from your browsing history of Business Manager. Generally, the Credit Card ID can be read from this URL:
Text
https://business.facebook.com/settings/payment-methods/CREDIT_CARD_ID?business_id=BUSINESS_ID
  1. Alternatively, brute-force the Credit Card ID.

Root cause

The mutation takes the business and funding-source identifiers from client-supplied variables, and the request succeeds from an account with no role in the business in biz_id. This is a classic IDOR: the object reference (fs_id, scoped by biz_id) is trusted without an authorisation check against the session user. The report does not describe the server-side code or the exact check that was missing.

Impact

An attacker can remove saved credit cards from a victim's Business, which could affect the victim's business operations and terminate the ads it runs on Facebook. The victim's business operations could be affected. The attacker needs the Business ID and the Credit Card ID, and the report notes that the Credit Card ID can be brute-forced.

Fix

Facebook fixed the issue on 14 April 2020. The report does not describe the change that was made.

Timeline

Event Date
Reported 2 March 2020
Clarifications & Discussion 4 March 2020 to 26 March 2020
Pre-Triaged & Triaged 8 April 2020
Fixed 14 April 2020
Bounty Issued 16 April 2020

Variants to test

  1. Other GraphQL mutations that take a business or object ID. Try mutations that modify payment methods, users, or assets with an ID belonging to another business. A positive result is a successful state change on an object you do not own.
  2. Removal of other funding sources. Try the same biz_id/fs_id pattern against other funding-source types. A positive result is deletion of a payment method from a business you have no role in.
  3. Identifier enumeration. Where IDs are sequential or guessable, try neighbouring values. A positive result is a valid object returned or modified for an ID you did not obtain legitimately.
  4. Role checks on other admin-only actions. Test actions restricted to Admins with a non-admin account. A positive result is the action succeeding without the required role.

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 has a tool called Business Manager. A business uses it to add and manage credit cards used to pay for advertising. One of the things Business Manager lets you do is save credit cards so that ads can be paid for automatically.

Normally only the people who have been made "Admins" of a particular business are allowed to touch that business's credit cards. An Admin is a user with full control over that business. The report shows that this rule could be bypassed: a person with no role at all in someone else's business could delete the credit cards saved in it. The researcher, Rohit Kumar, published the write-up on 5 June 2020.

To understand the trick, you need a few basic ideas.

  • A web request is what your browser sends to a website when you click something. It is a short message asking the server to do something, and the server sends a reply.
  • An API (Application Programming Interface) is a set of addresses on a server that are meant to be called by software rather than by a person clicking links. Think of it as the service counter at the back of a shop: customers use the front door, but staff and delivery drivers use the counter to hand over specific forms. Facebook's graphql endpoint is such a counter.
  • A cookie is a small piece of text your browser stores for a website and sends back with every request. It is how the site recognises that the request comes from your logged-in session. Think of it as the wristband you get at an event: the staff check the wristband, not your face.
  • A token is a value, often a long random string, that proves you are allowed to do something. Facebook requests carry several of them, such as fb_dtsg, which the site uses to confirm the request really came from your session.
  • GraphQL is a way for a client to ask a server for exactly the data or action it wants, by naming an operation and passing it some named values called variables. A mutation is a GraphQL operation that changes something on the server, as opposed to a query that only reads.
  • IDOR stands for Insecure Direct Object Reference. It means the server accepts an identifier of some object (a card, a document, an account) from the client and acts on it without checking that the client is allowed to touch that object. A simple comparison: a hotel receptionist who hands over any room key to anyone who reads out a room number, without checking whether that person is staying in the room.

Impact

The report states the impact plainly: an attacker can remove all saved credit cards from a victim's business, and that stops all the ads the business is running on Facebook. The victim's business operations could be affected. In everyday terms, someone who is not part of your company can walk up to the payment desk and cancel every card on file, and your advertising stops.

Setup

The researcher sets up a small test with two users and two businesses:

Role User Business
Victim USER A (Admin) Business A
Attacker USER B (Admin) Business B

USER B is an Admin of Business B, but has nothing to do with Business A. The point of the setup is to show that the attacker does not need any role in the victim's business. The attacker only needs two numbers: the victim's Business ID and the Credit Card ID. An ID here is just a unique label the system gives to each business and each saved card, so it can tell them apart.

First, the victim adds a credit card from the USER A account in Business A, using this link:

Text
https://business.facebook.com/settings/payment-methods/?business_id=BUSINESS_ID

Line by line:

  • https://business.facebook.com is the address of Facebook's Business Manager site.
  • /settings/payment-methods/ is the page where saved payment methods, including credit cards, are listed and managed.
  • ?business_id=BUSINESS_ID is the part after the question mark, called the query string. It tells the page which business you are looking at. BUSINESS_ID is a placeholder for the real number.

This step matters because the attack needs a card to exist in the victim's business. Without a saved card there is nothing to delete.

Finding it

The payment-methods feature is meant to be limited to Admins of the business that owns the card. The operation used to remove a funding source, called [redacted], took two values from the client: biz_id (which business) and fs_id (which funding source, here the credit card). The request succeeded from an account with no role in the business named by biz_id. That made the removal action reachable from an account with no relationship to the target business.

From the original on medium.com

Exploitation

Step 1: Use an unrelated account

From the USER B account, which is not associated with Business A, the attacker prepares the request. The only prerequisites are the Business ID and the Credit Card ID.

Step 2: Send the removal mutation

The attacker sends a POST request to the GraphQL endpoint with the variables {"biz_id":"BUSINESS_ID_HERE","fs_id":CREDIT_CARD_ID} on [redacted]:

Text
https://business.facebook.com/api/graphql/

That address is the API endpoint, the service counter where Facebook's own web pages send their actions. The researcher provides the full request as a cURL command. cURL is a command-line tool that sends web requests; you can think of it as a way to type out a request by hand instead of clicking a button in the browser.

Line by line, in plain words:

  • curl is the program being run.
  • 'https://business.facebook.com/api/graphql/' is the address the request is sent to.
  • Each -H '...' adds a header, which is a labelled line of extra information sent with the request. authority and origin say which site the request is for and where it came from. user-agent describes the browser. content-type: application/x-www-form-urlencoded says the body is formatted like a web form. cookie: [redacted] is the session cookie that identifies the logged-in user; the real value is a secret and is not shown here.
  • --data '...' is the body of the request, the form fields being submitted. The fields are joined with &.
  • --compressed asks the server to send its reply compressed, to save bandwidth.

The important parts of the body are:

  • fb_api_req_friendly_name=[redacted] selects the mutation that removes a funding source. The name is a human-readable label for the operation.
  • variables, URL-encoded, carries biz_id (the target business) and fs_id (the credit card to remove). URL encoding is why the braces and quotes appear as %7B, %22 and so on: special characters are replaced with codes so they can travel safely inside a form field.

Step 3: Result

Running the request removes the credit card from any business. The report does not include the server's reply.

Obtaining the identifiers

The attack needs the Business ID and the Credit Card ID. The researcher lists ways to get the Credit Card ID:

  1. If you were an admin of Business A in the past and someone removed you from it, you can get the Business ID from your browsing history of Business Manager. Generally, the Credit Card ID can be read from this URL:
Text
https://business.facebook.com/settings/payment-methods/CREDIT_CARD_ID?business_id=BUSINESS_ID

Here the card's ID appears as part of the page address, right after payment-methods/, and the business ID appears after business_id=. Browsing history is the list of pages your browser has visited, so an old visit can still hold these numbers.

  1. Alternatively, brute-force the Credit Card ID. Brute-forcing means trying many possible values in turn until one works.

Root cause

The mutation takes the business and funding-source identifiers from values supplied by the client, and the request succeeds from an account with no role in the business in biz_id. This is a classic IDOR: the object reference (fs_id, scoped by biz_id) is trusted without an authorisation check against the session user. The report does not describe the server-side code or the exact check that was missing.

In everyday terms: the receptionist took the room number from whoever asked and handed over the key, without looking up whether that person was on the booking.

Impact

An attacker can remove saved credit cards from a victim's business, which could affect the victim's business operations and terminate the ads it runs on Facebook. The attacker needs the Business ID and the Credit Card ID, and the report notes that the Credit Card ID can be brute-forced.

Fix

Facebook fixed the issue on 14 April 2020. The report does not describe the change that was made. "Server-side" means the check happens on Facebook's computers, not in the browser, because anything the browser does can be changed by the attacker.

Timeline

Event Date
Reported 2 March 2020
Clarifications & Discussion 4 March 2020 to 26 March 2020
Pre-Triaged & Triaged 8 April 2020
Fixed 14 April 2020
Bounty Issued 16 April 2020

"Triaged" means the security team reviewed the report and accepted it as a real issue. "Bounty" is the reward paid to the researcher.

Variants to test

These are ideas for testing similar weaknesses elsewhere, each with the sign that tells you it worked:

  1. Other GraphQL mutations that take a business or object ID. Try mutations that modify payment methods, users, or assets with an ID belonging to another business. A positive result is a successful state change on an object you do not own.
  2. Removal of other funding sources. Try the same biz_id/fs_id pattern against other funding-source types. A positive result is deletion of a payment method from a business you have no role in.
  3. Identifier enumeration. Where IDs are sequential or guessable, try neighbouring values. A positive result is a valid object returned or modified for an ID you did not obtain legitimately.
  4. Role checks on other admin-only actions. Test actions restricted to Admins with a non-admin account. A positive result is the action succeeding without the required role.

Glossary

  • Admin: a user with full control over a business in Business Manager, including its payment methods.
  • API: a set of addresses on a server meant to be called by software, used to read or change data.
  • Authorisation check: a check on the server that the person making a request is allowed to do what they are asking.
  • Brute-force: trying many possible values in turn until one is accepted.
  • Business ID: the unique number that identifies a business in Business Manager.
  • Business Manager: Facebook's tool for managing a business's people, roles and payment methods.
  • Cookie: a small piece of text stored by the browser and sent with requests, used to recognise a logged-in session.
  • Credit Card ID: the unique number that identifies a saved card, here passed as fs_id.
  • cURL: a command-line program for sending web requests.
  • Endpoint: the address a request is sent to, such as https://business.facebook.com/api/graphql/.
  • Funding source: a payment method, such as a credit card, used to pay for ads.
  • GraphQL: a way for a client to name an operation and pass it named values (variables) to read or change data.
  • Header: a labelled line of extra information sent with a web request, such as cookie or user-agent.
  • IDOR (Insecure Direct Object Reference): a flaw where the server acts on an object identifier supplied by the client without checking the client is allowed to touch that object.
  • Mutation: a GraphQL operation that changes something on the server.
  • POST request: a web request that sends data in its body, typically used to submit forms or trigger changes.
  • Query string: the part of a URL after ?, carrying named values such as business_id=.
  • Session: the logged-in state of a user, recognised by cookies and tokens.
  • Token: a value, often a long random string, that proves a request is allowed or belongs to a session.
  • Triaged: reviewed and accepted as a real issue by the security team.
  • URL encoding: replacing special characters with codes (such as %22 for a quote) so they can travel safely inside a form field.
  • Variable: a named value passed to a GraphQL operation, such as biz_id or fs_id.

More by Rohit Kumar

View all

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