Reveal the page admin that uploaded a video on the page in comment section
A video attached to a page post's comment section could be queried through the Messenger media info endpoint, and the response revealed the User ID of the page admin who uploaded it. An attacker could therefore learn which person runs a page, defeating the anonymity of page roles.
Published on lokeshdlk77.medium.com
Facebook Bug Bounty
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.
Context
Facebook Pages can be run by more than one person. A Page role holder can post to the Page as the Page itself, including uploading a video in the comment section of a Page post. The identity behind such a Page-role action is not meant to be visible to ordinary users: the response should expose the Page, not the personal User ID of the admin who performed the action.
This write-up describes a bug that disclosed the User ID of the Page role person who uploaded a video in the comment section of a Page. It was inspired by an earlier Page admin disclosure write-up by Kassem Bazzoun, which revealed the Page admin who uploaded a video on the Page feeds. After reading that write-up, the researcher set out to see whether the fix for it could be bypassed with a different scenario.
The question that drove the work was how the Facebook server validates a Video ID when the video sits in a different section of a Page. Three placements were considered:
- Video in Page Cover Pic
- Video in Page Conversation
- Video in Comment Section on page feeds
The third placement is the one that disclosed the Page admin's User ID in the response, using the same reproduction steps as in Kassem Bazzoun's write-up.
Setup
The write-up does not describe the accounts, roles or tool versions used beyond what the steps imply. The preconditions are:
- A Page post that has a video uploaded in its comment section, where the video was uploaded as the Page.
- Access to the Facebook Graph API with an access token able to read the post's comments and their attachments, in order to obtain the Video ID.
- A Facebook/Messenger account with an existing conversation containing at least one image, so that the image Info action can be triggered.
- Burp Suite with interception enabled, to modify the request sent when the image Info button is clicked.
Finding it
The starting point was the earlier disclosure of the Page admin who uploaded a video on the Page feeds. The researcher reasoned that the server must validate a Video ID somewhere, and asked how that validation behaves when the same kind of video is placed in a different Page section. The hypothesis was that the fix applied to the feeds case might not cover a video uploaded in the comment section of a Page post. Testing that third placement produced a response that disclosed the creator User ID of the Page role person who uploaded the video.
Exploitation
Step 1: Find a suitable video
Find a video that was uploaded in the comment section of a Page post, uploaded as the Page. This is the object whose creator identity should not be exposed.
Step 2: Obtain the Video ID through the Graph API
The attacker needs the Video ID of the video in the comments. It is retrieved with the Graph API using the following endpoint:
https://graph.facebook.com/v5.0/PAGEID_POSTID?fields=comments{attachment}&access_token=XXXX
The request asks the post node for its comments and each comment's attachment. PAGEID_POSTID identifies the Page post and access_token is the attacker's token; both are placeholders in the write-up.
Step 3: Open an image in Messenger and start interception
Open https://messenger.com, click any image that was sent between the conversation, and then click the Info button. Burp Suite interception must be on before clicking Info, so that the request generated by that action can be modified.
Step 4: Replace the node value with the Video ID
Intercept the request and replace the node (xxxxxxx) Base64 value with the Video ID from the comment section. The node value in the request is Base64-encoded and is replaced with the Video ID.
Step 5: Forward and read the response
After forwarding the request, the response discloses the creator User ID of the Page role person who uploaded the video.
Root cause
The write-up does not describe the server-side code. What it shows is that replacing the node value with the Video ID made the response disclose the creator User ID of the Page role person who uploaded the video. The researcher tested whether the earlier fix could be bypassed with a video in the comment section, and it returned the Page role person's User ID.
Impact
An attacker can obtain the Video ID of a video uploaded in a Page post's comment section as the Page, and then use the Messenger image Info request to learn the User ID of the Page role person who uploaded it. This links a Page-role action to a personal account.
Fix
Facebook confirmed the issue as fixed on 08-Oct-2020, and the researcher also confirmed the fix.
Timeline
| Date | Event |
|---|---|
| 22-Sep-2020 | Report sent |
| 22-Sep-2020 | Further investigation by Facebook |
| 08-Oct-2020 | Fix confirmed by Facebook and the researcher |
| 10-Oct-2020 | $4500 bounty plus $338 bonus awarded by Facebook |
The bug was submitted to the BountyCon2020 event. The researcher also found two other bugs during the event submission: deleting any photos in Facebook, and stealing a CSRF token using a clickjacking attack. Those were to be written up separately.
Variants to test
What happened, in plain words
Facebook Pages are public profiles that a business, a band or a public figure can run. A Page is not the same thing as a personal account: several people can be given a role on the Page and act on its behalf. When one of those people posts something "as the Page", Facebook is supposed to show the Page as the author, not the human behind it. The whole point of a Page role is that the person's personal account stays separate from the Page's public face.
This write-up is about a bug that broke that separation. If a Page role holder uploaded a video in the comment section of a Page post, an attacker could make Facebook's servers hand back the personal User ID of the person who uploaded it. A User ID is the number Facebook uses to identify an account; knowing it lets you find and identify the account behind the Page action.
The researcher got the idea from an earlier write-up by Kassem Bazzoun, which disclosed the Page admin who uploaded a video on the Page feeds (the main stream of posts on a Page). After reading it, the researcher asked a simple question: if Facebook fixed that case, does the fix also cover the same kind of video placed somewhere else on the Page? The researcher tested the comment section, and it disclosed the Page admin's User ID.
A few words before we start, because the rest of the article leans on them:
- API: an interface that lets one program talk to another. Think of it as a waiter: you order from a menu (the request), the kitchen (the server) prepares it, and the waiter brings back the plate (the response). You never walk into the kitchen yourself.
- Graph API: Facebook's own API, the menu of requests you can send to read and write Facebook data.
- Access token: a long string that proves who you are when you call an API, a bit like a wristband at an event. You show it with every request instead of typing your password each time.
- Endpoint: the specific address of one API operation, the equivalent of one line on the menu.
- User ID: the unique number Facebook assigns to an account.
- Base64: a way of writing any data using only letters, digits and a couple of symbols, so it can travel safely inside text. It is not encryption; anyone can decode it.
- Burp Suite: a tool that sits between your browser and the website and lets you pause, read and change requests before they are sent. It is the standard tool for this kind of testing.
- Intercept: the mode in Burp Suite where each request is held so you can edit it before it goes on.
- Information disclosure: a vulnerability class where the system reveals data it should have kept private. Here, the private data is the link between a Page action and a personal account.
The idea behind the test
The earlier bug showed that Facebook's servers, somewhere, take a Video ID and look up who created that video. A Video ID is the unique number Facebook gives to a video. The researcher's reasoning was: if the server validates a Video ID in one place, how does it behave when the same kind of video sits in a different section of a Page? Three placements came to mind:
- Video in Page Cover Pic
- Video in Page Conversation
- Video in Comment Section on page feeds
The third one is the one that leaked the Page admin's User ID in the response, using the same reproduction steps as in Kassem Bazzoun's write-up. In other words, the comment-section case still disclosed the Page admin's User ID.
What you need before you start
The write-up does not describe the accounts, roles or tool versions used beyond what the steps imply. The preconditions are:
- A Page post that has a video uploaded in its comment section, where the video was uploaded as the Page.
- Access to the Facebook Graph API with an access token able to read the post's comments and their attachments, so you can obtain the Video ID.
- A Facebook/Messenger account with an existing conversation containing at least one image, so that the image Info action can be triggered.
- Burp Suite with interception enabled, to modify the request sent when the image Info button is clicked.
Finding it
The starting point was the earlier disclosure of the Page admin who uploaded a video on the Page feeds. The researcher reasoned that the server must validate a Video ID somewhere, and asked how that validation behaves when the same kind of video is placed in a different Page section. The hypothesis was that the fix applied to the feeds case might not cover a video uploaded in the comment section of a Page post. Testing that third placement produced a response that disclosed the creator User ID of the Page role person who uploaded the video.
Exploitation
Step 1: Find a suitable video
Find a video that was uploaded in the comment section of a Page post, uploaded as the Page. This is the object whose creator identity should not be exposed. If you are new to this, think of it as finding the right locked door before you try the key: you need a video that was posted as the Page, not as a personal account, because only then does the leak matter.
Step 2: Obtain the Video ID through the Graph API
The attacker needs the Video ID of the video in the comments. It is retrieved with the Graph API using the following endpoint:
https://graph.facebook.com/v5.0/PAGEID_POSTID?fields=comments{attachment}&access_token=XXXX
Line by line, in plain words:
https://graph.facebook.comis the address of Facebook's Graph API, the waiter we talked about earlier./v5.0/is the version of the API being called. Facebook keeps several versions running at once, and each version can behave slightly differently.PAGEID_POSTIDis a placeholder for the identifier of the Page post. In a real request you would put the actual Page ID and post ID there. The write-up uses a placeholder, so we do too.?fields=comments{attachment}is the part after the question mark, called the query string. It tells the API what to return: the post's comments, and for each comment its attachment. The attachment is where the video and its ID appear.&access_token=XXXXis the access token, the wristband that proves who is asking.XXXXis a placeholder; the real token is secret and must never be shared.
The request asks the post node for its comments and each comment's attachment. PAGEID_POSTID identifies the Page post and access_token is the attacker's token; both are placeholders in the write-up.
Step 3: Open an image in Messenger and start interception
Open https://messenger.com, click any image that was sent between the conversation, and then click the Info button. Burp Suite interception must be on before clicking Info, so that the request generated by that action can be modified.
Why this step? The Info button generates a request whose node value can be swapped for the Video ID. Burp Suite is the tool that lets you pause the request and make the swap before it leaves your browser.
Step 4: Replace the node value with the Video ID
Intercept the request and replace the node (xxxxxxx) Base64 value with the Video ID from the comment section. The node value in the request is Base64-encoded and is replaced with the Video ID.
In plain words: the request carries a field called the node, which is a Base64-encoded identifier, and you replace it with the Video ID.
Step 5: Forward and read the response
After forwarding the request, the response discloses the creator User ID of the Page role person who uploaded the video. "Forward" here means letting Burp Suite send the modified request on to Facebook. The response is what Facebook sends back, and in this case it contained the personal User ID.
Root cause
The write-up does not describe the server-side code. What it shows is that replacing the node value with the Video ID made the response disclose the creator User ID of the Page role person who uploaded the video. The comment-section placement still returned the Page role person's User ID.
A simple comparison: imagine a building where the front door was locked after a break-in, but the side door was forgotten. The lock (the fix) was real, but it only covered one entrance. Here the "entrance" is the Page section where the video lives.
Impact
An attacker can obtain the Video ID of a video uploaded in a Page post's comment section as the Page, and then use the Messenger image Info request to learn the User ID of the Page role person who uploaded it. This links a Page-role action to a personal account.
Why does that matter? Because a Page role is often used by people who do not want their personal account tied to the Page publicly. Knowing the User ID lets someone find the personal profile behind a Page action.
Fix
Facebook confirmed the issue as fixed on 08-Oct-2020, and the researcher also confirmed the fix.
Timeline
| Date | Event |
|---|---|
| 22-Sep-2020 | Report sent |
| 22-Sep-2020 | Further investigation by Facebook |
| 08-Oct-2020 | Fix confirmed by Facebook and the researcher |
| 10-Oct-2020 | $4500 bounty plus $338 bonus awarded by Facebook |
The bug was submitted to the BountyCon2020 event. The researcher also found two other bugs during the event submission: deleting any photos in Facebook, and stealing a CSRF token using a clickjacking attack. Those were to be written up separately.
A bounty is a reward a company pays a researcher for reporting a security bug responsibly. A CSRF token is a secret value a website puts in a form to prove the request came from its own pages and not from an attacker's site; stealing it would let an attacker forge requests. Clickjacking is tricking a user into clicking something they did not intend to click, usually by hiding one page under another.
Variants to test
The general lesson: when a company fixes a bug, ask where else the same kind of data lives. A fix in one place does not always cover the same object in another place.
Glossary
- API: an interface that lets one program talk to another, like a waiter taking your order to the kitchen.
- Access token: a string that proves who you are when calling an API, like a wristband at an event.
- Base64: a way of writing any data using only text characters, so it can travel safely; not encryption.
- Bounty: a reward a company pays a researcher for reporting a security bug.
- Burp Suite: a tool that sits between your browser and a website and lets you pause, read and change requests.
- Clickjacking: tricking a user into clicking something they did not intend to click.
- CSRF token: a secret value in a form that proves the request came from the site's own pages.
- Endpoint: the specific address of one API operation.
- Graph API: Facebook's API for reading and writing Facebook data.
- Information disclosure: a vulnerability where the system reveals data it should have kept private.
- Intercept: the mode in Burp Suite where requests are held so you can edit them before they are sent.
- Node: here, an identifier in a request that the server uses to look up an object.
- Page: a public Facebook profile for a business, band or public figure, run by people with roles.
- Page role: a permission given to a person to act on behalf of a Page.
- Video ID: the unique number Facebook assigns to a video.