Abusing Facebooks Call To Action To Launch Internal Deeplinks
A page admin could set the Call to Action button's destination to an internal Facebook deeplink via the Graph API, so that when a visitor on a mobile device tapped the button, the app opened an internal link. This could enable CSRF or user de-anonymisation attacks against visitors who engaged with the button.
This feature, known as Call to action or CTA is designed for user engagement and allows a page to redirect their visitors to a website, an app, inbox etc. The documentation for this feature can be found here
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
Every Facebook page carries a prominent blue button at the top, the Call to action (CTA). It exists for engagement: a page admin can point visitors at a website, an app, the inbox, and similar destinations. Meta documents the feature, and the CTA is backed by an object in the Graph API that the page admin can edit.
The researcher spent a few hours experimenting with the Graph API against this object and found that a page admin could abuse the CTA to launch Facebook's own internal deeplinks when another user clicked the button. The behaviour depends on the client: if the CTA is clicked from a mobile device, the crafted payload could be executed, while a click from the web kept the original functionality. The stated impact is that a page admin could run CSRF or user de-anonymisation attacks against visitors who engage with the Call to Action button.
Setup
The work is done entirely through Facebook's Graph API, using the Graph API Explorer. The actor, referred to as UserA, is a page admin and needs the following permissions:
- pages_manage_cta
- pages_manage_instant_articles
- pages_show_list
- pages_read_engagement
- pages_manage_metadata
- pages_read_user_content
- pages_manage_ads
The requests shown use Graph API version v12.0. A Facebook page is required, and the admin must be able to edit its Action Button.
Finding it
After playing with the Graph API, the researcher found that a page admin could abuse the CTA to launch Facebook's own internal deeplinks. The button is meant to send visitors to an external destination chosen by the page; being able to store an internal deeplink in it, and have a mobile client execute that deeplink on click, is the anomaly.
Exploitation
Step 1: Create a page and configure the Action Button
Create a new Facebook page and edit the Action Button. Select "Use App", provide a valid URL and click save.
Step 2: Capture the CTA id
Take note of the Call to action id found in the POST request that was just made. The example payload from that request is:
{
"input":{
"cta_type":"OPEN_APP",
"fields_data":[
{
"field_key":"external_link",
"field_value":"https://ash-king.co.uk"
}
],
"id":"1026998747874558",
"is_for_primary_cta":true,
"source":"PAGES_COVER_AREA_SURFACE",
"actor_id":"212956242612150",
"client_mutation_id":"2"
}
}
The cta_type is OPEN_APP, the external_link field holds the URL the admin supplied, and the id is the CTA object identifier needed for the next step.
Step 3: Add the deeplink through the Graph API
Using the Graph API Explorer, send a POST to the CTA object with the deeplink fields. The URL used is:
https://developers.facebook.com/tools/explorer/?method=POST&path=XXX&version=v12.0&android_deeplink=fbinternal%3A%2F%2Fsupersecretfbinternallink&android_destination_type=APP_DEEPLINK
Here XXX is the CTA id from the previous step. The android_deeplink parameter carries the internal deeplink, URL-encoded as fbinternal%3A%2F%2Fsupersecretfbinternallink, and android_destination_type is set to APP_DEEPLINK.
Running this POST updates the existing CTA object so that it includes an Android deeplink with a destination type of APP_DEEPLINK.
Step 4: Confirm the stored object
The response is "Success". A subsequent Graph API call on the CTA object shows the object now carrying the deeplink fields.
Step 5: Trigger it from a victim's device
When another user visits the page from an Android device, the internal deeplink is executed as soon as the visitor clicks the "Use App" button. The behaviour is demonstrated in the recording:
Step 6: The same on iOS
Shortly after the bug was triaged, the researcher revisited the documentation and noticed fields called iphone_deeplink and iphone_destination_type on the CTA object. Replaying the same POST request with the iOS keys instead of the Android ones also launched internal links on an iOS device.
Root cause
The CTA object accepts deeplink fields (android_deeplink with android_destination_type, and iphone_deeplink with iphone_destination_type) from a page admin through the Graph API, and the mobile clients execute the stored deeplink when the button is tapped. The CTA object accepted deeplink fields set to Facebook's internal fbinternal:// scheme through the Graph API, and the mobile apps executed the stored deeplink when the button was tapped. The web client kept its original behaviour, so the issue was specific to the mobile apps. The report does not describe the server-side check that was missing; the above is what the behaviour implies.
Impact
A page admin could perform CSRF or user de-anonymisation attacks against visitors who engage with the Call to Action button. The malicious payload executes when the button is clicked from a mobile device; on the web the button keeps its original functionality. The victim has to visit the page and click the button, and the attack is tied to the platform of the device (Android, and separately iOS via the iphone_* fields). Meta's own summary of the award states that the issue could have allowed victims to unintentionally open internal deeplinks.
Fix
Meta confirmed the vulnerability fixed on 24 January 2022, and the bounty was issued on 26 January 2022. That first fix did not cover everything: after the bounty, no one could create an internal deeplink through a Graph API request, but any deeplink already in place could still be executed on mobile devices. This was raised with Facebook on 17 February 2022, the blog post was taken down the same day, and Facebook began investigating further. On 13 October 2022 Meta said it was removing the previously created call to action buttons and was investigating possible additional impact. On 25 October 2022 the vulnerability was confirmed fixed, and on 14 December 2022 Meta confirmed that no additional impact had been found and that no additional bounty would be awarded. On 13 October 2022 a cleanup was made on all CTA objects using an internal deeplink.
Variants to test
- Other deeplink-bearing fields on the same object. The iOS keys (
iphone_deeplink,iphone_destination_type) were found only by rereading the documentation after triage. Enumerate every documented field on a CTA-like object and try each destination-type field with an internal scheme. A positive result is a stored value that the mobile client executes on tap. - Other clients. The web client kept its original behaviour while the mobile apps executed the deeplink. Test the same stored value from web, Android and iOS separately; a positive result is execution on one client and not another.
- Other page-level objects that accept a URL or app destination. The same pattern, an admin-controlled destination that a client later resolves, may exist elsewhere in the page surface. A positive result is an internal scheme surviving storage and being opened by the client.
- Cleanup gaps. After a fix, check whether objects created before it still hold internal deeplinks and still execute them, which is exactly what happened here between the first fix and the October cleanup.
Timeline
- 28 Oct 2021: reported to Meta
- 29 Oct 2021: triaged
- 24 Jan 2022: vulnerability confirmed fixed
- 26 Jan 2022: bounty issued (89 days in, one day short of the 10% bonus)
- 02 Feb 2022: blog post went live
- 17 Feb 2022: blog post taken down; Facebook investigating further
- 13 Oct 2022: cleanup of all CTA objects using an internal deeplink
- 25 Oct 2022: vulnerability confirmed fixed
- XX XXX 2022: additional bounty rewarded
- 14 Dec 2022: no additional impact found
Meta's award message read:
After reviewing this issue, we have decided to award you a bounty of $4000. Below is an explanation of the bounty amount. Meta fulfills its bounty awards through Bugcrowd and HackerOne.
This issue could have allowed victim's to unintentionally open internal deeplinks.
What happened, in plain words
Every Facebook page has a big blue button near the top. Facebook calls it the Call to action, or CTA for short. A page owner (the "admin") can set that button so that a visitor who clicks it is sent somewhere: to a website, to an app, to the page's inbox, and so on. Facebook documents how this works, and behind the scenes the button is stored as an object in Facebook's Graph API, which the page admin can edit.
A security researcher spent a few hours experimenting with that object through the Graph API. He found that a page admin could put something unexpected into the button: a link that points inside Facebook's own mobile apps rather than to an outside website. Facebook calls these internal links "deeplinks". When another person visited the page on a phone and tapped the button, the phone app followed the internal link. On a normal web browser the button kept working as before, so the problem was specific to the mobile apps.
The researcher's stated impact is that a page admin could run CSRF or user de-anonymisation attacks against the people who click the Call to Action button. Meta's own summary of the award says the issue "could have allowed victim's to unintentionally open internal deeplinks".
Before going further, a few ideas from zero:
- API: an API is a way for one piece of software to talk to another using structured requests, rather than a human clicking around a website. Think of a restaurant: the menu and the waiter are the API, and the kitchen is the system behind it. You ask in a fixed format and get an answer back in a fixed format.
- Graph API: Facebook's API for reading and changing things on its platform, such as pages and their settings. Facebook provides a web page called the Graph API Explorer where you can build and send these requests without writing any code.
- Object: a single stored thing in that API, with a name and a set of fields. The CTA button is one such object, and it has an identifier (an
id) so you can refer to it. - POST request: one of the standard ways a browser or program talks to a server. A POST is normally used to send data that changes something, for example saving a form. A GET is normally used just to read something.
- Parameter: a named value attached to a request, like
colour=bluein a web address. The server reads the name and uses the value. - Deeplink: a link that opens a specific place inside an app rather than a page on the web. Think of a link that does not just open a shopping app but jumps straight to one particular product inside it.
- Scheme: the first part of a link, before the
://, which tells the device what kind of link it is.https://means a website. Facebook's internal links use the schemefbinternal://, which only the Facebook app understands. - CSRF (Cross-Site Request Forgery): tricking a logged-in user's browser or app into performing an action the user did not intend, by making the request come from somewhere the user trusts. A simple comparison: someone forges your signature on a form you never read.
- De-anonymisation: working out who a supposedly anonymous person really is, for example by getting their app to reveal an identity or account behind an action.
- Permission: an explicit grant that lets an app or a user do a certain kind of action through the API. Facebook lists permissions with names like
pages_manage_cta. - Token / cookie: a small piece of data that proves who you are on a later request, so you do not have to type your password every time. A session cookie is like a wristband at an event: show it at the door and you get back in without queuing again.
- URL-encoding: replacing characters that are not allowed in a web address with a code. For example a colon
:becomes%3Aand a slash/becomes%2F, so the address stays valid.
Setting things up
The whole experiment is done through Facebook's Graph API, using the Graph API Explorer. The person doing the actions, called UserA in the report, is a page admin. To make these changes, that account needs the following permissions:
- pages_manage_cta
- pages_manage_instant_articles
- pages_show_list
- pages_read_engagement
- pages_manage_metadata
- pages_read_user_content
- pages_manage_ads
Each line is one permission name. In plain words: permission to manage the call-to-action button, to manage instant articles, to list the pages the account owns, to read engagement data, to manage page metadata, to read content from users, and to manage ads. Without these, the API will refuse the requests.
The requests shown use Graph API version v12.0. You also need a Facebook page, and the admin account must be able to edit its Action Button. That is the whole setup: no special tools, just a browser and a Facebook account that owns a page.
Finding the problem
After experimenting with the Graph API, the researcher found that a page admin could abuse the CTA to launch Facebook's own internal deeplinks. In other words, the button is meant to send visitors to an outside destination chosen by the page, but it also accepted a link pointing inside Facebook's own apps, and the mobile app would then follow that link when the button was tapped. That mismatch is the bug.
Walking through the attack
Step 1: Create a page and set up the Action Button
Create a new Facebook page and edit the Action Button. Select "Use App", provide a valid URL and click save. This is ordinary use of the feature: you select "Use App" and provide a valid URL. Doing this first gives you a real CTA object to work with.
Step 2: Note the CTA id
When you save the button, your browser sends a request to Facebook. Take note of the Call to action id found in the POST request that was just made. The example payload from that request is:
{
"input":{
"cta_type":"OPEN_APP",
"fields_data":[
{
"field_key":"external_link",
"field_value":"https://ash-king.co.uk"
}
],
"id":"1026998747874558",
"is_for_primary_cta":true,
"source":"PAGES_COVER_AREA_SURFACE",
"actor_id":"212956242612150",
"client_mutation_id":"2"
}
}
Line by line:
- The outer braces
{and}wrap one JSON object, which is the data being sent. JSON is just a text format for structured data, like a very strict shopping list. "input"is the name of the field that holds the actual settings being submitted. Everything inside its own braces belongs to that field."cta_type":"OPEN_APP"says what kind of button this is: one that opens an app."fields_data"is a list (the square brackets[and]) of extra settings. Here the list has one entry.- Inside that entry,
"field_key":"external_link"names the setting, and"field_value":"https://ash-king.co.uk"gives it a value, the website address the admin supplied. "id":"1026998747874558"is the identifier of the CTA object. This is the number you need for the next step, because it tells the API which button to change."is_for_primary_cta":truemarks this as the main button on the page."source":"PAGES_COVER_AREA_SURFACE"records where on the page the button lives, here the cover area at the top."actor_id":"212956242612150"identifies the account that made the change."client_mutation_id":"2"is a label the client attaches to the change, used to keep track of it.
Step 3: Add the deeplink through the Graph API
Now open the Graph API Explorer and send a POST to the CTA object, adding the deeplink fields. The address used is:
https://developers.facebook.com/tools/explorer/?method=POST&path=XXX&version=v12.0&android_deeplink=fbinternal%3A%2F%2Fsupersecretfbinternallink&android_destination_type=APP_DEEPLINK
This is a normal web address with several parameters after the ?, each separated by &. Reading it piece by piece:
https://developers.facebook.com/tools/explorer/is the Graph API Explorer page.method=POSTtells the explorer to send a POST request, the kind that changes something, rather than just reading.path=XXXsays which object to act on.XXXis a placeholder: you replace it with the CTA id from the previous step.version=v12.0picks the version of the Graph API to use.android_deeplink=fbinternal%3A%2F%2Fsupersecretfbinternallinkis the interesting part. The value is a link using Facebook's internal scheme. Because:and/are not safe to put raw in a web address, they are URL-encoded:%3Ais a colon and%2Fis a slash, so the value really readsfbinternal://supersecretfbinternallink. The wordsupersecretfbinternallinkis a stand-in for whatever internal destination you want to reach.android_destination_type=APP_DEEPLINKtells Facebook that this value is a deeplink to be opened by the app, not an ordinary web address.
Running this POST updates the existing CTA object so that it includes an Android deeplink with a destination type of APP_DEEPLINK. In everyday terms: you have taken the button that was supposed to point outside Facebook and quietly pointed it at a place inside the Facebook app.
Step 4: Check what was stored
The response is "Success". A subsequent Graph API call on the CTA object shows the object now carrying the deeplink fields.
This step matters because it proves the value was actually saved on Facebook's side, not just accepted and thrown away. If the object still looked like it did in step 2, the attack would go nowhere.
Step 5: Trigger it from a victim's phone
When another user visits the page from an Android device, the internal deeplink is executed as soon as the visitor clicks the "Use App" button. The behaviour is demonstrated in the recording:
The recording demonstrates the behaviour. Notice the two conditions: the visitor has to be on a phone, and they have to tap the button. On a desktop browser the button would keep its original behaviour, which is why the researcher describes the problem as specific to the mobile apps.
Step 6: The same thing on iOS
Shortly after the bug was triaged, the researcher went back to the documentation and noticed fields called iphone_deeplink and iphone_destination_type on the CTA object. Replaying the same POST request with the iOS keys instead of the Android ones also launched internal links on an iOS device.
In other words, the same trick worked twice: once with the Android fields and once with the iPhone fields. The only difference is the name of the parameter you send. This is a useful lesson for anyone testing: read the documentation carefully, because a fix or a test that only covers one platform can miss the other.
Why it worked
The CTA object accepts deeplink fields (android_deeplink with android_destination_type, and iphone_deeplink with iphone_destination_type) from a page admin through the Graph API, and the mobile apps execute the stored deeplink when the button is tapped. The CTA object accepted deeplink fields set to Facebook's internal fbinternal:// scheme through the Graph API, and the mobile apps executed the stored deeplink when the button was tapped. The web client kept its original behaviour, so the issue was specific to the mobile apps. The report does not describe the server-side check that was missing; the above is what the behaviour implies.
A simple comparison: a hotel receptionist is told to write down the address a guest wants to visit, but never checks that the address is outside the hotel. The guest writes "room 402" and the receptionist happily sends the next visitor there.
What an attacker could do with it
A page admin could perform CSRF or user de-anonymisation attacks against visitors who engage with the Call to Action button. The malicious payload executes when the button is clicked from a mobile device; on the web the button keeps its original functionality. The victim has to visit the page and click the button, and the attack is tied to the platform of the device (Android, and separately iOS via the iphone_* fields). Meta's own summary of the award states that the issue could have allowed victims to unintentionally open internal deeplinks.
How it was fixed
Meta confirmed the vulnerability fixed on 24 January 2022, and the bounty was issued on 26 January 2022. That first fix did not cover everything: after the bounty, no one could create an internal deeplink through a Graph API request, but any deeplink already in place could still be executed on mobile devices. This was raised with Facebook on 17 February 2022, the blog post was taken down the same day, and Facebook began investigating further. On 13 October 2022 Meta said it was removing the previously created call to action buttons and was investigating possible additional impact. On 25 October 2022 the vulnerability was confirmed fixed, and on 14 December 2022 Meta confirmed that no additional impact had been found and that no additional bounty would be awarded. On 13 October 2022 a cleanup was made on all CTA objects using an internal deeplink.
The lesson here is that fixing the way new values are saved is not the same as cleaning up the values that are already stored. Think of a building that stops handing out new keys but never changes the locks on the doors that already have them.
Other places to look for the same pattern
- Other deeplink-bearing fields on the same object. The iOS keys (
iphone_deeplink,iphone_destination_type) were found only by rereading the documentation after triage. Enumerate every documented field on a CTA-like object and try each destination-type field with an internal scheme. A positive result is a stored value that the mobile client executes on tap. - Other clients. The web client kept its original behaviour while the mobile apps executed the deeplink. Test the same stored value from web, Android and iOS separately; a positive result is execution on one client and not another.
- Other page-level objects that accept a URL or app destination. The same pattern, an admin-controlled destination that a client later resolves, may exist elsewhere in the page surface. A positive result is an internal scheme surviving storage and being opened by the client.
- Cleanup gaps. After a fix, check whether objects created before it still hold internal deeplinks and still execute them, which is exactly what happened here between the first fix and the October cleanup.
Timeline
- 28 Oct 2021: reported to Meta
- 29 Oct 2021: triaged
- 24 Jan 2022: vulnerability confirmed fixed
- 26 Jan 2022: bounty issued (89 days in, one day short of the 10% bonus)
- 02 Feb 2022: blog post went live
- 17 Feb 2022: blog post taken down; Facebook investigating further
- 13 Oct 2022: cleanup of all CTA objects using an internal deeplink
- 25 Oct 2022: vulnerability confirmed fixed
- XX XXX 2022: additional bounty rewarded
- 14 Dec 2022: no additional impact found
Meta's award message read:
After reviewing this issue, we have decided to award you a bounty of $4000. Below is an explanation of the bounty amount. Meta fulfills its bounty awards through Bugcrowd and HackerOne.
This issue could have allowed victim's to unintentionally open internal deeplinks.
Glossary
- API: a fixed way for one program to ask another program to do something or return data, without a human clicking through a website.
- Graph API Explorer: a web page provided by Facebook where you can build and send Graph API requests without writing code.
- Object: a single stored item in an API, with a name and a set of fields, identified by an id.
- POST request: a request that sends data to a server and normally changes something, such as saving a form.
- GET request: a request that normally only reads something from a server.
- Parameter: a named value attached to a request, such as
version=v12.0. - Payload: the data carried inside a request, as opposed to the address it is sent to.
- JSON: a plain text format for structured data, using braces, square brackets, names and values.
- CTA (Call to action): the prominent button on a Facebook page that sends visitors to a website, an app, the inbox or similar.
- Scheme: the first part of a link before
://, which tells the device what kind of link it is, such ashttps://orfbinternal://. fbinternal://: Facebook's internal link scheme, understood by its own apps.- URL-encoding: replacing characters that are not allowed in a web address with codes, such as
%3Afor a colon and%2Ffor a slash. - Permission: an explicit grant that lets an account or app perform a certain kind of action through the API.
- Token / cookie: a small piece of data that proves who you are on later requests, so you do not have to log in every time.
- CSRF (Cross-Site Request Forgery): tricking a logged-in user into performing an action they did not intend, by making the request appear to come from somewhere they trust.
- De-anonymisation: working out who an apparently anonymous person really is.
- Triage: the vendor's first review of a report, where they decide whether it is a real issue worth investigating.
- Bounty: a payment a company makes to a researcher who reports a valid security issue.
- Validation: checking that data a user supplies is allowed and safe before storing or using it.
- Client: the program the user is running, such as a web browser, the Android app or the iOS app.
- Root cause: the underlying reason a bug exists, as opposed to the visible symptom.
- Variant: a different place or way the same underlying bug might appear.