Skip to content
IDOR Write-up Intermediate

Able to See and Delete Private Facebook Portal photos

The Facebook Portal app's album creation endpoint did not verify ownership of media IDs, allowing an attacker to add another user's private photo to their own album and then delete it, which also removed it from the victim's album. An attacker could view and permanently delete a targeted user's private photos without credentials.

Abhishek Pathak Follow

Published on pathleax.medium.com

Hello everyone! This is my second Bug Bounty from Facebook (Meta Platforms, Inc)

ecstasy, on pathleax.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. 5 min read.

Context

Facebook Portal is a multi functional app mainly designed for Portal video calling devices. It helps to make calls and to create and share albums and photos to connected Portal devices, although it works without a Portal device too. The researcher describes it as a photo sharing app after seeing its homepage.

The bug described here could have allowed a malicious user to view and delete a targeted photo on the Facebook Portal app without having access to the victim's login credentials or album ownership. The weakness is an IDOR in the GraphQL mutation that creates an album.

Setup

The researcher created two Portal users:

  • UserA, the victim.
  • UserB, the malicious user or attacker.

Traffic was intercepted with proxy tools in general (BurpSuite, Charles, Fiddler are named), but because the laptop's battery was dead, all interception was done on an Android smartphone through the HttpCanary proxy. The app used was the official "Facebook Portal" app from the Google Play store.

From the original on pathleax.medium.com

After some research the researcher found that the Portal video calling devices have an official app called "Facebook Portal" on the Google Play store.

From the original on pathleax.medium.com

It was installed to check how it works and what is inside it.

From the original on pathleax.medium.com

Seeing the homepage made it clear that it is a photo sharing app, so the backend of the upload functionality was examined by intercepting traffic.

Finding it

UserA steps

From the original on pathleax.medium.com
  1. Clicked on the upload button, selected an image and clicked on "Add 1 Photo".
From the original on pathleax.medium.com
  1. Clicked on "New Album" to upload that selected image in the newly created album.
From the original on pathleax.medium.com
  1. Just after uploading the image, the details of the uploaded media appeared in the request response, such as Media ID, CDN Url, etc.
From the original on pathleax.medium.com
  1. The Media ID was copied from the response to test it further.

UserB steps

UserB did everything the same as UserA, but this time something new was noticed.

From the original on pathleax.medium.com

While checking all the requests in HttpCanary, the endpoint that creates the album was found. Most importantly, some of the parameters were empty, mainly album_media_ids. The question was what would happen if UserA's Media ID were appended to this empty array/list.

Exploitation

Step 1: capture the album creation request

The vulnerable endpoint details, with sensitive data redacted:

Endpoint:

Text
https://graph.facebook.com/graphql

Request body:

HTTP
access_token=[redacted]&fb_api_caller_class=RelayModern&fb_api_req_friendly_name=BPPhotosHubAlbumGraphQLHelperCreateAlbumMutation&variables={"album_media_ids":["[redacted]"],"name":"Portal Uploads","cover_photo_id":null,"scale":2.75,"thumbnail_size":null}&server_timestamps=true&doc_id=[redacted]
From the original on pathleax.medium.com

The request goes to the GraphQL endpoint. fb_api_req_friendly_name identifies the operation as BPPhotosHubAlbumGraphQLHelperCreateAlbumMutation, the album creation mutation. The variables parameter carries the album definition: album_media_ids is the list of media to place in the new album, name is the album name ("Portal Uploads"), and cover_photo_id, scale and thumbnail_size are the remaining album fields. The access_token and doc_id values are redacted in the write-up.

Step 2: put the victim's Media ID into the array

The empty array was immediately replaced with ["135XXXXXXXXXX39"], where 135XXXXXXXXXX39 was UserA's Media ID, and the request was sent.

From the original on pathleax.medium.com

Step 3: observe the response

No error such as "You are not allowed to perform this action" or "You are not allowed to access/upload this media" came back. Instead the response was valid and contained the media CDN url. The reason, as the researcher puts it, is that the backend was not verifying the Owner ID of that particular media, and due to this misconfiguration it was vulnerable to an IDOR attack.

From the original on pathleax.medium.com

Step 4: confirm on the attacker's app

Opening UserB's Facebook Portal app showed that UserA's photo had been added to the newly created album.

Step 5: delete from the attacker's album

The next step was to delete the photo from UserB's newly created album to see what would happen in UserA's account.

From the original on pathleax.medium.com

The photo was immediately deleted from UserB's album and UserA's account was checked.

From the original on pathleax.medium.com

The photo was deleted from UserA's album too. At that point testing stopped and the vulnerability was reported to the Facebook WhiteHat program.

Root cause

The album creation mutation accepted a media ID supplied by the caller and attached that media to the new album without checking that the media belonged to the caller. The backend did not verify the Owner ID of the media referenced in album_media_ids, so any valid media ID could be pulled into an album owned by another account. Deleting the photo from the attacker's album also removed it from the victim's album.

The report does not describe any server-side control that should have caught this, so the likely explanation is simply that the ownership check was absent from this mutation rather than bypassed.

Impact

Private photos of users could be read and deleted improperly. A malicious user could have been able to permanently remove or delete a user's photos from their secret albums, add photos to a malicious album, and regenerate a valid CDN url of photos. All of this was possible without access to the victim's login credentials or album ownership. In the test setup the victim's Media ID came from the victim account's own upload response.

Bonus

The cover_photo_id JSON parameter was also vulnerable along with album_media_ids.

Fix

Facebook triaged the report on 21 September 2021 and fixed it on 28 September 2021, with confirmation of the fix the same day. The report does not describe the code change itself.

Timeline

Date Event
16 Sept 2021 Initial report
19 Sept 2021 Asked for an update
21 Sept 2021 Triaged
28 Sept 2021 Fixed
28 Sept 2021 Confirmation of fix
13 Oct 2021 Bounty awarded by Facebook

Variants to test

  • Other ID-bearing fields in the same mutation. The report already shows cover_photo_id was vulnerable alongside album_media_ids. Try every field that takes an object ID and see whether a foreign ID is accepted. A positive result is a valid response containing a CDN url for media you do not own.
  • Other GraphQL mutations that take media or album IDs. Look for operations with a fb_api_req_friendly_name in the same family and substitute a victim's ID. A positive result is a successful mutation response where an ownership error would be expected.
  • Deletion paths. After attaching foreign media, delete it from your own album and check the owner's account. A positive result is the media disappearing from the victim's album.
  • Empty or null ownership fields. The original request had an empty album_media_ids array; try supplying IDs where the field is normally empty or null. A positive result is the server accepting the value without an ownership check.
  • Cross-account reads through CDN urls. When a foreign media ID is accepted, note whether the returned CDN url resolves. A positive result is being able to fetch private media you do not own.

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 look at and delete someone else's private photos in the Facebook Portal app. He did not need the other person's password, and he did not need to own their album. He only needed one piece of information: the photo's ID number.

Here is the short version. Facebook Portal is an app for sharing photos and making video calls, and it also works on a normal phone without any Portal device. When you upload a photo, the app talks to Facebook's servers and the server replies with details about the photo, including a long ID number. That ID is supposed to be just a label. But the researcher discovered that the part of Facebook's server that creates a new album would happily accept any photo ID you gave it, even a photo that belonged to a completely different account. It never checked who owned the photo. So he created an album on his own account, put the victim's photo ID into the request, and the victim's photo appeared in his album. When he then deleted the photo from his own album, it vanished from the victim's album too.

This kind of mistake has a name: IDOR, which stands for Insecure Direct Object Reference. The everyday comparison is a cloakroom. You hand in your coat and get a ticket with a number on it. If the attendant hands out any coat to anyone who says a number, without checking that the ticket matches the person, then anyone who guesses or learns your number can walk off with your coat. The number is the "direct object reference"; the missing check is the "insecure" part.

A few words you will meet throughout, explained from zero:

  • API: the way one piece of software asks another piece of software to do something. Think of a restaurant. The menu and the waiter are the API. You do not walk into the kitchen; you tell the waiter what you want, and food comes back. Here, the app is the customer and Facebook's servers are the kitchen.
  • Request and response: a request is the message the app sends ("please create an album with these photos"). A response is the message the server sends back ("done, here are the details").
  • Token: a short secret string that proves who you are, a bit like a wristband at a festival. You show it with every request instead of typing your password each time. If someone else gets your token, they can act as you, which is why tokens are sensitive.
  • GraphQL: a style of API where the app sends one request describing exactly what it wants, and the server answers that description. Facebook uses it heavily.
  • Mutation: in GraphQL, a request that changes something (create, update, delete) rather than just reading. Creating an album is a mutation.
  • Endpoint: the address a request is sent to, like a specific counter in a large building.
  • Parameter: a named value inside a request, for example name with the value Portal Uploads.
  • CDN: a content delivery network, a network of servers that serve files such as images quickly. A "CDN url" is a web address for a file on that network.
  • Proxy: a tool that sits between your phone and the internet and lets you read every message going back and forth. It is like opening the envelope of every letter before it is delivered.

The setup

The researcher created two accounts in the Portal app:

  • UserA, the victim, whose private photo would be targeted.
  • UserB, the attacker, the account doing the snooping.

To see the messages between the app and the server, you normally use a proxy tool on a computer. The researcher names BurpSuite, Charles and Fiddler as the usual choices. But his laptop battery was dead, so he did all the interception on an Android phone using an app called HttpCanary, which is a proxy that runs on the phone itself. The app under test was the official "Facebook Portal" app from the Google Play store.

From the original on pathleax.medium.com

He had first noticed Portal through an advertisement for the Portal video calling devices while scrolling the Facebook homepage, and became curious about what the product did. Some research showed that the devices have an official companion app called "Facebook Portal" on the Google Play store.

From the original on pathleax.medium.com

He installed it straight away to see how it works and what is inside it.

From the original on pathleax.medium.com

Seeing the app's homepage made it clear that it is a photo sharing app. That is why he decided to examine the upload feature's backend, meaning the server side, by intercepting the traffic.

Finding it

What the victim does

From the original on pathleax.medium.com
  1. UserA taps the upload button, picks an image and taps "Add 1 Photo".
From the original on pathleax.medium.com
  1. UserA taps "New Album" so that the chosen image is uploaded into a freshly created album.
From the original on pathleax.medium.com
  1. Immediately after the upload, the response from the server contains details about the uploaded media, such as the Media ID and the CDN Url.
From the original on pathleax.medium.com
  1. UserA copies the Media ID out of that response, so it can be used in further testing.

Why this matters: the Media ID is the cloakroom ticket number. If the server treats that number as enough proof of ownership, then anyone who learns the number can reach the photo.

What the attacker does

UserB repeats exactly the same steps as UserA, but this time the researcher noticed something new.

From the original on pathleax.medium.com

While going through all the requests in HttpCanary, he found the request that creates the album. The interesting part was that some of its parameters were empty, most importantly album_media_ids, the list of photos that should go into the new album. That raised a question: what happens if UserA's Media ID is added to this empty list?

The reasoning is simple. When you create an album with no photos in it, the app sends an empty list. If the server does not check who owns each ID in that list, then filling the list with someone else's ID might pull their photo into your album.

Exploitation

Step 1: capture the album creation request

The vulnerable endpoint, with sensitive data redacted in the write-up:

Endpoint:

Text
https://graph.facebook.com/graphql

Request body:

HTTP
access_token=[redacted]&fb_api_caller_class=RelayModern&fb_api_req_friendly_name=BPPhotosHubAlbumGraphQLHelperCreateAlbumMutation&variables={"album_media_ids":["[redacted]"],"name":"Portal Uploads","cover_photo_id":null,"scale":2.75,"thumbnail_size":null}&server_timestamps=true&doc_id=[redacted]
From the original on pathleax.medium.com

Line by line, in plain words:

  • https://graph.facebook.com/graphql is the address. It is Facebook's general GraphQL endpoint, the single counter where many different operations are handed in.
  • access_token=[redacted] is the token that identifies the account making the request. It is the wristband. The actual value is hidden in the write-up because it is a secret.
  • fb_api_caller_class=RelayModern tells the server which kind of client software is calling. Relay is a framework Facebook uses for its apps.
  • fb_api_req_friendly_name=BPPhotosHubAlbumGraphQLHelperCreateAlbumMutation is a human-readable label for the operation. The name says it plainly: this is the album creation mutation in the photos hub.
  • variables={...} is the block that carries the actual album definition, written in JSON, a common text format for structured data. Inside it:
    • album_media_ids is the list of media IDs to put in the new album. In the captured request it holds one redacted ID.
    • name is the album's name, here Portal Uploads.
    • cover_photo_id is which photo to use as the album cover, here null, meaning none.
    • scale and thumbnail_size are display settings for the album's pictures.
  • server_timestamps=true asks the server to include its own timestamps in the response.
  • doc_id=[redacted] is an identifier for the stored query document on Facebook's side. It is redacted in the write-up.

Step 2: put the victim's Media ID into the array

The empty array was replaced with ["135XXXXXXXXXX39"], where 135XXXXXXXXXX39 was UserA's Media ID, and the request was sent.

From the original on pathleax.medium.com

In other words, the attacker took the ticket number he had learned from the victim's upload and put it into his own album creation request. Nothing else changed. This is the whole attack: one value swapped.

Step 3: observe the response

The server did not return an error such as "You are not allowed to perform this action" or "You are not allowed to access/upload this media". Instead it returned a valid response containing the media's CDN url. The researcher's explanation is that the backend was not verifying the Owner ID of that particular media, and because of this misconfiguration the feature was vulnerable to an IDOR attack.

From the original on pathleax.medium.com

Why this is the key moment: a correct server would compare the owner of the photo with the account making the request and refuse if they differ. Here it skipped that comparison. The cloakroom attendant handed over the coat without looking at the ticket holder.

Step 4: confirm on the attacker's app

Opening UserB's Facebook Portal app showed that UserA's photo had been added to the newly created album. This confirms the attack worked from the app's point of view, not just in the raw response.

Step 5: delete from the attacker's album

The next step was to delete the photo from UserB's newly created album, to see what would happen in UserA's account.

From the original on pathleax.medium.com

The photo was deleted from UserB's album, and then UserA's account was checked.

From the original on pathleax.medium.com

The photo was gone from UserA's album as well. At that point the researcher stopped testing and wrote up the vulnerability for the Facebook WhiteHat program, Facebook's bug bounty programme, which pays people for reporting security flaws responsibly.

Why it worked

The album creation request accepts a media ID from whoever is calling, and it attaches that media to the new album without checking that the media belongs to the caller. The backend did not verify the Owner ID of the media named in album_media_ids, so any valid media ID could be pulled into an album owned by another account. Deleting the photo from the attacker's album also removed it from the victim's album.

The report does not describe any server-side control that should have caught this, so the likely explanation is simply that the ownership check was absent from this mutation rather than bypassed.

Impact

Private photos of users could be read and deleted improperly. A malicious user could have permanently removed or deleted a user's photos from their secret albums, added photos to a malicious album, and regenerated a valid CDN url for photos. All of this was possible without access to the victim's login credentials or album ownership. In this test setup the victim's Media ID came from the victim account's own upload response.

Bonus

The cover_photo_id JSON parameter was also vulnerable, alongside album_media_ids. In other words, the same missing ownership check applied to the field that chooses the album cover, not only to the list of photos.

The fix

Facebook triaged the report on 21 September 2021 and fixed it on 28 September 2021, confirming the fix the same day. The report does not describe the code change itself.

Timeline

Date Event
16 Sept 2021 Initial report
19 Sept 2021 Asked for an update
21 Sept 2021 Triaged
28 Sept 2021 Fixed
28 Sept 2021 Confirmation of fix
13 Oct 2021 Bounty awarded by Facebook

Variants to test

If you want to look for the same kind of mistake elsewhere, these are the directions the report points to. Each one is a way of asking the same question: does the server check who owns this ID?

  • Other ID-bearing fields in the same mutation. The report already shows cover_photo_id was vulnerable alongside album_media_ids. Try every field that takes an object ID and see whether a foreign ID is accepted. A positive result is a valid response containing a CDN url for media you do not own.
  • Other GraphQL mutations that take media or album IDs. Look for operations with a fb_api_req_friendly_name in the same family and substitute a victim's ID. A positive result is a successful mutation response where an ownership error would be expected.
  • Deletion paths. After attaching foreign media, delete it from your own album and check the owner's account. A positive result is the media disappearing from the victim's album.
  • Empty or null ownership fields. The original request had an empty album_media_ids array; try supplying IDs where the field is normally empty or null. A positive result is the server accepting the value without an ownership check.
  • Cross-account reads through CDN urls. When a foreign media ID is accepted, note whether the returned CDN url resolves. A positive result is being able to fetch private media you do not own.

Glossary

  • API: the agreed way for one program to ask another program to do something, like a menu and waiter in a restaurant.
  • Album: a collection of photos grouped together in the Portal app.
  • Backend: the server-side part of a service, the part users do not see.
  • Bug bounty programme: a scheme where a company pays researchers for reporting security flaws responsibly. Facebook's is called WhiteHat.
  • CDN (content delivery network): a network of servers that delivers files such as images quickly; a CDN url is the web address of a file on it.
  • Cover photo: the picture chosen to represent an album.
  • Endpoint: the address a request is sent to.
  • GraphQL: an API style where the client sends one request describing exactly what it wants.
  • HttpCanary: a proxy app that runs on an Android phone and lets you read the traffic between apps and servers.
  • IDOR (Insecure Direct Object Reference): a flaw where a program uses an ID supplied by the user to reach an object without checking that the user is allowed to access it.
  • JSON: a common text format for structured data, made of names and values.
  • Media ID: the unique number identifying one uploaded photo or video.
  • Misconfiguration: a setting or missing check that leaves a system less protected than intended.
  • Mutation: in GraphQL, a request that changes data, such as creating or deleting something.
  • Owner ID: the identifier of the account that owns an object, used to decide who may access it.
  • Parameter: a named value inside a request.
  • Proxy: a tool that sits between your device and the internet and lets you inspect the messages passing through.
  • Request: the message an app sends to a server.
  • Response: the message a server sends back.
  • Token (access token): a secret string that proves which account is making a request, like a wristband at a festival.
  • Triaged: reviewed and accepted as a genuine issue by the company's security team.
  • UserA / UserB: the two test accounts in the report, the victim and the attacker.

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.