Skip to content
IDOR Write-up Intermediate

How I could view any Facebook Groups Notes media, and they paid me a $10,000

An IDOR vulnerability in Facebook Groups Notes allowed an attacker to view private media from any group by replacing the cover_media_id in a GraphQL mutation request with a victim's media ID. The attacker could access media that should have been restricted to group members.

Raja Sudhakar Follow

Published on medium.com

Bounty$10,000 View original

Hi, This is Raja Sudhakar from Coimbatore, Tamil Nadu. I am freedom security researcher.

Raja Sudhakar, 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 Notes was a feature that let users write and publish longer-form content, similar to blog posts or articles. It was introduced as a way to share more detailed and substantial content compared to regular status updates or short posts. Notes allowed users to create rich-text posts with formatting options such as headings, bullet points, images, and hyperlinks.

The vulnerability described here is an IDOR (Insecure Direct Object Reference), which let the researcher view the media attached to any Facebook Groups Notes, including media belonging to private groups. Facebook acknowledged the issue, fixed it, and awarded a US $10,000 bounty based on the severity and impact.

Setup

The report does not describe any special accounts, roles or tooling beyond an authenticated Facebook session. The vulnerable request shown below is a GraphQL mutation sent from the web client, carrying the researcher's own session cookies and actor id. The precondition is simply that the attacker is logged in and can create or edit a Note, so that the client issues the document-version mutation with a cover_media_id under the attacker's control.

Finding it

The researcher identified that the mutation used to create a document version for the Notes editor (usePaperCreateDocumentVersionForLexical_Mutation) accepts a cover_media_id in its source_payload. That identifier is a direct reference to a media object, and the server did not appear to check that the caller was authorised to use the referenced media. Replacing the cover_media_id with a victim's private group media id led to viewing the victim's media.

Exploitation

Step 1: Capture the document-version mutation

The researcher captured the request the Notes editor sends when creating a document version. It is a multipart POST to the GraphQL endpoint on www.facebook.com, with the friendly name usePaperCreateDocumentVersionForLexical_Mutation:

The important parts are the variables field, which carries the mutation input as JSON, and inside it the source_payload object. cover_media_id is the media object used as the Note's cover, document_case_id identifies the Note being edited, actor_id is the acting user, and payload holds the rich-text body. The fb_dtsg and __hs/__ccg fields are the usual anti-CSRF and client metadata parameters the web client sends.

Step 2: Swap in the victim's media id

The researcher replaced the cover_media_id value with the media id of a victim's private group Note. Sending the modified request led to viewing the victim's media.

From the original on medium.com

Root cause

The behaviour is consistent with the mutation not verifying that the acting user had permission to access the referenced media object. Because the id is a direct object reference, replacing it with a victim's private group media id let the researcher view that media. The report does not describe the server-side code, so the exact check that was missing is not stated; the behaviour is consistent with an authorisation check on the media object being absent or insufficient.

Impact

The researcher describes the issue as allowing them to view any Facebook Groups Notes media, including media from private groups. The researcher describes the issue as allowing them to view any Facebook Groups Notes media. Facebook awarded a US $10,000 bounty based on the severity and impact.

Fix

Facebook fixed the vulnerability. The appropriate fix is a server-side authorisation check that the acting user can access the referenced media object before it is used in the mutation, rather than relying on the client to supply only ids the user owns.

Disclosure timeline

  1. 13 July 2023 at 14:20: Report sent to Facebook Security team
  2. 13 July 2023 at 20:46: Bug acknowledged by Facebook Security team
  3. 19 July 2023 at 17:36: Vulnerability fixed
  4. 26 July 2023 at 19:54: Bounty of $10,000 awarded by Facebook
From the original on medium.com

Variants to test

  • Other media reference fields in the same mutation: try media_ids and any other id-bearing fields in source_payload with a victim's media id. A positive result is the response returning media the attacker does not own.
  • Other document or Note mutations: look for mutations that accept a media or document id, such as version history or cover updates, and substitute a foreign id. A positive result is the foreign object being returned or attached.
  • Cross-group references: use a media id from a private group the attacker is not a member of. A positive result is the media being viewable despite the group's privacy settings.
  • Id enumeration: if ids are sequential or predictable, test nearby values. A positive result is any id resolving to another user's media.

Thanks to the Facebook security team for quickly fixing the issue. This is published with the permission of Facebook under the responsible disclosure policy; the vulnerability is now fixed.

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. 9 min read.

What happened, in plain words

Facebook Notes was a feature that let people write and publish longer pieces of content, more like a blog post or an article than a short status update. You could add headings, bullet points, images and links, and the result looked like a small web page inside Facebook. Notes could also live inside Facebook Groups, including private groups that only members can see.

A security researcher, Raja Sudhakar, found that replacing the cover_media_id in a Notes request with a victim's private group media id let him view that media. By replacing the cover_media_id with the identifier of media from someone else's private group Note, he could view that media. This kind of flaw is called an IDOR, short for Insecure Direct Object Reference: the server uses an identifier supplied by the user to look something up directly, and forgets to ask whether this particular user is allowed to look at it.

Facebook confirmed the report, fixed the problem and paid a US $10,000 bounty. The researcher published the write-up with Facebook's permission after the fix.

A useful everyday comparison: imagine a hotel where every room key is just a number written on a card. The reception desk is supposed to check that the number belongs to you before it lets you in, but if it simply trusts whatever number is on the card, you can write down someone else's room number and walk into their room. The room number is the "direct object reference"; the missing check at the desk is the missing authorisation.

Background: what Facebook Notes was

Facebook Notes let users create rich-text posts with formatting options such as headings, bullet points, images and hyperlinks. It existed to share more detailed and substantial content than a normal post. Notes could be attached to Groups, including private groups.

The vulnerability type: IDOR

IDOR stands for Insecure Direct Object Reference. The idea is simple: a web application stores things (photos, documents, messages) under identifiers, and when your browser asks for one of those things it sends the identifier along. If the server looks the thing up by that identifier and returns it without checking that you are entitled to it, you can change the identifier to someone else's and get their data.

The researcher cites the OWASP reference for this class of bug: https://www.owasp.org/index.php/Top_10_2010-A4-Insecure_Direct_Object_References

Some concepts you need first

  • API: the set of addresses a website's own pages use to talk to its servers in the background. When you click something on Facebook, your browser does not reload the whole page; it sends a small message to an API and gets data back. Think of it as the service counter at the back of a shop, where the staff go to fetch what you asked for.
  • GraphQL: a style of API where the browser sends one request describing exactly what it wants, and the server answers with data in a matching shape. Facebook's web client uses a GraphQL endpoint at /api/graphql/.
  • Mutation: in GraphQL, a request that changes something (creates, edits, deletes) rather than just reading. Creating a new version of a Note is a mutation.
  • Cookie: a small piece of data your browser stores for a site and sends back with every request. Facebook uses cookies to know who you are, so a request without your cookies is treated as a stranger. The Cookie: header in the request below carries the researcher's own logged-in session.
  • Session: the state of being logged in. Your cookies are the proof of that session.
  • CSRF token: a value the site puts into its pages so that a request coming from a real page can be told apart from a forged one. fb_dtsg is Facebook's name for this kind of value.
  • Multipart form data: a way of sending a request body as several named parts, like a form with several fields, separated by a boundary string. The ------WebKitFormBoundary... lines are those separators.
  • Media id: the identifier Facebook uses internally for a photo or other media object. It is just a number, and the server uses it to find the actual file.
  • Bounty: a reward a company pays a researcher who reports a security problem responsibly.

Setting up

The report does not describe any special accounts, roles or tools beyond an ordinary logged-in Facebook session. The vulnerable request is a GraphQL mutation sent by the normal web client, carrying the researcher's own cookies and user id. The only precondition is that the attacker is logged in and can create or edit a Note, so that the browser sends the document-version mutation with a cover_media_id that the attacker controls.

In other words: no hacking tools, no special access. Just a normal account, a browser, and the ability to look at and change the request the browser sends.

Finding it

The researcher noticed that the mutation used to create a document version for the Notes editor, named usePaperCreateDocumentVersionForLexical_Mutation, accepts a cover_media_id inside its source_payload. That identifier points directly at a media object. The server did not appear to check that the caller was allowed to use the referenced media. So supplying a media id that belonged to a private group's Note looked like it would let the attacker pull that media into their own Note.

Why does that matter? Because the cover image of a Note is fetched by id. If the server only checks "does this id exist?" and not "is this user allowed to see this id?", then any id you can obtain becomes readable.

Exploitation

Step 1: Capture the document-version mutation

The researcher captured the request the Notes editor sends when it creates a document version. It is a multipart POST to the GraphQL endpoint on www.facebook.com, with the friendly name usePaperCreateDocumentVersionForLexical_Mutation:

Line by line, in plain words:

  1. POST /api/graphql/ HTTP/2 is the request line: it says "send this to the GraphQL API address, using HTTP/2, and this is a POST (a request that carries data to the server)".
  2. Host: www.facebook.com tells the server which site the request is for.
  3. Cookie: ... is the browser's identity badge. It contains the researcher's own session cookies. The values are redacted here because they are secrets; anyone holding them could act as that user.
  4. The ------WebKitFormBoundary... lines are separators between the parts of a multipart body. Each part starts with a Content-Disposition line naming the field.
  5. name="__hs" with value 2 and name="__ccg" with value 15 are small pieces of client metadata the web client sends along.
  6. name="fb_dtsg" with value RelayModern is the anti-CSRF value: proof that the request came from a real page rather than a forged one.
  7. name="fb_api_req_friendly_name" with value usePaperCreateDocumentVersionForLexical_Mutation is a human-readable label for which operation this is. It tells the server which mutation to run.
  8. name="variables" is the important part: it carries the mutation's input as JSON. Inside it:
    • connections names the list the client is interested in, here the document version history panel.
    • input.client_mutation_id is a client-side counter for matching responses to requests.
    • input.actor_id is the id of the user performing the action, that is, the researcher.
    • input.document_case_id identifies the Note being edited.
    • input.source_payload describes the content of the new version. Inside it, cover_media_id is the media object used as the Note's cover, cover_media_offset_y positions it, media_ids is a list of other media (empty here), and payload holds the rich-text body as a JSON string (here a single paragraph containing the word qwerty). subtitle and title are the Note's text fields; the title here is Attacker Note.
    • version is the version number of the document being saved.
  9. name="server_timestamps" with value true asks the server to include its own timestamps in the response.

Why capture this request? Because to change one value safely, you first need to see the exact shape of the request the browser sends. The browser's developer tools let you watch requests go out and copy them, which is how the researcher got this text.

Step 2: Swap in the victim's media id

The researcher replaced the cover_media_id value with the media id of a victim's private group Note. Sending the modified request led to viewing the victim's media.

From the original on medium.com

The report does not describe why this worked; it only states that replacing the cover_media_id led to viewing the victim's media.

Root cause

The behaviour is consistent with the mutation not verifying that the acting user had permission to access the referenced media object. Because the id is a direct object reference, replacing it with a victim's private group media id let the researcher view that media.

In everyday terms: the hotel desk accepted the room number written on the card without checking it against the guest list.

Impact

The researcher describes the issue as allowing them to view any Facebook Groups Notes media, including media from private groups. The researcher describes the issue as allowing them to view any Facebook Groups Notes media. Facebook awarded a US $10,000 bounty based on the severity and impact.

Fix

Facebook fixed the vulnerability. The appropriate fix is a server-side authorisation check that the acting user can access the referenced media object before it is used in the mutation, rather than relying on the client to send only ids the user owns.

Disclosure timeline

  1. 13 July 2023 at 14:20: Report sent to Facebook Security team
  2. 13 July 2023 at 20:46: Bug acknowledged by Facebook Security team
  3. 19 July 2023 at 17:36: Vulnerability fixed
  4. 26 July 2023 at 19:54: Bounty of $10,000 awarded by Facebook
From the original on medium.com

Variants to test

If you are learning from this report, these are the follow-up ideas it suggests. Each one is the same basic question: does the server check permission on the object, or does it just trust the id?

  • Other media reference fields in the same mutation: try media_ids and any other id-bearing fields in source_payload with a victim's media id. A positive result is the response returning media the attacker does not own.
  • Other document or Note mutations: look for mutations that accept a media or document id, such as version history or cover updates, and substitute a foreign id. A positive result is the foreign object being returned or attached.
  • Cross-group references: use a media id from a private group the attacker is not a member of. A positive result is the media being viewable despite the group's privacy settings.
  • Id enumeration: if ids are sequential or predictable, test nearby values. A positive result is any id resolving to another user's media.

Thanks to the Facebook security team for quickly fixing the issue. This is published with the permission of Facebook under the responsible disclosure policy; the vulnerability is now fixed.

Glossary

  • API: the set of addresses a website's own pages use to talk to its servers in the background, so the page can update without reloading.
  • Authorisation: the check that a particular user is allowed to do or see a particular thing.
  • Cookie: a small piece of data your browser stores for a site and sends back with every request, often used to identify your session.
  • CSRF token: a value embedded in a page so the server can tell a genuine request from a forged one; fb_dtsg is Facebook's name for it.
  • IDOR (Insecure Direct Object Reference): a flaw where the server looks up an object by an identifier supplied by the user without checking that the user is allowed to access it.
  • Media id: the internal identifier Facebook uses for a photo or other media object.
  • Multipart form data: a way of sending a request body as several named parts separated by a boundary string.
  • Private group: a Facebook Group whose content is visible only to its members.
  • Session: the state of being logged in; your cookies are the proof of it.
  • Severity: a rating of how serious a vulnerability is, usually based on impact and ease of exploitation.
  • Responsible disclosure: publishing details of a fixed vulnerability with the vendor's permission, after users are protected.

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.