Skip to content
Access control Write-up Intermediate

Distorted and Undeletable Posts in Facebook Group

The Facebook Groups 'Units' feature did not properly verify that the post ID belonged to the same group as the unit being created. An attacker could supply a post ID from a different group, causing that post to become distorted or undeletable for its owner and group admins.

Sarmad Hassan Follow

Published on medium.com

{{media:0}}

Sarmad Hassan (Juba Baghdad), 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. 7 min read.

Context

Facebook Groups have a feature called Units, which lets a group use its posts as a platform for online course content, or simply organise posts by topic. The researcher links to a Facebook post by Marismith describing the feature as "another new Facebook feature you can add units to Facebook groups". Only an admin of a group can create, edit or delete a unit, and only an admin can add a post to a unit.

The bug described here lives in the endpoint that creates a unit together with a post, POST /groups/learning/create_with_post/. The researcher found that the post_id value in that request was trusted, which allowed a post in one group to be attached to a unit in another group.

Setup

The researcher used one group of his own and two groups he did not administer:

  • An attacker group (his test group), where he was admin and where Units were enabled.
  • A victim group, used for the first test.
  • A second victim group, referred to as the noobs group, used to reproduce the bug on a different type of group.

He created a Live video post in his test group and used Burpsuite to intercept the request. The report does not give the Facebook app version, browser or any other environment detail.

Finding it

The researcher was testing the Live Video option in a Facebook group, which he had not tested before. He created a live video in his test group and spent some time on the feature without finding anything. He then tried to delete the live video post by clicking the three dots on the post, and noticed an option called Units in the post menu.

Image for post
Unit option will appear in the post option, if you enabled units in the group From the original on medium.com

The screenshot shows the post options menu with the Units entry, which appears when units are enabled in the group. He had tested the Units option before without finding anything interesting, but decided to try it again from this place. He clicked Add to new unit and got a dialog for creating a unit.

Image for post
when you create new unit this window will pop up, fill the details and create new one From the original on medium.com

He filled the details randomly and intercepted the request with Burpsuite.

Exploitation

Step 1: capture the unit creation request

The intercepted request looked like this:

HTTP
POST /groups/learning/create_with_post/?group_id=[My_Test_Group_ID]&post_id=[My_Post_ID]&dpr=1 HTTP/1.1

jazoest=[number]&fb_dtsg=[anti_csrft ]&unit name=bla&unit description=bla&post title=bla

Two parameters caught his attention: group_id and post_id. The body also carries the usual jazoest and fb_dtsg values, plus the unit name, unit description and post title.

He formulated two questions:

  1. What happens if group_id is changed to another group's id (the victim group)? Can a new unit be created in the other group and his own live video post be added to it?
  2. What happens if post_id is changed to a post id from another group (the victim group)? Can posts from another group be added to his unit in his own test group?

Step 2: change group_id

He changed the group_id value to the victim group's id. This did not work.

Step 3: change post_id

He then changed the post_id value to a post id from the victim group. The response was:

HTTP
HTTP/1.1 200 OK

 for (;;);{"__ar":1,"payload":null,"jsmods":{"require":[["ServerRedirect","redirectPageTo",[],["\/groups\/[attacker_group_id]\/learning_content\/?filter=filter number&post=[victim_post_id]",false,false]]]},"js":["IO8eo","EizOb"],"bootloadable":{},"resource_map":{"IO8eo":{"type":"js","src":"https:\/\/static.xx.fbcdn.net\/rsrc.php\/v3ioAY4\/yo\/l\/en_US\/rcyi0X4VRXd.js","crossOrigin":1},"EizOb":{"type":"js","src":"https:\/\/static.xx.fbcdn.net\/rsrc.php\/v3i6Hv4\/yd\/l\/en_US\/si3hiFNne1g.js","crossOrigin":1}},"ixData":{},"gkxData":{},"lid":"lid number"}

The response is a 200 with a ServerRedirect instruction pointing at the attacker's group's learning content page, with the victim's post id in the post parameter. The request was accepted even though the post belonged to another group.

Step 4: check the victim group

He switched to the victim group account and checked the post.

Image for post
Attachment Unavailable appears when the attacker added “text post only” from victim group to his unit From the original on medium.com

The post in the victim group now showed Attachment Unavailable. The researcher describes this as distorting a post: only text posts were affected, and the post was made to look like the broken form in the screenshot.

Step 5: reproduce on a second victim group

To confirm the bug worked on all types of groups, he repeated it against another victim group, the noobs group. He took the request from his own group as an attacker and replaced post_id with the id of a post in the noobs group. The post was his own, but it was in a group where he was not an admin. The response was again 200 OK and everything worked.

When he checked the post in the noobs group, he saw this:

Image for post
Delete me if you can was the title of attacker unit in his group, and it appears above the post in victim group From the original on medium.com

The title of his unit, Delete me if you can, appeared above the post in the victim group. In this second test the post was not distorted with Attachment Unavailable; instead the unit title was placed above any post, and the post became undeletable by its owner and by the group admin.

Root cause

The endpoint POST /groups/learning/create_with_post/ takes both group_id and post_id from the request and does not verify that the post belongs to the group the unit is being created in, or that the caller has any rights over the post's group. Changing group_id to the victim group failed, but the post_id is not checked against the group. The anti-CSRF values (jazoest, fb_dtsg) are present in the request; the flaw is authorisation on the referenced object.

Impact

The researcher lists two impacts:

  1. An attacker can distort only text posts in a victim group, for any member (admin, moderator or normal user), if the owner of the post is not a member of the attacker's group.
  2. An attacker can make any post (photo, video, events and so on) in a victim group undeletable for any member (admin, moderator or normal user), and can put the title of his unit above the victim's post, by inviting the owner of the post to his group (attacker group).

The second impact therefore depends on the post owner joining the attacker's group. The report does not state a CVSS score or a bounty amount.

Fix

The report gives a timeline rather than a description of the code change:

Date Event
June 18, 2018 Initial report
June 20, 2018 Report triaged
July 31, 2018 Bug fixed
July 31, 2018 Fix confirmed
August 2, 2018 Bounty awarded
Image for post
Image for post From the original on medium.com

The fix that would address the root cause is to validate on the server that the post_id belongs to the group identified by group_id, and that the caller is an admin of that group, before creating the unit and attaching the post.

Coincidence

After submitting the bug, the researcher remembered reading about undeletable posts on Facebook before. A search led him to a video by another researcher, published on May 9, 2018, showing the same bug from a different endpoint.

He contacted Richard Telleng, the researcher who had found it first. Telleng told him the bug had been fixed and that Facebook had already rewarded him a bounty for it. The researcher informed the Facebook Security Team about the whole story and thanks Telleng for his honesty and support.

Variants to test

  • Other object-reference parameters. Look for endpoints that take both a container id and a child object id (for example group_id and post_id, album_id and photo_id, page_id and post_id). Change only the child id to an object from another container you do not control. A positive result is a 200 response that references your container with the foreign object id, and a visible change on the foreign object.
  • Swap the container id instead. Change only the container id to a group or page you do not administer. A positive result is a unit or item created in the other container. In this report that attempt failed.
  • Cross-role checks. Repeat the test as a normal member, a moderator and an admin of the victim group, and as a non-member. A positive result is the same distortion or undeletable state for a role that should have no rights over the object.
  • Membership precondition. Test whether the impact depends on the post owner being a member of the attacker's container, as it did here. A positive result is that the effect appears only after the owner joins, which points at a membership-based authorisation check rather than an ownership check.
  • Different post types. Try text, photo, video and event posts. A positive result is that text posts are distorted and other types become undeletable, matching the two impacts described here.

Takeaways

The researcher closes with three points: test an option from different areas, because there is a chance of finding something interesting in it; if you find that another researcher reported the same bug, contact them and be honest about whether it is fixed; and be honest with the security team as well.

Image for post
Image for post From the original on medium.com
Sarmad Hassan (Juba Baghdad)
Sarmad Hassan (Juba Baghdad)

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

What happened, in plain words

Facebook Groups have a feature called Units. A unit is a way for a group to organise its posts like a small online course: the group admin creates a unit with a name and a description, and then attaches posts to it. The researcher links to a Facebook post by Marismith that describes Units as "another new Facebook feature you can add units to Facebook groups". Only an admin of a group can create, edit or delete a unit, and only an admin can add a post to a unit.

The bug is in the part of Facebook's website that creates a unit together with a post. When you fill in the form and click the button, your browser sends a request to Facebook's server. That request contains two identifiers: group_id (which group the unit belongs to) and post_id (which post is being attached). The researcher found that the server trusted the post_id value without checking that the post actually belongs to that group. By changing post_id to a post from a different group, he could attach someone else's post to a unit in his own group, and the effect showed up in the other group: the post was distorted or became impossible to delete.

This is a broken authorisation bug: the server checks that you are logged in and that your request is genuine, but it does not check that you are allowed to act on the specific post you named. It is also a logic flaw, because the feature works as designed for normal use, but the design did not consider what happens when the two identifiers point at different groups.

Setting up

The researcher used three groups:

  • An attacker group (his own test group), where he was admin and where Units were enabled.
  • A victim group, used for the first test.
  • A second victim group, called the noobs group, used to check that the bug worked on a different type of group.

He created a Live video post in his test group and used a tool called Burpsuite to intercept the request. Burpsuite is a proxy: it sits between your browser and the website, so you can pause a request, read it, change it, and then send it on. The report does not give the Facebook app version, browser or any other environment detail.

Finding it

The researcher was testing the Live Video option in a Facebook group, which he had not tested before. He created a live video in his test group and spent some time on the feature without finding anything. He then tried to delete the live video post by clicking the three dots on the post, and noticed an option called Units in the post menu.

Image for post
Unit option will appear in the post option, if you enabled units in the group From the original on medium.com

The screenshot shows the post options menu with the Units entry, which appears when units are enabled in the group. He had tested the Units option before without finding anything interesting, but decided to try it again from this place. He clicked Add to new unit and got a dialog for creating a unit.

Image for post
when you create new unit this window will pop up, fill the details and create new one From the original on medium.com

He filled the details randomly and intercepted the request with Burpsuite.

Exploitation

Step 1: capture the unit creation request

The intercepted request looked like this:

HTTP
POST /groups/learning/create_with_post/?group_id=[My_Test_Group_ID]&post_id=[My_Post_ID]&dpr=1 HTTP/1.1

jazoest=[number]&fb_dtsg=[anti_csrft ]&unit name=bla&unit description=bla&post title=bla

Line by line:

  • POST /groups/learning/create_with_post/ is the address on Facebook's server that the browser is calling. POST means "send data to the server to create something". The path /groups/learning/create_with_post/ is the name of the action: create a unit together with a post.
  • ?group_id=[My_Test_Group_ID]&post_id=[My_Post_ID]&dpr=1 is the query string, the part of the URL after the question mark. It carries three values separated by &. group_id is the identifier of the group the unit is being created in. post_id is the identifier of the post being attached. dpr is a display-related value that the report does not explain.
  • The blank line separates the request headers from the request body.
  • jazoest=[number]&fb_dtsg=[anti_csrft ]&unit name=bla&unit description=bla&post title=bla is the body, the data sent with the request. jazoest and fb_dtsg are anti-CSRF values: they are tokens that Facebook puts into the page so the server can tell that the request came from a real Facebook page and not from a malicious site. unit name, unit description and post title are the fields the researcher filled in the dialog.

Two parameters caught his attention: group_id and post_id. They are object references: they tell the server which existing thing (a group, a post) the action applies to. Whenever a request contains an identifier like this, it is worth asking whether the server checks that you are allowed to use that particular identifier.

He formulated two questions:

  1. What happens if group_id is changed to another group's id (the victim group)? Can a new unit be created in the other group and his own live video post be added to it?
  2. What happens if post_id is changed to a post id from another group (the victim group)? Can posts from another group be added to his unit in his own test group?

Step 2: change group_id

He changed the group_id value to the victim group's id. This did not work. That is a useful result: the attempt to create a unit in the other group did not work.

Step 3: change post_id

He then changed the post_id value to a post id from the victim group. The response was:

HTTP
HTTP/1.1 200 OK

 for (;;);{"__ar":1,"payload":null,"jsmods":{"require":[["ServerRedirect","redirectPageTo",[],["\/groups\/[attacker_group_id]\/learning_content\/?filter=filter number&post=[victim_post_id]",false,false]]]},"js":["IO8eo","EizOb"],"bootloadable":{},"resource_map":{"IO8eo":{"type":"js","src":"https:\/\/static.xx.fbcdn.net\/rsrc.php\/v3ioAY4\/yo\/l\/en_US\/rcyi0X4VRXd.js","crossOrigin":1},"EizOb":{"type":"js","src":"https:\/\/static.xx.fbcdn.net\/rsrc.php\/v3i6Hv4\/yd\/l\/en_US\/si3hiFNne1g.js","crossOrigin":1}},"ixData":{},"gkxData":{},"lid":"lid number"}

Line by line:

  • HTTP/1.1 200 OK is the status line. 200 means the server accepted the request and processed it successfully. This is the first sign that the request was not rejected.
  • for (;;); at the start of the body is a small guard that Facebook puts in front of JSON responses. It stops a malicious page from reading the response as ordinary JavaScript. It is not part of the data.
  • {"__ar":1,...} is a JSON object, a way of writing structured data as text.
  • "payload":null means there is no extra data payload in this response.
  • "jsmods":{"require":[["ServerRedirect","redirectPageTo",[],["\/groups\/[attacker_group_id]\/learning_content\/?filter=filter number&post=[victim_post_id]",false,false]]]} is the interesting part. jsmods tells the browser which JavaScript modules to load. Here it asks for ServerRedirect, which means "send the browser to another page". The target is \/groups\/[attacker_group_id]\/learning_content\/?filter=filter number&post=[victim_post_id]: the learning content page of the attacker's group, with the victim's post id in the post parameter. The server has accepted a post from another group and linked it to the attacker's unit.
  • "js":["IO8eo","EizOb"] lists two JavaScript resources to load, and "resource_map" gives their addresses on static.xx.fbcdn.net. These are ordinary page scripts; they are not the bug.

The response is a 200 with a ServerRedirect instruction pointing at the attacker's group's learning content page, with the victim's post id in the post parameter. The request was accepted even though the post belonged to another group.

Step 4: check the victim group

He switched to the victim group account and checked the post.

Image for post
Attachment Unavailable appears when the attacker added “text post only” from victim group to his unit From the original on medium.com

The post in the victim group now showed Attachment Unavailable. The researcher describes this as distorting a post: only text posts were affected, and the post was made to look like the broken form in the screenshot. In plain terms, the post showed an Attachment Unavailable placeholder instead of its normal appearance.

Step 5: reproduce on a second victim group

To confirm the bug worked on all types of groups, he repeated it against another victim group, the noobs group. He took the request from his own group as an attacker and replaced post_id with the id of a post in the noobs group. The post was his own, but it was in a group where he was not an admin. The response was again 200 OK and everything worked.

When he checked the post in the noobs group, he saw this:

Image for post
Delete me if you can was the title of attacker unit in his group, and it appears above the post in victim group From the original on medium.com

The title of his unit, Delete me if you can, appeared above the post in the victim group. In this second test the post was not distorted with Attachment Unavailable; instead the unit title was placed above any post, and the post became undeletable by its owner and by the group admin. That is the more serious effect: the owner of the post and the admin of the group both lost the ability to remove it.

Root cause

The endpoint POST /groups/learning/create_with_post/ takes both group_id and post_id from the request and does not verify that the post belongs to the group the unit is being created in, or that the caller has any rights over the post's group. Changing group_id to the victim group failed, but the post_id is not checked against the group. The anti-CSRF values (jazoest, fb_dtsg) are present in the request; the flaw is authorisation on the referenced object.

In everyday terms: the bouncer at the door checks your ticket is real, but nobody checks that the seat number on it is actually yours. You can walk in with a valid ticket and sit in someone else's seat.

Impact

The researcher lists two impacts:

  1. An attacker can distort only text posts in a victim group, for any member (admin, moderator or normal user), if the owner of the post is not a member of the attacker's group.
  2. An attacker can make any post (photo, video, events and so on) in a victim group undeletable for any member (admin, moderator or normal user), and can put the title of his unit above the victim's post, by inviting the owner of the post to his group (attacker group).

The second impact therefore depends on the post owner joining the attacker's group.

Fix

The report gives a timeline rather than a description of the code change:

Date Event
June 18, 2018 Initial report
June 20, 2018 Report triaged
July 31, 2018 Bug fixed
July 31, 2018 Fix confirmed
August 2, 2018 Bounty awarded
Image for post
Image for post From the original on medium.com

The fix that would address the root cause is to validate on the server that the post_id belongs to the group identified by group_id, and that the caller is an admin of that group, before creating the unit and attaching the post.

Coincidence

After submitting the bug, the researcher remembered reading about undeletable posts on Facebook before. A search led him to a video by another researcher, published on May 9, 2018, showing the same bug from a different endpoint.

He contacted Richard Telleng, the researcher who had found it first. Telleng told him the bug had been fixed and that Facebook had already rewarded him a bounty for it. The researcher informed the Facebook Security Team about the whole story and thanks Telleng for his honesty and support.

Variants to test

  • Other object-reference parameters. Look for endpoints that take both a container id and a child object id (for example group_id and post_id, album_id and photo_id, page_id and post_id). Change only the child id to an object from another container you do not control. A positive result is a 200 response that references your container with the foreign object id, and a visible change on the foreign object.
  • Swap the container id instead. Change only the container id to a group or page you do not administer. A positive result is a unit or item created in the other container. In this report that attempt failed.
  • Cross-role checks. Repeat the test as a normal member, a moderator and an admin of the victim group, and as a non-member. A positive result is the same distortion or undeletable state for a role that should have no rights over the object.
  • Membership precondition. Test whether the impact depends on the post owner being a member of the attacker's container, as it did here. A positive result is that the effect appears only after the owner joins, which points at a membership-based authorisation check rather than an ownership check.
  • Different post types. Try text, photo, video and event posts. A positive result is that text posts are distorted and other types become undeletable, matching the two impacts described here.

Takeaways

The researcher closes with three points: test an option from different areas, because there is a chance of finding something interesting in it; if you find that another researcher reported the same bug, contact them and be honest about whether it is fixed; and be honest with the security team as well.

Image for post
Image for post From the original on medium.com
Sarmad Hassan (Juba Baghdad)
Sarmad Hassan (Juba Baghdad)

Glossary

  • API: a way for one piece of software to talk to another by sending structured requests and receiving structured responses. Here, the browser sends a request to Facebook's server and gets JSON back.
  • Authorisation: the check that a logged-in user is allowed to perform a specific action on a specific object. Broken authorisation means that check is missing or wrong.
  • Body: the part of an HTTP request that carries data, after the headers and a blank line.
  • Broken authorisation: a vulnerability where the server does not verify that the user has permission to act on the object named in the request.
  • Burpsuite: a proxy tool that sits between a browser and a website so you can pause, read and modify requests.
  • CSRF: cross-site request forgery, an attack where a malicious site makes your browser send a request to another site using your logged-in session. Anti-CSRF tokens are values added to requests to prevent this.
  • CVSS: a standard scoring system for the severity of a vulnerability.
  • Endpoint: the address and action on a server that a request targets, such as POST /groups/learning/create_with_post/.
  • fb_dtsg: a Facebook anti-CSRF token sent with requests.
  • Group admin: the person who manages a Facebook group and can create, edit and delete its content.
  • HTTP: the protocol browsers and servers use to exchange requests and responses.
  • Identifier (id): a number or string that uniquely names an object, such as a group or a post.
  • jazoest: a Facebook anti-CSRF value sent with requests.
  • JSON: a text format for structured data, using curly braces, keys and values.
  • Live Video: a Facebook feature for broadcasting video in real time.
  • Logic flaw: a bug where the feature works as designed but the design misses a case, such as two identifiers pointing at different groups.
  • Moderator: a group member with some admin rights, below full admin.
  • Object reference: an identifier in a request that points at an existing object on the server.
  • POST: an HTTP method used to send data to the server, usually to create or change something.
  • Query string: the part of a URL after ?, made of key=value pairs separated by &.
  • Request: the message a browser sends to a server asking it to do something.
  • Response: the message a server sends back to the browser.
  • Status code: a number in the response that says what happened, such as 200 for success.
  • Token: a value generated by the server and sent with a request to prove something, such as that the request came from a real page.
  • Units: a Facebook Groups feature that lets a group organise posts like an online course, with a name and description per unit.
  • Vulnerability class: the category a bug belongs to, such as broken authorisation or logic flaw.

More by Sarmad Hassan

View all

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

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.