(POC) Remove any Facebook’s live video ($14,000 bounty)
A GraphQL mutation for trimming live videos lacked proper authorisation checks, allowing any user to trim or untrim any live video. An attacker could reduce a video to zero seconds, making it impossible for the owner to restore it.
Published on edmundaa222.medium.com
Ahmad Talahmeh
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 live videos can be edited after the fact with a feature called video trimming, which lets a user remove unwanted content from the start or end of a live video. In normal use only the owner of the video can perform this action on their own behalf. The report examines the GraphQL mutation behind that feature and shows that the ownership check could be bypassed, allowing any user to trim, and then untrim, any live video on the platform.
Setup
The write-up does not describe any special accounts, roles, tools or software versions. The only preconditions stated are the two identifiers needed for the request: the target live video ID and the current (attacker) user ID. The requests in the report go to Facebook's GraphQL endpoint at /api/graphql/.
Finding it
The researcher observed that the trimming feature is meant to be restricted to the video owner, but testing showed it was possible to trim any live video on behalf of its owner, which is not the expected behaviour. The request that performs the trim carries both a video_id and an actor_id, and the researcher found that supplying someone else's video together with the attacker's own actor ID was accepted by the backend.
Exploitation
Step 1: Obtain the target live video ID
The attacker needs the ID of the live video they want to modify. This becomes video_id in the requests below.
Step 2: Obtain the current user ID
The attacker needs their own user ID, which becomes actor_id. This is the identity the mutation is performed under.
Step 3: Copy the trim request
The trim is a GraphQL POST to the following endpoint, with the variables shown:
The friendly name in the full URL identifies the operation as LiveProducerLiveVideoTrimMutation. The input object sets the start of the retained range with start_time_ms and the end with end_time_ms, both in milliseconds, and names the target video and the acting user through video_id and actor_id. client_mutation_id is a client-side identifier for the mutation.
Step 4: Change end_time_ms
The end_time_ms field is set to the time in milliseconds at which the video should end. One second is 1000 ms, so 10000 ms is 10 seconds. If the video is 5 minutes long, setting this value makes the resulting video 10 seconds long.
Step 5: Submit the request
The response came back as an error:
{
“errors”:
{
…
“code”: 1675030,
…
}
The response returned error #1675030, but the trim was done anyway.
Step 6: Remove the video content
Updating end_time_ms again, this time to 1, removes the video content:
end_time_ms:1
After this the owner becomes unable to restore the original video, and the original video duration becomes 0 seconds long. The researcher notes that trimming to 5 milliseconds makes the video 0 seconds long and the owner cannot untrim it.
Step 7: Untrim the video as the attacker
The untrim operation is a separate GraphQL mutation, submitted as follows:
The friendly name in the full URL identifies this operation as LiveProducerLiveVideoUntrimMutation. It takes the same video_id and actor_id pair and a client_mutation_id.
The response again reported an error:
{
“errors”:
{
…
“code”: 1675030,
…
}
The response returned error #1675030, but the untrim was done. The researcher notes that this results in a privacy issue.
Root cause
The report does not describe the server-side code. What the requests show is that the trim and untrim mutations accept a video_id and an actor_id supplied by the client, and that the backend acted on a video belonging to another user when the actor was the attacker. The ownership check that should tie the acting user to the video was therefore missing or ineffective. The error code #1675030 returned in both responses did not prevent the operation from taking effect, so the error path did not act as a safeguard either.
Impact
Anyone can trim or untrim any live video on Facebook. Trimming a video to 5 milliseconds makes it 0 seconds long, and the owner is then unable to untrim it, so the original content is lost to the owner. The researcher also flags the untrim action as a privacy issue, since an attacker can alter the state of another user's video. The report does not go into further consequences beyond these.
Fix
The timeline lists a patch confirmed by Facebook on 28/09/2020, three days after the report was sent on 25/09/2020.
Variants to test
- Apply the same pattern to other GraphQL mutations that take both an object ID and an
actor_id: send the victim's object ID with your own actor ID and check whether the operation succeeds despite an error response. - Test the untrim or restore counterpart of any destructive editing feature, since the report shows both directions were affected.
- Watch for mutations that return an error code but still change state: compare the object before and after the request rather than trusting the response.
- Try boundary values for time fields such as
end_time_msset to1, and check whether the owner can recover the original content afterwards.
Timeline
| Date | Event |
|---|---|
| 25/09/2020 | Report sent |
| 25/09/2020 | Triaged by Facebook after 2 hours |
| 28/09/2020 | Patch confirmed by Facebook |
| 10/10/2020 | $11,000 bounty awarded during BountyCon 2020 (with bonus) |
| 12/10/2020 | Additional $1150 bounty awarded by Facebook (with bonus) |
| 12/10/2020 | Additional $2300 bounty awarded by Facebook (with bonus) |
What happened, in plain words
Facebook lets people broadcast live video. After a broadcast ends, the person who owns the video can use a feature called video trimming to cut unwanted parts off the beginning or the end, a bit like trimming the edges of a home movie so only the good part is left. In normal use, only the owner of the video is allowed to do this to their own video.
A security researcher, Ahmad Talahmeh, tested the part of Facebook's systems that carries out that trimming. He found that the check which is supposed to confirm "are you the owner of this video?" could be bypassed. By sending a request that named someone else's video but his own user identity, he was able to trim any live video on the platform, and then untrim it again. Trimming a video down to almost nothing made it zero seconds long, and the owner could no longer restore the original. Facebook paid a bounty for the report.

The image above is the header of the write-up as it was published, showing the title and the author's name.
Background you need first
Before walking through the steps, here are the ideas the report relies on, explained from scratch.
- An API is the way one piece of software talks to another. Think of a restaurant: you do not walk into the kitchen, you tell the waiter what you want and the waiter brings it back. Your browser is the customer, Facebook's servers are the kitchen, and the API is the waiter that carries requests and responses. Facebook's web pages use an API behind the scenes to load and change things.
- GraphQL is a particular style of API. Instead of many separate addresses for many separate actions, there is usually one address, and each request says which named operation it wants and what data to use. The named operations here are called mutations, which is GraphQL's word for an operation that changes something (as opposed to just reading it).
- A request is the message your browser sends to a server. It has an address (the URL), a method (such as POST, meaning "here is some data for you"), and a body (the data itself).
- An identifier (ID) is a unique label for a thing. Every live video has a video ID, and every user account has a user ID. They are like a ticket number: they let the server know exactly which video or which person you mean.
actor_idis the field in these requests that says who is performing the action. In plain terms: "act as this user".- Milliseconds (ms) are thousandths of a second. 1000 ms is one second, 10000 ms is ten seconds, and 1 ms is one thousandth of a second, effectively nothing.
- A logic flaw is a bug where the software does exactly what it was programmed to do, but the rules it enforces are wrong or incomplete. Nothing crashes; the wrong person is simply allowed to do something they should not be allowed to do. The everyday comparison is a hotel key card that opens your own room and, because of a mistake in how the locks were configured, also opens every other room.
- An ownership check is the rule that says "only the person who owns this thing may change it". The whole report is about that check failing.
The setup
The write-up does not mention any special accounts, tools or software versions. The only things needed before starting are the two identifiers mentioned above: the ID of the live video you want to affect, and your own user ID. The requests in the report go to Facebook's GraphQL address, /api/graphql/.
Finding the problem
The researcher knew that trimming is supposed to be limited to the video's owner. When he tested it, he found he could trim any live video on behalf of its owner, which is not the expected behaviour.
The key observation is in the request that performs a trim: it carries both a video_id (which video) and an actor_id (who is acting). He found that the backend accepted a video belonging to someone else together with the attacker's own actor ID. In other words, the server acted on a video belonging to someone else when the actor was the attacker.
Exploitation, step by step
Step 1: Obtain the target live video ID
You need the ID of the live video you want to modify. This value will be placed in the video_id field of the requests below. The reason for this step is simple: the server needs to know which video to act on, and the ID is how you tell it.
Step 2: Obtain the current user ID
You need your own user ID. This becomes the actor_id, the identity the action is performed under. The reason for this step is that the request asks the server to act as a particular user; supplying your own ID is what makes the request "yours".
Step 3: Copy the trim request
The trim is sent as a GraphQL POST to the following address, with the data shown:
Line by line, in plain words:
POSTis the method: we are sending data to the server, not just asking to read a page./api/graphql/is the address of Facebook's GraphQL API, the "waiter" described earlier.__a=1is a parameter in the address. The report does not explain what it does; it is simply part of the copied request.doc_id=3975916122480615is an identifier for the specific operation on the server side. The full URL in the report also carries a friendly name,LiveProducerLiveVideoTrimMutation, which tells us this operation is the live video trim mutation.variablesis followed by the data block, written in JSON (a common text format for structured data, using curly braces and quoted names)."input"is the container for the values the operation needs."start_time_ms":0says the retained part of the video starts at 0 milliseconds, that is, at the very beginning."end_time_ms":12000says the retained part ends at 12000 milliseconds, that is, 12 seconds in."video_id":"valueFromStepOne"is where the target video ID from step 1 goes."actor_id":"ValueFromStepTwo"is where your own user ID from step 2 goes."client_mutation_id":"1"is an identifier the client attaches to the mutation. It is a label for the request on the client side.
Step 4: Change end_time_ms
Set end_time_ms to the time, in milliseconds, at which you want the video to end. One second is 1000 ms, so 10000 ms is 10 seconds. If the video is 5 minutes long, setting this value makes the resulting video 10 seconds long. The reason for this step is that this single number controls how much of the video survives the trim: everything after it is cut away.
Step 5: Submit the request
The response came back as an error:
{
“errors”:
{
…
“code”: 1675030,
…
}
The response returned error #1675030, but the trim was done anyway. This is an important detail: the server said something went wrong, yet it had already changed the video. In everyday terms, it is like a shop assistant telling you the payment failed while handing you the goods. You cannot trust the error message alone; you have to check whether the thing actually changed.
Step 6: Remove the video content
Updating end_time_ms again, this time to 1, removes the video content:
end_time_ms:1
Here end_time_ms is set to 1 millisecond, so the retained part of the video is essentially nothing. After this the owner becomes unable to restore the original video, and the original video duration becomes 0 seconds long. The researcher notes that trimming to 5 milliseconds makes the video 0 seconds long and the owner cannot untrim it. The reason this matters is that the damage is not just cosmetic: the owner loses the content itself.
Step 7: Untrim the video as the attacker
Untrimming is the opposite action, putting the trimmed-away part back. It is a separate GraphQL mutation, sent as follows:
Line by line:
POSTand/api/graphql/are the same method and address as before.doc_id=3989508527791126is a different operation identifier. The full URL in the report names itLiveProducerLiveVideoUntrimMutation, the live video untrim mutation."video_id":"ValueFromStepOne"is again the target video ID."actor_id":"valueFromStepTwo"is again the acting user's ID, here the attacker's."client_mutation_id":"25"is the client-side label for this request.
The reason for this step is to show that the same missing ownership check applies in both directions: the attacker can not only cut a video down but also change its state back.
The response again reported an error:
{
“errors”:
{
…
“code”: 1675030,
…
}
The response returned error #1675030, but the untrim was done. The researcher notes that this results in a privacy issue, because one user can alter the state of another user's video.
Why it worked
What the requests show is that the trim and untrim mutations accept a video_id and an actor_id supplied by the client, and that the backend acted on a video belonging to another user when the actor was the attacker. The ownership check that should tie the acting user to the video was therefore missing or ineffective. The error code #1675030 returned in both responses did not prevent the operation from taking effect, so the error path did not act as a safeguard either.
Impact
Anyone can trim or untrim any live video on Facebook. Trimming a video to 5 milliseconds makes it 0 seconds long, and the owner is then unable to untrim it, so the original content is lost to the owner. The researcher also flags the untrim action as a privacy issue, since an attacker can alter the state of another user's video. The report does not go into further consequences beyond these.
The fix
The timeline lists a patch confirmed by Facebook on 28/09/2020, three days after the report was sent on 25/09/2020.
Things worth trying elsewhere
These are general patterns suggested by the report's findings, useful when looking at similar features:
- Apply the same pattern to other GraphQL mutations that take both an object ID and an
actor_id: send the victim's object ID with your own actor ID and check whether the operation succeeds despite an error response. - Test the untrim or restore counterpart of any destructive editing feature, since the report shows both directions were affected.
- Watch for mutations that return an error code but still change state: compare the object before and after the request rather than trusting the response.
- Try boundary values for time fields such as
end_time_msset to1, and check whether the owner can recover the original content afterwards.
Timeline
| Date | Event |
|---|---|
| 25/09/2020 | Report sent |
| 25/09/2020 | Triaged by Facebook after 2 hours |
| 28/09/2020 | Patch confirmed by Facebook |
| 10/10/2020 | $11,000 bounty awarded during BountyCon 2020 (with bonus) |
| 12/10/2020 | Additional $1150 bounty awarded by Facebook (with bonus) |
| 12/10/2020 | Additional $2300 bounty awarded by Facebook (with bonus) |
Glossary
- API: the interface software uses to talk to another piece of software, like a waiter carrying orders between you and the kitchen.
- GraphQL: a style of API where requests name an operation and supply structured data, rather than using many separate addresses.
- Mutation: a GraphQL operation that changes something, as opposed to one that only reads.
- Request: the message a browser or program sends to a server, including the address, the method and any data.
- POST: an HTTP method used when sending data to a server.
- JSON: a text format for structured data, using curly braces, square brackets and quoted names.
- Identifier (ID): a unique label for a thing, such as a video or a user account.
video_id: the field naming which video an operation applies to.actor_id: the field naming which user is performing the action.client_mutation_id: a client-side label attached to a mutation request.start_time_ms/end_time_ms: the start and end of the retained part of a video, measured in milliseconds.- Millisecond (ms): one thousandth of a second; 1000 ms is one second.
- Logic flaw: a bug where the software follows its programming but enforces the wrong rules, allowing something that should not be allowed.
- Ownership check: the rule that only the owner of a thing may change it.
- Bypass: getting around a check or restriction without being authorised to.
- Trim / untrim: cutting unwanted parts off a video, and putting them back again.
- Error code: a number a server returns to indicate a problem; here #1675030 appeared even though the action still took effect.
- Triaged: reviewed and accepted as a valid report by the receiving organisation.
- Patch: a change made to software to fix a problem.
- Bounty: a reward paid to a researcher for reporting a security problem.
- BountyCon: the name of the event mentioned in the timeline where the first bounty was awarded.