Skip to content
Business logic Write-up Intermediate

How I could’ve bought anything for Free from Facebook Business Pages

A buyer could manipulate order invoice requests to mark an order as paid without actually paying, by first cancelling the order and then sending a modified mark-as-paid request that automatically reactivated the order. This allowed the buyer to register a fake payment on behalf of the seller page and potentially receive goods for free.

Samip Aryal Follow

Published on infosecwriteups.com

Bounty$250 View original

Facebook allows Facebook Pages to create and manage orders and payouts using Order Invoices. The invoice contains four different sections to be marked chronologically for the selling page to finally ship/dispatch the order.

Samip Aryal, on infosecwriteups.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 lets Pages create and manage orders and payouts through Order Invoices. An invoice has four sections that are marked in sequence so that the selling page can finally ship or dispatch the order.

From the original on infosecwriteups.com
Order Invoice Base Format @ Facebook-Messenger for Commerce

Each of those sections has a corresponding synced section in the Orders and Management tab of Meta Business Suite.

Orders and Payouts management tab @ Meta Business Suite From the original on infosecwriteups.com

Business and commerce pages on Meta (Facebook, Instagram) that sell products through the platform create these invoices to keep track of an order. In the normal flow the buyer first confirms the order. After the buyer pays, only the seller page can mark the order as paid or dispatched. The buyer can then complete the trade by marking the order as received, if they want. So the buyer's own actions on the invoice are limited:

From the original on infosecwriteups.com

Setup

The researcher was testing the Page Messaging section of Android Messenger, also called Messenger for Commerce, on Android. No special tooling is described: the work was done by comparing the requests the app sends when each section of the invoice is marked.

Finding it

Out of curiosity about the payment invoice, the researcher compared a batch of requests made when marking each section of the invoice. Confirming the order as the buyer produced a different kind of POST request, but marking the order as received produced a request similar to the ones sent when marking as paid or dispatched. The POST requests for marked as received and marked as paid were almost identical and contained identical parameters.

Post Request when marking as received From the original on infosecwriteups.com

The only difference was the action_identifier: the first contained mcom_mark_as_received with status_step=3, while marking as paid from the seller page's side contained mcom_mark_as_paid with status_step=1.

Two requests belonging to two different parties, the seller page and the buyer, with different privilege settings, were identical, and there appeared to be no proper actor permission checks on the action initially. That raised the question: as a buyer, could one capture a dummy mark_as_received request from another invoice, replace the target_id with the target order invoice id and the action_identifier with mcom_mark_as_paid, and register a payment for the target invoice on behalf of the page?

It did not work. The attempt returned an error because a permission check was required to complete the mcom_mark_as_paid request. The important parameters, mark_as_paid among them, did have proper permission checks.

After some fuzzing, however, the researcher found another action identifier, mcom_cancel, which pushes the order invoice into a cancelled state. This endpoint had no permission barriers and was accessible to both parties, the buyer and the seller page. The cancelled state of the invoice could also be reverted automatically into an active state by firing any of the POST requests above. The cancelled state seemed to have no relation to actor privilege checks.

Exploitation

Step 1: cancel the target invoice

The idea was to force the order invoice into a cancelled state by triggering the mcom_cancel action identifier, then fire the modified request carrying mcom_mark_as_paid in the action_identifier as a buyer, so that the invoice is automatically brought back to an active state. The open question was whether it would also mark the order paid while turning active.

From the original on infosecwriteups.com

It did. The cancelled state could be reverted by firing the mark-as-paid request, and the invoice came back active with the payment registered.

Step 2: point the request at a victim invoice

With that confirmed, the method is to take the dummy mark_as_received POST request captured using one's own page, replace its target_id with the target order invoice id of any other victim business page, and send it with the action_identifier set to mcom_mark_as_paid. The full payment is then registered without the buyer paying the actual amount.

Root cause

The mcom_cancel action had no actor permission checks and was available to both the buyer and the seller page. The cancelled state was not tied to actor privilege checks, and any of the POST requests above could move an invoice out of it back to active. The report does not explain why the cancel-and-reactivate path succeeded where the direct request was rejected.

Impact

Any malicious buyer could place orders, manipulate the endpoint requests, register a fake payment on behalf of the page itself and buy items for free. Every action happens on behalf of the page, so the details are recorded and shown as if the page itself cancelled the request or marked it as paid. The activity is synced with the Orders and Payouts management section of Meta Business Suite, where the order reaches the waiting for dispatch/ship section marked as paid, alongside genuine orders. In most cases the seller page might ship orders once they appear paid and waiting for dispatch.

The report was triaged in May 2022, fixed in July 2022, and rewarded on 19 July 2022 with 250 USD.

Fix

The report does not describe the change that was made.

Variants to test

  1. Compare the requests for each state transition of a multi-party workflow and look for one action available to both parties with no permission check. A positive result is a request from the lower-privileged party that changes state successfully.
  2. Try reverting a terminal state (cancelled, rejected, expired) by firing an unrelated action request. A positive result is the object returning to active without the privilege required for that action.
  3. Swap the action_identifier between two requests that share identical parameters. A positive result is the privileged action succeeding from the unprivileged account.
  4. Replace the target_id of a request captured on your own object with another object's id. A positive result is the action applying to the other object.
  5. Fuzz action identifiers around the known ones to find undocumented actions. A positive result is an action that changes state without an authorisation error.

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

What happened, in plain words

Facebook lets businesses sell things directly through their Pages. When you buy something from one of those Pages, Facebook creates a record called an Order Invoice. Think of it like a paper receipt that both you and the shop can see and write on, but each of you is only supposed to write in certain boxes.

The invoice moves through a series of stages. You confirm the order, the shop marks it as paid once your money arrives, the shop marks it as dispatched when it ships, and you mark it as received when the parcel turns up. The shop is meant to ship once it sees the order marked as paid.

Samip Aryal found that the app's requests for two of these stages, "mark as received" (which a buyer is allowed to send) and "mark as paid" (which only the shop is allowed to send), were almost the same. When he tried to send the shop-only request himself, Facebook blocked it. But he then found a third request, "cancel", that anyone could send, and discovered that cancelling an invoice and then sending the shop-only request would quietly flip the invoice back to active and mark it as paid, without any permission check. The result: a buyer could make the shop believe it had been paid, without paying anything.

From the original on infosecwriteups.com

The report was triaged in May 2022, fixed in July 2022, and rewarded on 19 July 2022 with 250 USD.

The product and the feature

Before the bug makes sense, you need to know what the feature is.

Facebook (and Instagram, both owned by Meta) lets a business run a Page. A Page is the business's public profile, separate from a personal account. Businesses that sell through the platform use a feature called Order Invoices to keep track of each order and each payout.

An invoice has four sections, and they are meant to be marked in order, one after another, so that the selling page can finally ship or dispatch the order.

Order Invoice Base Format @ Facebook-Messenger for Commerce From the original on infosecwriteups.com

Order Invoice Base Format @ Facebook-Messenger for Commerce

Each of those four sections also has a matching section in a separate management screen, the Orders and Management tab of Meta Business Suite. Meta Business Suite is the website where a business manages its Pages, orders and payouts. The invoice in the chat app and the order list in Business Suite are two views of the same record, kept in sync.

Orders and Payouts management tab @ Meta Business Suite From the original on infosecwriteups.com

Orders and Payouts management tab @ Meta Business Suite

Business and commerce pages on Meta that sell products through the platform create these invoices to keep track of an order. Here is the normal flow:

  1. The buyer confirms the order.
  2. The buyer pays.
  3. Only the seller page can mark the order as paid or dispatched.
  4. The buyer can then complete the trade by marking the order as received, if they want.

So the buyer's own actions on the invoice are limited:

From the original on infosecwriteups.com

Notice the asymmetry. The buyer can confirm and can mark received. The seller page is the only party that can mark paid or dispatched.

The setup

The researcher was testing the Page Messaging section of Android Messenger, also called Messenger for Commerce, on Android. No special tooling is described in the report. The work was done by comparing the requests the app sends when each section of the invoice is marked.

  • A commerce page of your own, used to create a dummy invoice and capture the requests it generates. Your own page is the safe sandbox: you can press every button and watch what the app sends.
  • A target order invoice belonging to another business page, the one you want to affect.

Finding it

Out of curiosity about the payment invoice, the researcher compared a batch of requests made when marking each section of the invoice. Confirming the order as the buyer produced a different kind of POST request, but marking the order as received produced a request similar to the ones sent when marking as paid or dispatched. The POST requests for marked as received and marked as paid were almost identical and contained identical parameters.

Post Request when marking as received From the original on infosecwriteups.com

Post Request when marking as received

The only difference was the action_identifier: the first contained mcom_mark_as_received with status_step=3, while marking as paid from the seller page's side contained mcom_mark_as_paid with status_step=1.

Two requests belonging to two different parties, the seller page and the buyer, with different privilege settings, were identical, and there appeared to be no proper actor permission checks on the action initially. That raised the question: as a buyer, could one capture a dummy mark_as_received request from another invoice, replace the target_id with the target order invoice id and the action_identifier with mcom_mark_as_paid, and register a payment for the target invoice on behalf of the page?

It did not work. The attempt returned an error because a permission check was required to complete the mcom_mark_as_paid request. The important parameters, mark_as_paid among them, did have proper permission checks.

After some fuzzing, however, the researcher found another action identifier, mcom_cancel, which pushes the order invoice into a cancelled state. This endpoint had no permission barriers and was accessible to both parties, the buyer and the seller page. The cancelled state of the invoice could also be reverted automatically into an active state by firing any of the POST requests above. The cancelled state seemed to have no relation to actor privilege checks.

Exploitation

Step 1: cancel the target invoice

The idea was to force the order invoice into a cancelled state by triggering the mcom_cancel action identifier, then fire the modified request carrying mcom_mark_as_paid in the action_identifier as a buyer, so that the invoice is automatically brought back to an active state. The open question was whether it would also mark the order paid while turning active.

From the original on infosecwriteups.com

It did. The cancelled state could be reverted by firing the mark-as-paid request, and the invoice came back active with the payment registered.

Step 2: point the request at a victim invoice

With that confirmed, the method is to take the dummy mark_as_received POST request captured using one's own page, replace its target_id with the target order invoice id of any other victim business page, and send it with the action_identifier set to mcom_mark_as_paid. The full payment is then registered without the buyer paying the actual amount.

Root cause

The mcom_cancel action had no actor permission checks and was available to both the buyer and the seller page. The cancelled state was not tied to actor privilege checks, and any of the POST requests above could move an invoice out of it back to active. The report does not explain why the cancel-and-reactivate path succeeded where the direct request was rejected.

Impact

Any malicious buyer could place orders, manipulate the endpoint requests, register a fake payment on behalf of the page itself and buy items for free. Every action happens on behalf of the page, so the details are recorded and shown as if the page itself cancelled the request or marked it as paid. The activity is synced with the Orders and Payouts management section of Meta Business Suite, where the order reaches the waiting for dispatch/ship section marked as paid, alongside genuine orders. In most cases the seller page might ship orders once they appear paid and waiting for dispatch.

Fix

The report does not describe the change that was made.

Variants to test

  1. Compare the requests for each state transition of a multi-party workflow and look for one action available to both parties with no permission check. A positive result is a request from the lower-privileged party that changes state successfully.
  2. Try reverting a terminal state (cancelled, rejected, expired) by firing an unrelated action request. A positive result is the object returning to active without the privilege required for that action.
  3. Swap the action_identifier between two requests that share identical parameters. A positive result is the privileged action succeeding from the unprivileged account.
  4. Replace the target_id of a request captured on your own object with another object's id. A positive result is the action applying to the other object.
  5. Fuzz action identifiers around the known ones to find undocumented actions. A positive result is an action that changes state without an authorisation error.

Glossary

  • API: the set of addresses and rules an app uses to talk to a server. When the Messenger app marks an order as paid, it is really sending a message to an API.
  • Request: one message sent from an app or browser to a server, asking it to do something or return something.
  • POST request: a request that sends data to the server to create or change something, as opposed to simply asking to view a page.
  • Parameter: a named piece of data inside a request, like a field on a form. target_id and action_identifier are parameters.
  • Endpoint: the specific address on the server that a request is sent to, the destination that handles that kind of action.
  • action_identifier: the parameter that tells the server which action is being requested, for example marking an order as received or as paid.
  • target_id: the parameter that identifies which record the action applies to, here the order invoice.
  • status_step: a parameter that records which stage of the invoice flow the action belongs to.
  • Order Invoice: Facebook's record of a single order between a buyer and a selling Page, with stages for confirmed, paid, dispatched and received.
  • Meta Business Suite: the website where a business manages its Pages, orders and payouts.
  • Messenger for Commerce: the part of Facebook Messenger used by business Pages to handle orders and customer conversations.
  • Permission check: the server-side test that asks whether the person or page sending a request is allowed to do this action on this record.
  • Authorisation: deciding what an authenticated party is allowed to do. Authentication is proving who you are; authorisation is what you may then do.
  • Privilege: the level of access a party has. A seller page has the privilege to mark an order paid; a buyer does not.
  • Actor: the party performing an action, here either the buyer or the seller page.
  • State: the current stage a record is in, such as active, cancelled or paid.
  • State transition: a change from one state to another, for example from cancelled back to active.
  • Fuzzing: trying many small variations of an input automatically to see which ones produce an unexpected result.
  • Payment bypass: a vulnerability class where a payment step is skipped or faked, so goods or services are obtained without paying.
  • Triaged: the stage where the security team has reviewed a report and confirmed it is a real issue.
  • Dummy invoice: a test order created on your own page so you can capture its requests safely.
  • Victim: the party harmed by the attack, here the business page whose order is falsely marked paid.

More by Samip Aryal

View all

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

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.