Skip to content
IDOR Write-up Intermediate

Facebook IDOR: Deleting Any Photo Album (Case Study)

A Facebook Graph API endpoint checked whether the calling app had permission to delete albums but not whether the calling user owned the album. An attacker could delete any album they could see, including those owned by other users, Pages and groups.

Muhammad Asim Shahzad Follow

Published on masimshahzad.medium.com

Bug Bounty

Muhammad Asim Shahzad, on masimshahzad.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's Graph API is the shared back end behind Facebook's own apps and third-party developer apps. Each access token carries the capabilities of the app that issued it, so what a token can do depends on which app it came from. Photo albums are one of the objects the API exposes, and the delete operation on an album is the feature at the centre of this case.

In early 2015, Laxman Muthiyah reported an IDOR on that delete operation: one user could delete photo albums owned by other users, Pages or groups, as long as the album was visible to them. Facebook acknowledged the report and shipped a fix in under two hours, and paid $12,500. The case study below is an analytical write-up of that public disclosure, not the researcher's own discovery, and it deliberately leaves out request formats, token types and reproduction details.

AI-generated illustration From the original on masimshahzad.medium.com

The illustration above is an AI-generated image for the case study.

Setup

The precondition that matters is visibility: the attack worked against albums the attacker could view. The other precondition is a token from an app that holds the album-delete capability, which is where the finding starts.

Finding it

Public developer documentation said albums could not be deleted through the API. A normal developer token was refused, with a message saying the app lacked that capability.

That refusal was the clue. If the API refuses because the app lacks a capability, then some app must have it. The researcher tried a token belonging to Facebook's own mobile app, which is more privileged, and the delete worked on his own album. The next question was whether it would work on an album that was not his.

Exploitation

Step 1: Confirm the capability exists

A normal developer token was rejected on the album delete call with a message stating the app lacked the capability. This suggested that the check being applied was about the calling app, not the calling user.

Step 2: Use a more privileged app's token

The researcher used a token belonging to Facebook's own mobile app and repeated the delete against an album he owned. It succeeded. This proved the operation was reachable through the API despite the documentation, provided the token came from an app with the capability.

Step 3: Target someone else's album

He then ran the same delete against an album that was not his. It worked. The endpoint checked whether the calling app was allowed to delete albums, but not whether the calling user owned the album named in the request.

Album IDs are not secret, so any album a user could view became an album they could erase.

Root cause

The delete endpoint performed an app-level capability check and stopped there. Authorisation was answered for the caller's app, not for the caller's user against the specific object. The missing piece is object-level authorisation: confirming that this user may act on this album.

Existing defences did not stop it because the capability gate was real and did its job; it simply answered a different question. The documentation's claim that albums could not be deleted through the API was also misleading, since a sufficiently privileged app token could. The refusal message for ordinary developer tokens revealed that a hidden capability existed, which is what pointed the researcher at first-party app tokens.

Impact

Per the researcher, an attacker could delete any album they could see: public albums of individuals, plus albums owned by Pages and groups. For individuals that means permanent loss of memories; for brands and communities it is destructive vandalism at scale. No social engineering was needed.

The report lists no CVE and no severity or CVSS score. The bounty was $12,500, as reported by the source.

Fix

Facebook fixed the issue, shipping the fix in under two hours after acknowledging the report. The report does not describe the change itself.

The case study's own recommendations for APIs in general are:

  1. Authorise the object, not just the caller. App capability, token scope and user identity are separate checks. Every read, update and delete must confirm that this user may act on this specific object.
  2. Centralise the policy. Put ownership and role logic in one authorisation layer that every client path calls, including first-party apps.
  3. Give destructive actions extra friction. Soft-delete with a restore window, rate-limit bulk deletes, and log actor plus owner for every removal.

The illustrative code from the case study:

Python
def delete_album(album_id, ctx):    album = albums.get(album_id)    if album is None:        raise NotFound()    if not ctx.app.has_capability("album:delete"):        raise Forbidden("app not permitted")    if not policy.can_delete(actor=ctx.user, resource=album):        audit.log("denied_delete", ctx.user.id, album.owner_id)        raise NotFound()          albums.soft_delete(album_id, by=ctx.user.id, restore_days=30)    audit.log("album_deleted", ctx.user.id, album.owner_id)def can_delete(actor, resource):    return (resource.owner_id == actor.id            or actor.is_admin_of(resource.owner_id))

Variants to test

  • First-party or privileged app tokens against object endpoints. Take a token from a first-party client and call delete, update or read operations on objects owned by another account. A positive result is a successful state change on an object the user does not own.
  • Capability errors as a map. Send requests with an ordinary token and read the refusal messages. A message that names a missing capability tells you a more privileged app exists; a positive result is a different token type getting past that gate.
  • Documentation gaps. Where docs say an operation is not available through the API, try it anyway with tokens from different app types. A positive result is the operation succeeding despite the documentation.
  • Guessing object identifiers. Use album or object IDs belonging to other users, Pages and groups that you can view. A positive result is a delete or modification on an object you do not own.
  • Separate the two questions. For each destructive endpoint, check whether the app-level check and the user-level ownership check are both enforced. A positive result is an endpoint that enforces only one of them.

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

Facebook lets people keep their photos in albums. In early 2015, a security researcher named Laxman Muthiyah found a way to delete photo albums that belonged to other people, to Facebook Pages and to groups, as long as he could see the album on screen. He did not need the owner's password, and he did not need to trick anyone into clicking anything. Facebook confirmed the report, fixed the problem in under two hours, and paid him $12,500.

This article walks through that public report slowly, for someone who has never studied security. It explains every term the first time it appears, and it explains why each step in the researcher's thinking made sense. The case study it is based on is an analytical write-up of a public disclosure, not the researcher's own discovery, and it deliberately leaves out the exact request formats, token types and reproduction details.

AI-generated illustration From the original on masimshahzad.medium.com

The illustration above is an AI-generated image made for the case study.

The pieces you need to know first

Before the story makes sense, four ideas need to be clear.

An API. Think of a restaurant. You do not walk into the kitchen and cook; you tell the waiter what you want, and the waiter carries the order to the kitchen and brings back the result. An API (Application Programming Interface) is that waiter for software. A program sends a request such as "delete album number 123", and the server does the work and sends back an answer. Facebook's Graph API is the waiter that sits in front of Facebook's data: it is the shared back end behind Facebook's own apps and behind apps made by outside developers.

A token. When you log in somewhere, the server needs a way to recognise your later requests. It gives your app a token: a long string of characters that the app attaches to every request, like a wristband at an event. The wristband proves you were let in, and it may also say which areas you are allowed to enter. In this story, each token carries the capabilities of the app that issued it, so what a token can do depends on which app it came from.

An album object. In API language, an album is an object: a named thing stored on the server with an identifier, in this case an album ID. The delete operation on an album is the feature at the centre of this case.

IDOR. IDOR stands for Insecure Direct Object Reference. It means the server lets you name a specific object directly, by its ID, and then fails to check whether that object is yours to touch. A simple comparison: a hotel clerk who hands over any room key you ask for, as long as you are a paying guest, without checking that the room is the one you booked. The guest is legitimate; the room is not theirs. That is the whole idea, and it is the vulnerability class in this report.

The setup

Two preconditions are all that matter.

The first is visibility: the attack worked against albums the attacker could view. If the album appeared on screen for him, it was a candidate.

The second is a token from an app that holds the album-delete capability. A capability here means a permission attached to an app, a flag saying "this app is allowed to perform this kind of action". The finding starts from that second precondition, so that is where the story goes next.

Finding it

Facebook's public developer documentation said albums could not be deleted through the API. Documentation is the instruction manual Facebook publishes for outside developers, so this was a plain statement that the delete operation was not available to them.

When the researcher tried a delete with a normal developer token, the request was refused. The refusal message said the app lacked that capability.

That refusal was the clue. Read it carefully: the API did not say "you are not allowed". It said the app lacked a capability. If the API refuses because the app lacks a capability, then some app must have it, otherwise the check would have nothing to protect. The researcher tried a token belonging to Facebook's own mobile app, which is more privileged, and the delete worked on his own album. The next question was the interesting one: would it work on an album that was not his?

Exploitation, step by step

Step 1: Confirm the capability exists

A normal developer token was rejected on the album delete call, with a message stating the app lacked the capability. This suggested something important: the check being applied was about the calling app, not the calling user. The server was asking "is this app allowed to delete albums?" and never asking "is this person allowed to delete this album?".

Step 2: Use a more privileged app's token

The researcher used a token belonging to Facebook's own mobile app and repeated the delete against an album he owned. It succeeded. This proved the operation was reachable through the API despite the documentation, provided the token came from an app with the capability. In other words, the manual was wrong, and the door was open to anyone holding the right kind of wristband.

Step 3: Target someone else's album

He then ran the same delete against an album that was not his. It worked. The endpoint checked whether the calling app was allowed to delete albums, but not whether the calling user owned the album named in the request.

Album IDs are not secret, so any album a user could view became an album they could erase. This is the IDOR in one sentence: the server accepted the ID of an object, acted on it, and never compared the object's owner with the person making the request.

Why it happened

The delete endpoint performed an app-level capability check and stopped there. Authorisation, meaning the decision about who may do what, was answered for the caller's app, not for the caller's user against the specific object. The missing piece is object-level authorisation: confirming that this user may act on this album.

Existing defences did not stop it because the capability gate was real and did its job. It simply answered a different question. The documentation's claim that albums could not be deleted through the API was also misleading, since a sufficiently privileged app token could. And the refusal message shown to ordinary developer tokens revealed that a hidden capability existed, which is exactly what pointed the researcher at first-party app tokens.

What it meant in practice

Per the researcher, an attacker could delete any album they could see: public albums of individuals, plus albums owned by Pages and groups. For individuals that means permanent loss of memories. For brands and communities it is destructive vandalism at scale. No social engineering was needed, which means nobody had to be tricked into handing anything over; the attacker simply asked the API to delete, and the API complied.

The report lists no CVE and no severity or CVSS score. CVSS is a standard scoring system for measuring how severe a vulnerability is, and a CVE is a public catalogue number for a known flaw; neither was assigned here. The bounty was $12,500, as reported by the source.

The fix

Facebook fixed the issue, shipping the fix in under two hours after acknowledging the report. The report does not describe the change itself.

The case study's own recommendations for APIs in general are:

  1. Authorise the object, not just the caller. App capability, token scope and user identity are separate checks. Every read, update and delete must confirm that this user may act on this specific object.
  2. Centralise the policy. Put ownership and role logic in one authorisation layer that every client path calls, including first-party apps.
  3. Give destructive actions extra friction. Soft-delete with a restore window, rate-limit bulk deletes, and log actor plus owner for every removal.

A few of those words deserve a plain explanation. Token scope is the list of things a token is permitted to do. A first-party app is one made by the company itself, such as Facebook's own mobile app, as opposed to a third-party app made by an outside developer. Soft-delete means marking an item as deleted while keeping the data for a while, so it can be restored; a restore window is the period during which that is possible. Rate-limiting means capping how many actions can be performed in a given time, so a bulk delete cannot run wild. Logging actor plus owner means recording who did the removal and who owned the item, so the action can be traced later.

The illustrative code from the case study:

Python
def delete_album(album_id, ctx):    album = albums.get(album_id)    if album is None:        raise NotFound()    if not ctx.app.has_capability("album:delete"):        raise Forbidden("app not permitted")    if not policy.can_delete(actor=ctx.user, resource=album):        audit.log("denied_delete", ctx.user.id, album.owner_id)        raise NotFound()          albums.soft_delete(album_id, by=ctx.user.id, restore_days=30)    audit.log("album_deleted", ctx.user.id, album.owner_id)def can_delete(actor, resource):    return (resource.owner_id == actor.id            or actor.is_admin_of(resource.owner_id))

Line by line, in plain words:

  • def delete_album(album_id, ctx): starts the function that handles a delete request. It receives the album ID and a context object, ctx, which bundles up who is calling and which app they are using.
  • album = albums.get(album_id) looks the album up in the storage by its ID.
  • if album is None: and raise NotFound() handle the case where no such album exists, by answering as if it were not found.
  • if not ctx.app.has_capability("album:delete"): asks whether the calling app holds the album-delete capability. This is the check Facebook already had.
  • raise Forbidden("app not permitted") refuses the request when the app lacks that capability.
  • if not policy.can_delete(actor=ctx.user, resource=album): is the check Facebook was missing. It asks the policy whether this specific user may delete this specific album.
  • audit.log("denied_delete", ctx.user.id, album.owner_id) records the refused attempt, noting who tried and who owns the album.
  • raise NotFound() then answers as if the album did not exist, so the response does not confirm that someone else's album is there.
  • albums.soft_delete(album_id, by=ctx.user.id, restore_days=30) performs the delete softly, recording who did it and keeping a 30-day window in which it can be restored.
  • audit.log("album_deleted", ctx.user.id, album.owner_id) records the successful removal, again with actor and owner.
  • def can_delete(actor, resource): defines the policy function itself, the single place where the ownership rule lives.
  • return (resource.owner_id == actor.id allows the action when the album's owner is the person asking.
  • or actor.is_admin_of(resource.owner_id)) also allows it when the person is an administrator of the owner, for example a Page admin acting for the Page.

Variants to test

These are the case study's suggestions for people testing their own systems, written as things to try and what a positive result looks like.

  • First-party or privileged app tokens against object endpoints. Take a token from a first-party client and call delete, update or read operations on objects owned by another account. A positive result is a successful state change on an object the user does not own.
  • Capability errors as a map. Send requests with an ordinary token and read the refusal messages. A message that names a missing capability tells you a more privileged app exists; a positive result is a different token type getting past that gate.
  • Documentation gaps. Where docs say an operation is not available through the API, try it anyway with tokens from different app types. A positive result is the operation succeeding despite the documentation.
  • Guessing object identifiers. Use album or object IDs belonging to other users, Pages and groups that you can view. A positive result is a delete or modification on an object you do not own.
  • Separate the two questions. For each destructive endpoint, check whether the app-level check and the user-level ownership check are both enforced. A positive result is an endpoint that enforces only one of them.

Glossary

  • API: the interface a program uses to ask a server to do something and get an answer back, like a waiter carrying orders to a kitchen.
  • Graph API: Facebook's shared back end, used by Facebook's own apps and by third-party developer apps.
  • Token: a string of characters an app attaches to requests so the server can recognise it and know what it is allowed to do, like a wristband at an event.
  • Capability: a permission attached to an app saying it may perform a certain kind of action, such as deleting albums.
  • Token scope: the list of things a token is permitted to do.
  • Object: a named thing stored on a server, such as a photo album, usually reachable by an identifier.
  • Object ID: the identifier of a specific object, such as a particular album.
  • Endpoint: the specific address in an API that handles one kind of request, such as the delete operation on an album.
  • IDOR (Insecure Direct Object Reference): a flaw where the server accepts an object's ID and acts on it without checking that the object belongs to the person making the request.
  • Authorisation: the decision about who is allowed to do what.
  • Object-level authorisation: checking that this particular user may act on this particular object.
  • App-level capability check: checking only that the calling app holds a permission, without checking the user or the object.
  • First-party app: an app made by the company itself, such as Facebook's own mobile app, as opposed to a third-party app made by an outside developer.
  • Third-party developer: someone outside the company who builds apps on top of its API.
  • Documentation: the instruction manual a company publishes describing what its API can do.
  • Social engineering: tricking a person into handing over access or information, rather than attacking the system directly.
  • CVSS: a standard scoring system for measuring the severity of a vulnerability.
  • CVE: a public catalogue number assigned to a known vulnerability.
  • Bounty: a payment a company makes to a researcher who reports a valid security flaw.
  • Soft-delete: marking an item as deleted while keeping the data for a period, so it can be restored.
  • Restore window: the period during which a soft-deleted item can be brought back.
  • Rate-limit: a cap on how many actions can be performed in a given time.
  • Audit log: a record of actions taken, including who did what, kept so activity can be traced.
  • Page: a Facebook profile for a brand, organisation or public figure.
  • Group: a Facebook space where a set of people share posts and photos.

More by Muhammad Asim Shahzad

View all

21 more disclosed reports, best first.

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.