Skip to content
IDOR Write-up Intermediate

Image Removal Vulnerability in Facebook

Facebook's Polls feature accepted an attacker-supplied image ID without verifying ownership, allowing an attacker to attach another user's image to their own poll. Deleting the poll then deleted the victim's image.

Pouya Darabi Follow

Published on blog.darabi.me

Bounty$10,000 View original

In November 2017, I discovered an access-control vulnerability in Facebook's newly introduced Polls feature that could be abused to delete an arbitrary image from Facebook.

Pouya Darabi (@Pouyadarabi), on blog.darabi.me

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.

In November 2017, I found an access-control flaw in Facebook's newly introduced Polls feature. By supplying another user's image ID when creating a poll, I could attach a victim's image to my own poll, and deleting the poll deleted the victim's image. Facebook deployed a temporary fix the same day and a permanent fix on November 5, 2017, and awarded a $10,000 bounty.

Item Detail
Product Facebook
Feature Polls
Issue Broken object-level authorization / insufficient ownership validation
Impact Delete an arbitrary Facebook image
Reported November 3, 2017
Permanent fix November 5, 2017
Bounty $10,000

Context

Facebook had recently launched a polling feature for posts, available on web and in the iOS and Android apps. A poll consists of a question and a set of options, and each option can carry an image. Since the feature was new, I started reviewing its request flow, in particular how media gets attached to poll options.

Setup

The only precondition for the attack was knowledge of a target image ID: the flow accepts an image identifier supplied by the client, .

Finding it

When a user creates a poll with an uploaded image, the request carries the identifier of the image assigned to each option. The relevant request parameter is:

Text
poll_question_data[options][][associated_image_id]

This parameter contains the ID of the uploaded image associated with a poll option. What looked wrong was that the backend did not properly verify that the supplied image ID belonged to the user creating the poll. The backend did not properly verify that the supplied image ID belonged to the user creating the poll.

Exploitation

Step 1: Create a poll with your own image

I created a poll using an uploaded image and captured the creation request. The request includes the associated_image_id parameter for each option, holding the ID of the image I had uploaded.

Step 2: Swap in the victim's image ID

I replaced the legitimate associated_image_id value with the ID of another user's image. Facebook accepted the modified request and created a poll that referenced the victim's image. The attacker's original poll image was replaced with the victim's image.

Step 3: Delete the poll

The more serious issue appeared when the poll was deleted. Because Facebook had accepted the victim's image as a property of the attacker's poll, deleting the poll also caused Facebook to delete the referenced image itself.

Root cause

The backend trusted the associated_image_id supplied in the poll creation request without checking that the referenced image belonged to the requesting user. That is a missing object-level ownership check: the object (the image) is addressed by an identifier the client chooses, and authorisation is not enforced against the object's owner.

The destructive part comes from the lifecycle coupling. Once the victim's image was accepted as a property of the attacker's poll, deleting the poll also caused Facebook to delete the referenced image itself. A missing ownership check on creation therefore became a delete primitive on an object the attacker never owned.

Impact

An attacker who obtained a target image ID could associate it with a poll they controlled and then trigger deletion of that image by removing the poll. The result is deletion of an arbitrary Facebook image. The attack requires knowledge of the target image ID; the report does not describe how such an ID would be obtained.

Fix

Facebook triaged the report the same day, deployed a temporary fix shortly afterward, and rolled out a permanent fix on November 5, 2017. The report does not describe the code change itself. The check that should exist is an ownership validation on associated_image_id: the server should only accept an image ID that belongs to the authenticated user creating the poll, and should reject the request otherwise.

Disclosure timeline

Date and time Event
November 3, 2017, 03:16 Vulnerability reported to Facebook
November 3, 2017, 15:25 Report triaged
November 3, 2017, 16:46 Temporary fix deployed
November 5, 2017, 15:03 Permanent fix deployed
November 8, 2017 $10,000 bounty awarded

Variants to test

  1. Other object references in the same feature. Look for any parameter that names an object by ID in poll or post creation, such as media, attachment or album identifiers. A positive result is a request that succeeds while referencing an object owned by another account.
  2. Ownership checks on update rather than create. Try editing an existing poll or post to point at another user's image ID. A positive result is a successful update that binds a foreign object.
  3. Lifecycle coupling. Wherever a parent object can reference a child, test whether deleting the parent deletes the child. A positive result is a foreign object being removed as a side effect of deleting your own object.
  4. Cross-account verification. Always confirm with a second account that the referenced object really belongs to someone else and that the effect (for example deletion) is visible from that account.

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

In November 2017, Facebook had just launched a new feature called Polls. A poll is a post where you ask a question and offer a few answers for people to choose from, and each answer can have a picture attached to it. I spent some time looking at how the Polls feature worked behind the scenes, and I found a way to make Facebook delete a picture that belonged to someone else.

The trick was simple. When you create a poll with a picture, your browser sends Facebook a message that includes a number identifying the picture you uploaded. Facebook took that number on trust. If I swapped my picture's number for the number of a picture belonging to another user, Facebook happily built my poll around their picture. Then, when I deleted my poll, Facebook cleaned up the picture attached to it, and that picture was the other user's. Their image was gone.

Facebook deployed a temporary fix the same day and a permanent fix on November 5, 2017, and paid a $10,000 bounty. A bounty is a reward a company pays to someone who reports a security problem responsibly instead of abusing it.

Item Detail
Product Facebook
Feature Polls
Issue Broken object-level authorization / insufficient ownership validation
Impact Delete an arbitrary Facebook image
Reported November 3, 2017
Permanent fix November 5, 2017
Bounty $10,000

Context

Facebook had recently launched a polling feature for posts, available on the web and in the iOS and Android apps. A poll is a question plus a set of options, and each option can carry an image. Because the feature was new, I started reviewing its request flow, in particular how media gets attached to poll options.

"Request flow" means the sequence of messages your browser and the Facebook apps exchange with Facebook's servers while you use a feature. When you click a button, your browser does not magically change something on Facebook's computers. It sends a request, a small structured message, to a server, and the server decides what to do and sends back a response. Reading that traffic is the starting point for most security research: you want to see exactly what your browser is telling the server, because that is where you can try changing things.

New features are interesting for this reason. Older features have been looked at by many people for years, but something launched last week has had far fewer eyes on it, and its rules about who is allowed to do what may not be fully worked out yet.

Setup

The only precondition for the attack was knowledge of a target image ID: the flow accepts an image identifier supplied by the client, .

A few terms here, from zero:

  • Client means your side of the conversation: the browser or the app on your device. The server is Facebook's computer that receives your requests and stores the data.
  • An ID (identifier) is a number or short string that names one specific thing in a database. Every photo on Facebook has its own ID, the way every house has its own address. If you know the address, you can refer to the house; if you know the image ID, you can refer to the image.
  • To intercept a request means to catch it on its way out of your browser so you can read it and change it before it reaches the server. People do this with a proxy, a program that sits between the browser and the internet. Think of it as a mail sorting office where you can open an envelope, rewrite the letter, and seal it again before it is delivered.

The one thing an attacker needed was the ID of the picture they wanted to target. The report does not describe how such an ID would be obtained.

Finding it

When a user creates a poll with an uploaded image, the request carries the identifier of the image assigned to each option. The relevant request parameter is:

Text
poll_question_data[options][][associated_image_id]

This parameter contains the ID of the uploaded image associated with a poll option. What looked wrong was that the backend did not properly verify that the supplied image ID belonged to the user creating the poll. The backend did not properly verify that the supplied image ID belonged to the user creating the poll.

Let us unpack that code block, because it looks cryptic but is just a label.

  • A parameter is one named piece of information inside a request, like a field on a paper form: a name and a value. Here the name is the whole string above, and the value is the image ID.
  • The square brackets are a convention for grouping related fields. poll_question_data is the overall bundle describing the poll. [options] says we are inside the list of answer options. The empty [] means "any one of those options", because a poll can have several. [associated_image_id] is the field holding the ID of the picture attached to that option.
  • The backend is the part of Facebook's system that runs on the server and actually processes the request, as opposed to the front end, which is what you see on screen.
  • Client-controlled means the value comes from your device, so you can change it before it is sent. The server should never assume a client-supplied value is honest, in the same way a bank should not accept a withdrawal slip where the customer wrote their own balance.

That was the suspicious part. The server received a number naming an image and used it, but did not check that the image belonged to the person making the request. Nothing in the flow tied the ID back to the account that had uploaded the picture.

Exploitation

Step 1: Create a poll with your own image

I created a poll using an uploaded image and captured the creation request. The request includes the associated_image_id parameter for each option, holding the ID of the image I had uploaded.

Why start with your own image? Because you need a legitimate, working example of the request before you can tamper with it. If you change something before you know what a normal request looks like, you cannot tell whether a failure is your mistake or the server's behaviour. Capturing your own request gives you a template with all the right fields in the right places, and one value, your own image ID, that you can then swap.

Step 2: Swap in the victim's image ID

I replaced the legitimate associated_image_id value with the ID of another user's image. Facebook accepted the modified request and created a poll that referenced the victim's image. The attacker's original poll image was replaced with the victim's image.

This is the heart of the bug. The server should have asked: does this image belong to the account sending the request? It did not. It took the ID at face value and attached whatever image the ID pointed to. In security language, this is a missing ownership check, and the general class of problem is called broken object-level authorization: the server checks that you are logged in, but not that the specific object you are naming is yours to use. A useful comparison is a hotel: the receptionist checks that you are a guest, but if they hand you a key to any room number you ask for, being a guest is not enough protection.

Step 3: Delete the poll

The more serious issue appeared when the poll was deleted. Because Facebook had accepted the victim's image as a property of the attacker's poll, deleting the poll also caused Facebook to delete the referenced image itself.

This is where a harmless-looking mistake becomes destructive. Facebook treats the picture as part of the poll, so when the poll is removed, the picture is cleaned up along with it. That cleanup is sensible when the picture is yours. It is a problem when the picture belongs to someone else, because now deleting your own poll deletes their image. The missing check at creation time turned into a delete button for objects the attacker never owned.

Root cause

The backend trusted the associated_image_id supplied in the poll creation request without checking that the referenced image belonged to the requesting user. That is a missing object-level ownership check: the object (the image) is addressed by an identifier the client chooses, and authorisation is not enforced against the object's owner.

Authorisation is the part of security that decides what a logged-in user is allowed to do, as opposed to authentication, which only decides who they are. Logging in proves who you are; authorisation decides whether you may touch this particular image. The bug was purely an authorisation gap.

The destructive part comes from the lifecycle coupling. Once the victim's image was accepted as a property of the attacker's poll, deleting the poll also caused Facebook to delete the referenced image itself. A missing ownership check on creation therefore became a delete primitive on an object the attacker never owned.

"Lifecycle coupling" simply means two things are tied together: the poll and its image live and die as a pair. That is fine when both belong to you. It becomes a weapon when the pairing can be forged.

Impact

An attacker who obtained a target image ID could associate it with a poll they controlled and then trigger deletion of that image by removing the poll. The result is deletion of an arbitrary Facebook image. The attack requires knowledge of the target image ID; the report does not describe how such an ID would be obtained.

"Arbitrary" here means any image whose ID the attacker knows, not just their own. The damage is permanent deletion of someone else's content, which is why a missing check that looks minor on paper matters in practice.

Fix

Facebook triaged the report the same day, deployed a temporary fix shortly afterward, and rolled out a permanent fix on November 5, 2017. The check that should exist is an ownership validation on associated_image_id: the server should only accept an image ID that belongs to the authenticated user creating the poll, and should reject the request otherwise.

To triage a report means to review it and confirm it is a real, in-scope problem worth acting on. The fix is the obvious one once you see the bug: before using the image ID, the server should look up the image and confirm its owner is the account making the request. If not, refuse. The same hotel receptionist should check that the room number you ask for is the room you booked.

Disclosure timeline

Date and time Event
November 3, 2017, 03:16 Vulnerability reported to Facebook
November 3, 2017, 15:25 Report triaged
November 3, 2017, 16:46 Temporary fix deployed
November 5, 2017, 15:03 Permanent fix deployed
November 8, 2017 $10,000 bounty awarded

Variants to test

If you want to look for similar problems yourself, these are the directions worth trying. Each one is a variation on the same idea: find a place where the server accepts a name for something and does not check that the thing is yours.

  1. Other object references in the same feature. Look for any parameter that names an object by ID in poll or post creation, such as media, attachment or album identifiers. A positive result is a request that succeeds while referencing an object owned by another account. In plain terms: wherever the request says "use object number X", try an X that belongs to a second account you control, and see whether the server objects.
  2. Ownership checks on update rather than create. Try editing an existing poll or post to point at another user's image ID. A positive result is a successful update that binds a foreign object. Developers often remember to check ownership when something is created and forget the same check when it is edited later.
  3. Lifecycle coupling. Wherever a parent object can reference a child, test whether deleting the parent deletes the child. A positive result is a foreign object being removed as a side effect of deleting your own object. This is exactly the pattern that made the poll bug destructive.
  4. Cross-account verification. Always confirm with a second account that the referenced object really belongs to someone else and that the effect (for example deletion) is visible from that account. This is basic good practice: without a second account, you cannot prove the object was not yours, and you cannot see the damage from the victim's point of view.

Glossary

  • API: the set of rules and addresses a service exposes so that programs (including your browser) can ask it to do things, such as create a poll or fetch an image.
  • Authentication: proving who you are, usually by logging in.
  • Authorisation: deciding what an identified user is allowed to do, such as whether they may use a particular image.
  • Backend: the server-side part of a system that processes requests and stores data, as opposed to what you see on screen.
  • Bounty: a reward paid by a company for a responsibly reported security problem.
  • Broken object-level authorization: a flaw where the server checks that you are logged in but not that the specific object you name by ID belongs to you.
  • Client: your device and software, such as a browser or app, that sends requests to a server.
  • Client-controlled: a value that comes from your device and can therefore be changed before it is sent.
  • Disclosure: making the details of a fixed vulnerability public.
  • ID (identifier): a number or string that names one specific object in a database, like a house address.
  • Image ID: the identifier that names one particular uploaded image.
  • Intercept: to catch a request between your browser and the server so you can read or modify it.
  • Lifecycle coupling: when two objects are tied together so that deleting one also deletes the other.
  • Ownership check: a server-side test confirming that the object being referenced belongs to the account making the request.
  • Parameter: one named piece of information inside a request, with a name and a value.
  • Poll: a Facebook post containing a question and a set of answer options, each of which can carry an image.
  • Proxy: a program that sits between your browser and the internet, letting you inspect and edit traffic.
  • Request: the structured message your browser sends to a server asking it to do something.
  • Response: the message the server sends back after processing a request.
  • Server: the remote computer that receives requests and stores the data.
  • Triage: the process of reviewing a security report and confirming it is a real problem worth fixing.
  • Vulnerability: a weakness in software that allows someone to make it behave in a way its owners did not intend.

More by Pouya Darabi

View all

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