Send messages through notification to facebook & workplace users without getting blocked
The 'operator_ids' parameter in the Safety Check feature was vulnerable to an IDOR, allowing an attacker to add any Facebook or Workplace user as a safety operator. This let the attacker send notifications with a custom message to arbitrary users, who could not block the sender.
Published on blog.flawminers.com
In Facebook workplace, there is an option called “Safety Check” where admins of workplace can add their users as “Safety operator” which lets you report your status during a crisis, for more details about “Safety Check” see this link https://web.facebook.com/workplace/features/safety-check?rdc=1&rdr
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.
Context
Facebook Workplace is the enterprise version of Facebook. Among its features is "Safety Check", which lets workplace administrators designate users as "Safety operators". A safety operator can report their status during a crisis, and the feature is described on Facebook's own Workplace page for Safety Check.
The functionality that processes the "add users" request for safety operators is where the problem sits. The request carries an operator_ids parameter, and that parameter is susceptible to an IDOR. The result is an Insecure Direct Object Reference (IDOR): an administrator can put any user ID into the array, including IDs belonging to people outside their company's Workplace and IDs belonging to ordinary users on the main facebook.com site.
Because adding a safety operator triggers a notification, the flaw doubles as a messaging primitive. The attacker can send a message to any user through the notification mechanism, and the recipient cannot block the sender in the Facebook domain, since the sender operates from the Workplace domain.
Setup
The researcher used a Workplace account with administrative access. The reproduction starts by logging in at:
https://workplace.facebook.com/
From the admin panel, the researcher reached the people management screen, either through "Admin panel" then "People", or directly via this URL:
https://workplace.facebook.com/work/admin/employees_manager/?filters[accountStatus][operator]=enumSetIs&filters[accountStatus][values][0][value]=invited&filters[accountStatus][values][1][value]=awaitingInvitation&filters[accountStatus][values][2][value]=claimed
The interception tool was Burp Suite. The attacker's own user ID in the captured request was 100028780260452, and the victim used in the demonstration was the researcher himself, Sarmad Hassan, with user ID 100015771374169.
Finding it
The researcher was looking at the request that Workplace sends when an administrator adds a safety operator. The request is a GraphQL POST to /api/graphql/, and the relevant part of the body is the variables JSON, which contains an operator_ids array. The array holds the IDs of the users to be added as safety operators.
The array is the interesting part. It is client supplied, and nothing in the request ties its contents to the administrator's own organisation. The array is client supplied, and the flaw lets an attacker include any user ID in it, not just IDs from the administrator's Workplace.
Exploitation
Step 1: Log in to Workplace
The attacker navigates to https://workplace.facebook.com/ and logs into their account.
Step 2: Open the people management screen
In the admin panel, the attacker goes to "Admin panel" then "People", or uses the direct URL shown above. This is where user details can be edited.
Step 3: Plant the message in a user's name
The attacker selects "More options" then "Edit Personal Details" and opens the name tab. In the name field the attacker inserts the message intended for other users. In this case the message was:
You got pwned by JubaBaghdad ;)
The attacker then chooses "Save Changes" and confirms. The message is now stored as part of the user's details, ready to be delivered through the notification that adding a safety operator produces.
Step 4: Start adding a safety operator and intercept the request
The attacker navigates to the safety check section:
https://workplace.facebook.com/work/admin/safety_check/
There they choose to add a safety operator, pick any user from their own company, and intercept the resulting request with Burp Suite before letting it complete.
Step 5: Inspect the captured request
The captured POST request looks like this:
POST /api/graphql/ HTTP/1.1
Host: workplace.facebook.com
...other parameters...
variables={"input":{"client_mutation_id":"1563396993285:2071896173","actor_id":"100028780260452","operator_ids":["100028780260452"]}}
doc_id=2211145648957994
The vulnerable part is the operator_ids array:
operator_ids":["100028780260452"]
It contains the attacker's own user ID, because the attacker selected a user from their own company.
Step 6: Swap in the victim's ID
The attacker changes the value inside operator_ids from their own ID to the victim's ID. In this case the victim is Sarmad Hassan, ID 100015771374169. The modified request contains:
operator_ids":["100015771374169"]
Step 7: Forward the request and observe the notification
Once the altered request is forwarded, the server accepts it. The victim, user ID 100015771374169, receives a notification from the attacker containing the message planted in step 3:
You got pwned by JubaBaghdad ;)
From the victim's side, the notification arrives and there is no way to stop it or to block the attacker within the Facebook domain. Blocking is ineffective because the attacker is operating from the Workplace domain rather than from Facebook itself.
Root cause
The operator_ids array is susceptible to an IDOR, so an attacker can include any user ID, including users outside their company's Workplace. Any user ID, including one from facebook.com outside the company, is accepted as a safety operator. Because adding a safety operator generates a notification, the missing authorisation check turns into an arbitrary messaging channel.
The array format makes this worse. Since operator_ids is a JSON array, the attacker can put many IDs into a single request rather than one at a time. The report does not describe any server-side limit on the number of entries.
Impact
An attacker with administrative access to a Workplace account can add any user as a safety operator, including users outside their company and users of the main Facebook site. Each addition delivers a notification carrying whatever text the attacker placed in their own profile name, so the attacker can send messages to arbitrary users without being blocked, because the sender sits in the Workplace domain and the recipient's blocking controls in the Facebook domain do not apply.
Because operator_ids is an array, the attacker can include hundreds or even millions of user IDs in one request, so a single request can broadcast a message to a large audience. The notifications can also be used for social engineering, since recipients may engage with content presented through them. The report does not give a measured scale for how many IDs a request actually accepted.
Fix
The timeline shows the issue was triaged on 18 July 2019, resolved on 4 August 2019, the fix confirmed by the researcher on 6 August 2019, and a bounty awarded on 15 August 2019.
Variants to test
- Other array parameters in GraphQL mutations. Look for mutations that take an array of user IDs, such as members, assignees or recipients, and try replacing one ID with an account from another organisation. A positive result is the server accepting the foreign ID and the target receiving a notification or gaining the role.
- Single-ID parameters with the same pattern. Try the same swap on scalar ID fields in similar admin features. A positive result is the action succeeding for a user outside the caller's organisation.
- Bulk arrays. Send an array with many IDs at once and observe whether the server processes all of them. A positive result is multiple recipients receiving the notification from one request.
- Cross-domain IDs. Where a product has an enterprise and a consumer side, try IDs from the consumer side in enterprise admin requests. A positive result is the consumer account being affected by an enterprise action.
What happened, in plain words
Facebook Workplace is the version of Facebook that companies use for their staff. It looks a lot like normal Facebook, but it belongs to an organisation: your employer creates a Workplace, invites its employees, and an administrator manages who is in it.
One of Workplace's features is called "Safety Check". During a crisis, a company can use it to let people report their status. To make this work, an administrator can pick certain users and give them a special role: "Safety operator". A safety operator is someone who can report their status during a crisis. Facebook describes the feature on its own Workplace page for Safety Check.
The researcher found that the part of Workplace that handles "add this person as a safety operator" does not check who the person being added actually is. The request that the browser sends contains a list of user IDs, and an attacker can put any ID in that list, even IDs of people who have nothing to do with the administrator's company, including ordinary users of the main facebook.com site.
This kind of mistake has a name: Insecure Direct Object Reference, or IDOR. The idea is simple. Imagine a hotel where every room key is just a number written on a card, and the front desk never checks that the number on your card matches the room you booked. If you change the number, you get into someone else's room. In a web application, the "number" is usually an ID, and an IDOR happens when the server takes an ID from the user and acts on it without checking that the user is allowed to touch that particular object.
Why does this matter so much here? Because adding a safety operator causes Workplace to send that person a notification. A notification is the little alert that appears in the bell icon or on your phone. The attacker can put a message into their own profile name first, and the victim then receives a notification containing that message. So the flaw turns into a way to send a message to any Facebook user, and the recipient cannot block the sender: the sender is acting from the Workplace domain, while the recipient's blocking controls live in the Facebook domain.
Below I walk through the whole thing from zero: what each piece is, why each step was taken, and what the captured request means line by line.
The pieces you need to know
Before the steps, a few everyday concepts. None of them require any security background.
- A web request. When you click a button on a website, your browser sends a message to a server and the server sends one back. Think of it as posting a letter with a form inside: the form says what you want done, and the reply says whether it worked.
- An API. An API is the part of a website that accepts these requests directly, without a human clicking. It is like a restaurant's kitchen window: the menu is the website you see, but the kitchen window is where orders actually go in. Workplace's admin screens talk to an API behind the scenes.
- GraphQL. GraphQL is a style of API where the browser sends one request describing exactly what it wants, in a structured text format. The request names an operation (called a mutation when it changes something) and passes values in a block called
variables. You do not need to write GraphQL to follow this; just know thatvariablesis where the interesting values travel. - A user ID. Every Facebook and Workplace account has a long number that identifies it. It is not secret in the way a password is, but it is what the server uses to know which account you mean.
- An array. An array is just a list. In the request below, the list is written with square brackets, like
["100028780260452"]. A list can hold one item or many. - Burp Suite. Burp Suite is a tool that sits between your browser and the server. It lets you pause a request before it is sent, look at it, change it, and then send it on. Think of a mailroom where you can open the envelope, swap the letter inside, and seal it again before it goes out.
- IDOR. As above: the server accepts an ID from the user and acts on it without checking permission. The fix is always the same idea: check, on the server, that this user is allowed to touch this object.
Setup
The researcher used a Workplace account that had administrative access, because only an administrator can manage safety operators. The reproduction starts by logging in at:
https://workplace.facebook.com/
That is the normal Workplace login page. Logging in gives the browser a session, which is how the server remembers who you are between requests. You can think of the session as a wristband you get at an event: you show it at every door instead of showing your ticket again.
From the admin panel, the researcher reached the people management screen. There are two ways: click "Admin panel" and then "People", or go straight to this URL:
https://workplace.facebook.com/work/admin/employees_manager/?filters[accountStatus][operator]=enumSetIs&filters[accountStatus][values][0][value]=invited&filters[accountStatus][values][1][value]=awaitingInvitation&filters[accountStatus][values][2][value]=claimed
This long URL is just the people screen with filters applied. Everything after the ? is a set of filters that tell the page which users to show: those who are invited, those awaiting an invitation, and those who have claimed their account.
The interception tool was Burp Suite. The attacker's own user ID in the captured request was 100028780260452, and the victim used in the demonstration was the researcher himself, Sarmad Hassan, with user ID 100015771374169.
Finding it
The researcher was looking at the request that Workplace sends when an administrator adds a safety operator. The request is a GraphQL POST to /api/graphql/, and the relevant part of the body is the variables JSON, which contains an operator_ids array. The array holds the IDs of the users to be added as safety operators.
The array is the interesting part. It is supplied by the browser, and nothing in the request ties its contents to the administrator's own organisation. That suggested the server would accept any user ID placed in it, not just IDs from the administrator's Workplace.
Exploitation
Step 1: Log in to Workplace
The attacker navigates to https://workplace.facebook.com/ and logs into their account. This step is needed because every later request must carry the administrator's session; without it, the server would not know who is asking.
Step 2: Open the people management screen
In the admin panel, the attacker goes to "Admin panel" then "People", or uses the direct URL shown above. This is where user details can be edited.
Step 3: Plant the message in a user's name
The attacker selects "More options" then "Edit Personal Details" and opens the name tab. In the name field the attacker inserts the message intended for other users. In this case the message was:
You got pwned by JubaBaghdad ;)
The attacker then chooses "Save Changes" and confirms. The message is now stored as part of the user's details, ready to be delivered through the notification that adding a safety operator produces.
Why do this? So the name field becomes the delivery slot for the message. It is a bit like writing your message on the outside of an envelope instead of inside it: the postal service only reads the outside.
Step 4: Start adding a safety operator and intercept the request
The attacker navigates to the safety check section:
https://workplace.facebook.com/work/admin/safety_check/
There they choose to add a safety operator, pick any user from their own company, and intercept the resulting request with Burp Suite before letting it complete.
Why pick a user from their own company first? Because that is a normal, allowed action. The attacker wants the browser to build a valid request, so they can look at its shape and then change one value. Intercepting means Burp Suite pauses the request on its way out, so the attacker can edit it before the server ever sees it.
Step 5: Inspect the captured request
The captured POST request looks like this:
POST /api/graphql/ HTTP/1.1
Host: workplace.facebook.com
...other parameters...
variables={"input":{"client_mutation_id":"1563396993285:2071896173","actor_id":"100028780260452","operator_ids":["100028780260452"]}}
doc_id=2211145648957994
Line by line:
POST /api/graphql/ HTTP/1.1says the browser is sending data (POST) to the address/api/graphql/on the server, using version 1.1 of the HTTP protocol, which is the language browsers and servers speak.Host: workplace.facebook.comsays which website the request is for. One server can host many sites, so the host name tells it which one....other parameters...is a placeholder for the rest of the request, which the report does not show. It is there to say: this is only the interesting part.variables={...}is the block of values for the GraphQL operation. Inside it,inputgroups the values for this action.client_mutation_idis an identifier the browser makes up for this particular action, so the server can tell one attempt from another.actor_idis the ID of the account performing the action, here the attacker's own ID,100028780260452.operator_idsis the list of users to be added as safety operators, and here it contains one entry, the attacker's own ID.doc_id=2211145648957994identifies which GraphQL operation is being called. Facebook's GraphQL API uses these document IDs to name operations instead of sending the full query text each time.
The vulnerable part is the operator_ids array:
operator_ids":["100028780260452"]
It contains the attacker's own user ID, because the attacker selected a user from their own company. The actor_id is also the attacker's ID, and doc_id identifies the GraphQL mutation being called. The key observation is that the list is just data sent by the browser. If the server does not check each entry against the administrator's organisation, then the list can contain anything.
Step 6: Swap in the victim's ID
The attacker changes the value inside operator_ids from their own ID to the victim's ID. In this case the victim is Sarmad Hassan, ID 100015771374169. The modified request contains:
operator_ids":["100015771374169"]
This is the whole attack: one number replaced with another. The attacker is not breaking any encryption or guessing a password. They are simply editing a value that the server should have checked and did not.
Step 7: Forward the request and observe the notification
Once the altered request is forwarded, the server accepts it. The victim, user ID 100015771374169, receives a notification from the attacker containing the message planted in step 3:
You got pwned by JubaBaghdad ;)
From the victim's side, the notification arrives and there is no way to stop it or to block the attacker within the Facebook domain. Blocking is ineffective because the attacker is operating from the Workplace domain rather than from Facebook itself. Blocking is ineffective because the attacker operates within the Workplace domain, making traditional measures ineffective.
Root cause
The operator_ids array is susceptible to an IDOR, so an attacker can include any user ID, including users outside their company's Workplace. Any user ID, including one from facebook.com outside the company, is accepted as a safety operator. Because adding a safety operator generates a notification, the missing authorisation check turns into an arbitrary messaging channel.
The array format makes this worse. Since operator_ids is a JSON array, the attacker can put many IDs into a single request rather than one at a time. The report does not describe any server-side limit on the number of entries.
Impact
An attacker with administrative access to a Workplace account can add any user as a safety operator, including users outside their company and users of the main Facebook site. Each addition delivers a notification carrying whatever text the attacker placed in their own profile name, so the attacker can send messages to arbitrary users without being blocked, because the sender sits in the Workplace domain and the recipient's blocking controls in the Facebook domain do not apply.
Because operator_ids is an array, the attacker can include hundreds or even millions of user IDs in one request, so a single request can broadcast a message to a large audience. The notifications can also be used for social engineering, since recipients may engage with content presented through them. Social engineering means tricking people into doing something, such as clicking a link or trusting a message, by making it look legitimate.
Fix
The timeline shows the issue was triaged on 18 July 2019, resolved on 4 August 2019, the fix confirmed by the researcher on 6 August 2019, and a bounty awarded on 15 August 2019. Triaged means the security team looked at the report and accepted it as a real issue.
Variants to test
The same idea can be tried in other places. These are starting points for further testing, not confirmed findings.
- Other array parameters in GraphQL mutations. Look for mutations that take an array of user IDs, such as members, assignees or recipients, and try replacing one ID with an account from another organisation. A positive result is the server accepting the foreign ID and the target receiving a notification or gaining the role.
- Single-ID parameters with the same pattern. Try the same swap on scalar ID fields in similar admin features. A scalar is a single value rather than a list. A positive result is the action succeeding for a user outside the caller's organisation.
- Bulk arrays. Send an array with many IDs at once and observe whether the server processes all of them. A positive result is multiple recipients receiving the notification from one request.
- Cross-domain IDs. Where a product has an enterprise and a consumer side, try IDs from the consumer side in enterprise admin requests. A positive result is the consumer account being affected by an enterprise action.
Glossary
- API: the part of a website that accepts requests directly, so software can ask it to do things without a person clicking.
- Array: a list of values, written with square brackets, such as
["100028780260452"]. - Burp Suite: a tool that sits between your browser and a server, letting you pause, inspect and change requests before they are sent.
- Client: the browser or app on your side, as opposed to the server.
- Client-supplied: a value that comes from the browser, which means the user can change it.
client_mutation_id: an identifier the browser makes up for one particular action, so the server can tell attempts apart.doc_id: a number that names which GraphQL operation is being called.- Domain: the part of a web address after the
//, such asfacebook.comorworkplace.facebook.com, which identifies the site. - GraphQL: a style of API where the browser sends one structured request describing exactly what it wants.
- HTTP: the language browsers and servers use to exchange requests and replies.
- IDOR (Insecure Direct Object Reference): a flaw where the server takes an ID from the user and acts on it without checking that the user is allowed to touch that object.
- JSON: a text format for structured data, using curly braces for objects and square brackets for lists.
- Mutation: in GraphQL, an operation that changes something, as opposed to one that only reads.
- Notification: an alert shown to a user in the bell icon or on their phone.
operator_ids: the list of user IDs to be added as safety operators in the captured request.- POST: an HTTP method used when the browser sends data to the server.
- Safety Check: a Workplace feature for reporting your status during a crisis.
- Safety operator: a user given the role of reporting their status during a crisis in Safety Check.
- Scalar: a single value, as opposed to a list.
- Server: the computer that receives requests and decides what to do with them.
- Session: the server's way of remembering who you are between requests, usually via a value stored by the browser.
- Social engineering: tricking people into trusting or acting on something by making it look legitimate.
- Triaged: reviewed by a security team and accepted as a real issue.
- User ID: the long number that identifies an account.
variables: the block in a GraphQL request that carries the values for the operation.- Workplace: Facebook's version of Facebook for companies, used by staff inside an organisation.