Skip to content
IDOR Write-up Beginner

What is Portal Facebook

The Facebook Messenger send endpoint accepted an image_ids parameter that referenced any attachment by its numeric ID without checking ownership. An attacker could change that ID to another user's attachment ID and disclose private images, files, videos and audio messages across Facebook chat infrastructure.

Sarmad Hassan Follow

Published on medium.com

Bounty$15,000 View original

Hello community, today I would like to share with you my most critical bug that I found in Facebook so far, so let’s get started :)

Sarmad Hassan (Juba Baghdad), 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. 4 min read.

## Context

Facebook Portal is a video communication device from Facebook. The researcher's target was the Portal site, `portal.facebook.com`, and specifically the chat feature reachable from it. The chat is not a separate messaging system: the report states that the same chat infrastructure serves Facebook main chat, Messenger, Portal chat and Workplace chat, and that the bug reproduced from any of them because "its the same".

The feature of interest is the attachment upload in the chat: images, videos and files can be sent as messages. The researcher's earlier testing of `portal.facebook.com` had found nothing; the finding came from a feature that appeared on a later visit.

## Setup

- Target: `portal.facebook.com`, Account Setting section, and the chat reachable from it.
- Tool: Burp Suite, used to intercept the upload request and to hold the request in the proxy tab.
- Accounts: the report does not describe the accounts used, only that the researcher could send attachments in his own chat and then reference other users' attachment IDs.
- Precondition for reproduction: the request had to be kept live in the Burp proxy tab. Sending it to Repeater produced an error, and the researcher says he did not know why at the time of writing.

## Finding it

On 22 January 2019 the researcher opened `portal.facebook.com` again and switched to Account Setting, where he saw something he had not seen before: a Support Bot chat.


{{media:1}}


*Support Bot chat in portal Facebook*

In that chat, attachments such as images, videos and files can be uploaded. He uploaded a normal image and intercepted the resulting request to inspect its parameters.

## Exploitation

### Step 1: capture the attachment send request

The intercepted request was:

```http
POST /messaging/send/ HTTP/1.1
Host: www.facebook.com

client=mercury&action_type=ma-type:user-generated-message&body=&ephemeral_ttl_mode=0&has_attachment=true&image_ids[0]=123&message_id=111&offline_threading_id=123
```

The interesting parameter is `image_ids[0]`, which refers to the image uploaded in the Portal Facebook chat. The report highlights `image_ids[0]` as the interesting parameter, referring to the uploaded image.

### Step 2: change the attachment ID

The researcher asked what would happen if the ID in `image_ids[0]` were changed to another user's image ID, and whether the same would work for other attachment types (files, videos and audio messages). After testing extensively in the Portal chat, he found that he could disclose any attachment sent by other users through the chat: images, files, videos and audio messages.

### Step 3: reproduce from other chat surfaces

The same manipulation worked in all Facebook chat infrastructure: Facebook main chat, Messenger, Portal chat and Workplace chat. The report states the bug could be reproduced from any of those chats because they are the same system.

### Step 4: keep the request in the proxy

A practical condition: the request had to remain live in the Burp proxy tab for the reproduction to succeed. Sending it to Repeater returned an error.

## Root cause

The send request carries an attachment identifier supplied by the client (`image_ids[0]`). The report does not describe the server-side code; the observable behaviour is that a changed ID returned another user's attachment. The identifier is therefore an object reference that can be swapped for another user's, which is the classic IDOR pattern.

## Impact

The researcher frames the impact in privacy terms. An attacker who found the bug could build a tool to brute force other users' IDs (image IDs, video IDs, file IDs and audio message IDs) and disclose attachments belonging to any user, including, as he puts it, a very VIP person's audio messages, photos or videos. The exposure applies to the millions of users who use Facebook chat every day, and across all of the chat surfaces listed above.

## Fix

Facebook fixed the bug and confirmed the fix on 13 February 2019. A fix for this class of issue would be an authorisation check on the server, verifying that the referenced attachment belongs to the authenticated sender.

## Timeline

| Date | Event |
| --- | --- |
| 22 Jan 2019 | Initial report |
| 04 Feb 2019 | Report triaged |
| 13 Feb 2019 | Bug fixed |
| 13 Feb 2019 | Fix confirmed |
| 13 Feb 2019 | 15,000 USD bounty awarded |


{{media:2}}


## Variants to test

1. **Other attachment parameters.** The report names `image_ids[0]` and says files, videos and audio messages were also affected. Try swapping identifiers for each attachment type for an ID belonging to another account. Try swapping each one for an ID belonging to another account and check whether the attachment is returned.
2. **Array indices.** `image_ids[0]` is an array element. Try additional indices and multiple attachments in one message to see whether any index bypasses the ownership check.
3. **Other chat clients.** The report says the bug worked from Facebook main chat, Messenger, Portal chat and Workplace chat. On a similar multi-client messaging product, test the send endpoint from each client, since a check may exist in one and be missing in another.
4. **Proxy versus Repeater.** The researcher could only reproduce with the request held in the Burp proxy tab; Repeater gave an error. When a request fails in Repeater, replay it through the proxy before concluding the bug is not there.
5. **Re-test over time.** The feature that exposed the bug (the Support Bot chat) was not present on the earlier visit. Revisit targets periodically and look for new features, as the researcher's first takeaway advises.

## Takeaways

The researcher's own conclusions: test your target from time to time, because you may see something you never saw before; and do not trust the response, since getting an error does not mean it is the end.

He thanks the Facebook Security Team for the bounty and Kassem Bazzoun, 張啟�
� and Max Pasqua for their support.

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

A security researcher found a way to see other people's private chat attachments on Facebook: photos, videos, files and audio messages that were never meant for him. He did it by changing a number in a request that his own browser sent when he uploaded a picture in a chat. The number identified his picture; when he replaced it with a different number, Facebook sent back somebody else's picture. The same trick worked for every kind of attachment and on every Facebook chat surface: the main Facebook chat, Messenger, Portal chat and Workplace chat. Facebook fixed the bug and paid him 15,000 US dollars.

This article walks through the whole story slowly, explaining every technical idea as it appears, so that someone who has only ever used a browser can follow it.

## Background: what Portal is and what the chat does

Facebook Portal is a video communication device made by Facebook. You can read more about it on Facebook's own Portal page.

The researcher's target was the website that goes with Portal, at `portal.facebook.com`. That site lets you manage the device and, importantly for this story, it includes a chat feature. The chat is not a separate messaging system: the report says the same chat infrastructure serves Facebook's main chat, Messenger, Portal chat and Workplace chat. In other words, all of these are different doors into one building. That matters later, because a bug in one door is a bug in all of them.

The feature that turned out to be interesting is the attachment upload in the chat. You can send images, videos and files as messages. The researcher had tested `portal.facebook.com` before and found nothing. The finding came from a feature that appeared on a later visit.

## The tools and the setup

- **Target:** `portal.facebook.com`, the Account Setting section, and the chat you can reach from there.
- **Tool:** Burp Suite. Burp is a program that sits between your browser and a website and lets you look at, and change, the traffic going back and forth. Think of it as a transparent envelope that you can open, read and rewrite before it reaches the recipient. The researcher used it to intercept the upload request and to keep that request alive in the proxy tab.
- **Accounts:** the report does not describe the accounts used. It only says that the researcher could send attachments in his own chat and then reference other users' attachment IDs.
- **A condition for reproducing the bug:** the request had to be kept live in the Burp proxy tab. Sending it to Burp's Repeater tool produced an error, and the researcher says he did not know why at the time of writing. Repeater is another part of Burp that lets you send the same request over and over; the proxy tab is the part that watches traffic as it flows. The difference mattered here, which is unusual and worth remembering.

## How he found it

On 22 January 2019 the researcher opened `portal.facebook.com` again and switched to Account Setting. There he saw something he had not seen before: a Support Bot chat.


{{media:1}}


*Support Bot chat in portal Facebook*

A Support Bot is an automated helper: a chat window where a program, not a person, answers you. In that chat, attachments such as images, videos and files can be uploaded. He uploaded a normal image and intercepted the resulting request so he could inspect its parameters.

Why do this? Because every time your browser sends something to a website, it sends a package of data. If you can read that package, you can see which pieces of it the website trusts. Those pieces are often the ones you can change to make the website do something it should not.

## Step 1: capture the attachment send request

The intercepted request was:

```http
POST /messaging/send/ HTTP/1.1
Host: www.facebook.com

client=mercury&action_type=ma-type:user-generated-message&body=&ephemeral_ttl_mode=0&has_attachment=true&image_ids[0]=123&message_id=111&offline_threading_id=123
```

Line by line, in plain words:

- `POST /messaging/send/ HTTP/1.1` is the first line of an HTTP request. HTTP is the language browsers and websites speak. `POST` means "I am sending data to you", as opposed to `GET`, which means "give me a page". `/messaging/send/` is the address on the server that handles sending a message. `HTTP/1.1` is the version of the language.
- `Host: www.facebook.com` tells the server which website the request is for. One server can host many sites, so the request names the one it wants.
- The blank line separates the headers (the envelope information) from the body (the actual data).
- The body is a long string of `name=value` pairs joined by `&`. This is the same format you see in a URL after a question mark. Each pair is a parameter: a named piece of information the website uses.
- `client=mercury` says which messaging client is sending the message. "Mercury" is the name of the messaging client in this request.
- `action_type=ma-type:user-generated-message` says what kind of action this is: a message generated by a user.
- `body=` is the text of the message. Here it is empty, because the message is just an attachment.
- `ephemeral_ttl_mode=0` is a parameter in the request; the report does not explain it.
- `has_attachment=true` tells the server that this message carries an attachment.
- `image_ids[0]=123` is the interesting one. It is an identifier for the image that was uploaded in the Portal Facebook chat. The `[0]` means it is the first element of a list called `image_ids`; you could have `image_ids[1]` for a second image, and so on. `123` is a placeholder for the real number.
- `message_id=111` is an identifier for this message.
- `offline_threading_id=123` is another identifier in the request.

The researcher's eye went to `image_ids[0]`. It is a number that points at a picture. If the server simply trusts whatever number the client sends, then changing the number should point at a different picture. That is the whole idea he wanted to test.

## Step 2: change the attachment ID

He asked himself what would happen if the ID in `image_ids[0]` were changed to another user's image ID, and whether the same would work for other attachment types: files, videos and audio messages.

After testing extensively in the Portal chat, he found that he could disclose any attachment sent by other users through the chat: images, files, videos and audio messages.

The request carries an attachment identifier supplied by the client. The identifier is therefore an object reference that can be swapped for another user's. In security language this is called an IDOR, short for Insecure Direct Object Reference. A simple comparison: imagine a cloakroom where you hand in your coat and get a ticket with the number 42. If the attendant gives you whatever coat matches the number on your ticket without checking that the ticket is yours, you can write 43 on your ticket and walk away with someone else's coat. The number is the "direct object reference"; the missing check is what makes it "insecure".

What we know is the observable behaviour: a changed ID returned another user's attachment.

## Step 3: reproduce from other chat surfaces

The same manipulation worked in all Facebook chat infrastructure: Facebook main chat, Messenger, Portal chat and Workplace chat. The report states the bug could be reproduced from any of those chats because they are the same system.

This is a common pattern in large products. One backend serves many front ends. If the check is missing in the backend, it is missing everywhere, no matter which app you use to reach it. That is why the researcher could start in Portal chat and still describe the bug as affecting Messenger and Workplace.

## Step 4: keep the request in the proxy

A practical condition: the request had to remain live in the Burp proxy tab for the reproduction to succeed. Sending it to Repeater returned an error.

Why mention this? Because it is a trap for anyone trying to repeat the test. If you copy the request into Repeater and get an error, you might conclude the bug is not there. The researcher's experience says otherwise: replay it through the proxy before giving up.

## Why it matters

The researcher frames the impact in privacy terms. An attacker who found the bug could build a tool to brute force other users' IDs (image IDs, video IDs, file IDs and audio message IDs) and disclose attachments belonging to any user. "Brute force" here means trying many numbers in sequence or at random until one works, the way you might try every key on a keyring until a door opens. Because the IDs are numbers, a program can try them quickly and at scale.

The report gives the example of a very VIP person's audio messages, photos or videos being exposed. It also points out that millions of users use Facebook chat every day, so the pool of potential victims is enormous.

## The fix

Facebook fixed the bug and confirmed the fix on 13 February 2019. A fix for this class of issue would be an authorisation check on the server, verifying that the referenced attachment belongs to the authenticated sender. "Authorisation" means checking whether the person making the request is allowed to do what they are asking; "authenticated" means the server knows who that person is, usually because they logged in.

## Timeline

| Date | Event |
| --- | --- |
| 22 Jan 2019 | Initial report |
| 04 Feb 2019 | Report triaged |
| 13 Feb 2019 | Bug fixed |
| 13 Feb 2019 | Fix confirmed |
| 13 Feb 2019 | 15,000 USD bounty awarded |


{{media:2}}


## Variants to test

These are the same ideas the researcher's findings suggest for similar products. They are written for someone learning, so each one explains what to look for.

1. **Other attachment parameters.** The report names `image_ids[0]` and says files, videos and audio messages were also affected. Try swapping identifiers for each attachment type for an ID belonging to another account. Try swapping each one for an ID belonging to another account and check whether the attachment is returned. The lesson: when one parameter of a family is vulnerable, its siblings often are too.
2. **Array indices.** `image_ids[0]` is an array element. Try additional indices and multiple attachments in one message to see whether any index bypasses the ownership check. An array is an ordered list; `[0]` is the first slot, `[1]` the second. Sometimes a check is applied to the first slot but forgotten for the others.
3. **Other chat clients.** The report says the bug worked from Facebook main chat, Messenger, Portal chat and Workplace chat. On a similar multi-client messaging product, test the send endpoint from each client, since a check may exist in one and be missing in another. Different clients sometimes send slightly different requests, and a server may treat them differently.
4. **Proxy versus Repeater.** The researcher could only reproduce with the request held in the Burp proxy tab; Repeater gave an error. When a request fails in Repeater, replay it through the proxy before concluding the bug is not there. This is a reminder that your tool can change the outcome, and that an error is not proof of absence.
5. **Re-test over time.** The feature that exposed the bug (the Support Bot chat) was not present on the earlier visit. Revisit targets periodically and look for new features, as the researcher's first takeaway advises. New features are often less tested than old ones.

## Takeaways

The researcher's own conclusions: test your target from time to time, because you may see something you never saw before; and do not trust the response, since getting an error does not mean it is the end.

He thanks the Facebook Security Team for the bounty and Kassem Bazzoun, 張啟�
� and Max Pasqua for their support.

## Glossary

- **API**: a set of addresses and rules a program uses to talk to another program. Here, the messaging endpoint is the API the chat app calls when you send a message.
- **Attachment**: a file sent along with a message, such as an image, video, audio recording or document.
- **Audio message**: a voice recording sent in a chat.
- **Authentication**: the process of proving who you are, usually by logging in.
- **Authorisation**: the process of checking whether an authenticated person is allowed to do a particular action.
- **Brute force**: trying many possibilities, often automatically, until one works.
- **Burp Suite**: a tool that sits between your browser and a website so you can inspect and modify the traffic.
- **Client**: the program on your side (browser or app) that sends requests to a server.
- **Cookie**: a small piece of data a website stores in your browser so it can recognise you on later requests. It often acts like a temporary ID badge.
- **Endpoint**: a specific address on a server that handles a particular action, such as `/messaging/send/`.
- **Ephemeral message**: a message designed to disappear after a set time.
- **GET**: an HTTP method that asks a server to return something, typically a page.
- **Header**: extra information attached to an HTTP request or response, such as the host name.
- **HTTP**: the language browsers and websites use to exchange requests and responses.
- **ID**: a number or string that identifies something, such as a message, a user or an attachment.
- **IDOR (Insecure Direct Object Reference)**: a vulnerability where a program uses an identifier supplied by the user to fetch an object without checking that the user is allowed to access that object.
- **Infrastructure**: the underlying systems that run a service. Here, the shared chat backend behind several Facebook chat products.
- **Intercept**: to capture a request or response so you can read or change it before it continues.
- **Messenger**: Facebook's messaging app.
- **Parameter**: a named piece of data in a request, written as `name=value`.
- **POST**: an HTTP method used to send data to a server, for example to create a message.
- **Proxy**: an intermediary that forwards traffic between two parties. Burp's proxy lets you watch and edit that traffic.
- **Repeater**: a Burp tool that lets you resend a captured request repeatedly, often with changes.
- **Request**: a message from a client to a server asking it to do something.
- **Response**: the server's reply to a request.
- **Server**: the computer that hosts a website and answers requests.
- **Support Bot**: an automated chat helper that answers support questions.
- **Token**: a value, often a long string, that proves you are logged in or authorises an action. It works like a temporary pass.
- **TTL (time to live)**: how long something is allowed to exist before it expires.
- **Vulnerability**: a weakness in a system that can be used to make it behave in a way its owners did not intend.
- **Workplace**: Facebook's chat and collaboration product for organisations.

More by Sarmad Hassan

View all

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