Facebook OAuth Account Takeover: The $44,250 Redirect
The Oculus login endpoint, a valid redirect URI for Facebook OAuth, was rebuilt during a migration and began forwarding users to a caller-supplied 'next' URL instead of doing so in JavaScript. Because the implicit flow places the access token in the URL fragment, which browsers carry across redirects, an attacker could chain this with an open redirect on an Oculus subdomain to steal a first-party token and take over the victim's Facebook and Oculus accounts.
medium.com
Published on medium.com
Bug Bounty
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 accounts could be used to log in to Oculus. Facebook's OAuth configuration for the Oculus app listed an Oculus login endpoint as a valid redirect URI, so Facebook would hand tokens to that endpoint. That endpoint was first-party: the token it received belonged to an app Facebook treats as its own, not a limited third-party grant.
Oculus then moved login to Meta accounts. The endpoint was rebuilt to bounce users through the Meta login service and back, and finally to forward them to a next URL taken from its own query string, which could be any Oculus subdomain. The token-leak protection the endpoint used to have did not survive that move.

AI-generated illustration
Setup
The flow needed two things from the victim: they had to be logged in to Facebook, and a login CSRF was used to place them in the right Meta state. The researcher also relied on an Oculus subdomain that forwarded to a third-party service with an open redirect, so the token could land on a page the researcher controlled. The open redirect itself was not fully disclosed because it was still not completely fixed.
Finding it
The old version of the endpoint did its final hop in JavaScript, which kept the token from following. The new version redirected directly. With the implicit flow the token sits in the URL fragment, and browsers carry fragments across redirects, so the token rode every hop of the chain. An allowed redirect URI is only as safe as every redirect it can trigger, and after the migration this one could trigger a chain ending at an attacker-influenced destination.
Exploitation
Step 1: Facebook hands the token to the Oculus endpoint
Facebook's OAuth configuration for the Oculus app listed the Oculus login endpoint as a valid redirect URI, so Facebook would hand tokens to it. The report does not include the request or response for this step.
Step 2: The endpoint forwards to next
After the migration the endpoint bounced the user through the Meta login service and back, then forwarded them to a next URL taken from its own query string, which could be any Oculus subdomain. Because the new version redirected directly rather than doing the final hop in JavaScript, the fragment carrying the implicit-flow token followed the redirect.
Step 3: The chain reaches an attacker-controlled page
The last link was an Oculus subdomain that forwarded to a third-party service with an open redirect, so the token landed on a page the researcher controlled. The report does not give the subdomain, the third-party service or the redirect URL.
Root cause
The endpoint's next parameter accepted any Oculus subdomain, and the final hop was a direct redirect rather than a JavaScript hop that would have dropped the fragment. Combined with an open redirect on an Oculus subdomain, the allowed redirect URI became a chain to an attacker-influenced destination. The migration removed the protection: the login rewrite changed what the allowed URI actually did. The report does not show the server-side code, so the exact implementation is not stated.
Impact
A first-party token is not a limited third-party grant. The researcher states it could be used to access the victim's Facebook and Oculus accounts. The victim only had to be logged in to Facebook and land on the attacker's flow. Meta fixed it in September 2022 and paid $44,250, including BountyCon bonuses and a Highest Impact Report bonus. No CVE was reported, and severity and CVSS are not reported.
Fix
Meta fixed the issue in September 2022. The author's own recommendations are:
- Register exact redirect URIs, never an endpoint that forwards to a caller-supplied URL.
- Use code flow with PKCE: fragment tokens follow redirects, while codes bound to a verifier are useless when stolen.
- Re-review OAuth trust after migrations, because a login rewrite changes what an allowed URI does.
- Restrict post-login
nexttargets with an allow-list of paths, and clear the fragment on every onward hop.
The report includes this illustrative snippet for the last point:
from urllib.parse import urlsplitSAFE_NEXT_PATHS = {"/", "/account", "/store"} def finish_login(request, session): session.establish_from(request) nxt = request.query.get("next", "/") parts = urlsplit(nxt) if parts.scheme or parts.netloc or parts.path not in SAFE_NEXT_PATHS: nxt = "/" return Redirect(urlsplit(nxt).path + "#", headers={"Referrer-Policy": "no-referrer"})
Variants to test
- Post-migration redirect URIs. Re-test every registered redirect URI after a login rewrite. A positive result is an endpoint that still receives tokens but now forwards to a caller-supplied destination.
next-style parameters. Try values pointing at other subdomains of the same domain. A positive result is a redirect to a subdomain you do not control the content of, especially one with its own open redirect.- Fragment survival. Use the implicit flow and watch whether the fragment survives each hop. A positive result is the token appearing in the URL of a page you control.
- Open redirects on sibling subdomains. Look for a subdomain that forwards to a third-party service with an open redirect. A positive result is a chain from the trusted endpoint to your page.
- Login CSRF. Check whether the login state can be set for the victim without their interaction. A positive result is the victim being placed in the state your flow needs.
What happened, in plain words
Facebook accounts could be used to log in to Oculus, the virtual-reality headset platform. When you clicked "Log in with Facebook" inside Oculus, Facebook did not log you in itself. It handed a special pass to an Oculus login page, and that page finished the job. The pass is called a token: a long string of characters that proves who you are, a bit like a cloakroom ticket that gets you your coat back without showing ID again.
The Oculus login page was trusted by Facebook. Facebook had it on a list of addresses it was allowed to send tokens to. That list is called the OAuth configuration, and each entry is a redirect URI: the address Facebook is permitted to forward you to after you approve a login.
Later, Oculus changed how login worked and moved it to Meta accounts. The login page was rebuilt. Before the rebuild, it finished its last step using JavaScript, a small program running inside your browser. That detail mattered: the JavaScript step stopped the token from travelling any further. After the rebuild, the page simply redirected you onward, and the token went along for the ride.
The page also had a setting called next: a web address supplied in the link that told the page where to send you after login. It accepted any Oculus subdomain. A subdomain is a section of a larger website, like store.example.com under example.com. One of those Oculus subdomains forwarded visitors to a third-party service that had its own open redirect, meaning it would send visitors to any address someone asked for. The token ended up on a page the researcher controlled.
A token from a first-party app like this is powerful. It is not a narrow permission slip for one small feature; the researcher states it could be used to access the victim's Facebook and Oculus accounts. Meta fixed the problem in September 2022 and paid $44,250, including bonuses. The researcher was Youssef Sammouda.

AI-generated illustration
The pieces you need to know
Before the steps make sense, here are the ideas in play, explained from scratch.
- OAuth: a way for one website to let another website confirm who you are, without sharing your password. Think of a hotel letting a partner restaurant charge meals to your room: the hotel vouches for you, and the restaurant never sees your key. Here, Facebook vouches for you to Oculus.
- Token: the proof of identity that gets passed around. It is like the cloakroom ticket above: whoever holds it can collect what it unlocks.
- Access token: the specific kind of token that grants access to your account data. A first-party access token belongs to an app the platform treats as its own, so it carries much more power than a token issued to an outside developer.
- Redirect URI: the address a login service is allowed to send you (and your token) to once you approve. It is a guest list: only listed addresses get the token.
- Redirect chain: a series of forwardings, one address sending you to the next. Like being passed between departments in a phone call.
- Open redirect: a feature on a website that sends visitors to any address supplied in the link, with no check. Useful for "return to the page you came from", dangerous when abused, because an attacker can make a trusted site forward people to a page the attacker owns.
- URL fragment: the part of a web address after a
#symbol. Browsers keep it when they follow a redirect, which is exactly why it matters here. - Implicit flow: an older OAuth style where the token is placed directly in the web address, in that fragment, rather than being fetched separately by the app.
- CSRF (Cross-Site Request Forgery): tricking a logged-in user's browser into performing an action they did not intend. A login CSRF is the version that quietly puts the victim into a login state the attacker chose.
- Subdomain: a named section of a domain, such as
shop.example.comunderexample.com. - JavaScript: code that runs inside your browser and can change what the page does, including how it moves you to the next page.
Setup: what the attack needed from the victim
The flow needed two things from the victim. First, they had to be logged in to Facebook. Second, a login CSRF was used to place them in the right Meta state, meaning the attacker arranged for the victim's browser to be in the particular login condition the chain required, without the victim deciding to do that.
The researcher also relied on an Oculus subdomain that forwarded to a third-party service with an open redirect, so the token could land on a page the researcher controlled. The open redirect itself was not fully disclosed because it was still not completely fixed. In other words, the public write-up leaves out one link of the chain because it was still not completely fixed.
Finding it: why the migration broke the protection
The old version of the endpoint did its final hop in JavaScript, which kept the token from following. Picture a receptionist who reads your room number aloud but does not walk you to the door: the information stays put. The new version redirected directly, so the browser itself carried you, and everything in the address, to the next place.
With the implicit flow the token sits in the URL fragment, and browsers carry fragments across redirects, so the token rode every hop of the chain. An allowed redirect URI is only as safe as every redirect it can trigger, and after the migration this one could trigger a chain ending at an attacker-influenced destination.
Exploitation, step by step
Step 1: Facebook hands the token to the Oculus endpoint
Facebook's OAuth configuration for the Oculus app listed the Oculus login endpoint as a valid redirect URI, so Facebook would hand tokens to it. This is the normal, intended behaviour: the guest list said the Oculus page was allowed to receive the token. The report does not include the request or response for this step, so there is no code to show here.
Step 2: The endpoint forwards to next
After the migration the endpoint bounced the user through the Meta login service and back, then forwarded them to a next URL taken from its own query string, which could be any Oculus subdomain. The query string is the part of a web address after the ?, where settings like next=... are passed. Because the new version redirected directly rather than doing the final hop in JavaScript, the fragment carrying the implicit-flow token followed the redirect.
The next setting gave them a way to choose the destination, and the direct redirect made sure the token came along.
Step 3: The chain reaches an attacker-controlled page
The last link was an Oculus subdomain that forwarded to a third-party service with an open redirect, so the token landed on a page the researcher controlled. The report does not give the subdomain, the third-party service or the redirect URL.
A trusted Oculus subdomain was the doorway, and the third-party open redirect was the final push into the researcher's own page.
Root cause: the single design mistake
The endpoint's next parameter accepted any Oculus subdomain, and the final hop was a direct redirect rather than a JavaScript hop that would have dropped the fragment. Combined with an open redirect on an Oculus subdomain, the allowed redirect URI became a chain to an attacker-influenced destination.
The migration removed the protection: the login rewrite changed what the allowed URI actually did. The guest list still named the same address, but that address now behaved differently. The report does not show the server-side code, so the exact implementation is not stated.
Impact: why this was serious
A first-party token is not a limited third-party grant. The researcher states it could be used to access the victim's Facebook and Oculus accounts. The victim only had to be logged in to Facebook and land on the attacker's flow. Meta fixed it in September 2022 and paid $44,250, including BountyCon bonuses and a Highest Impact Report bonus. No CVE was reported, and severity and CVSS are not reported.
Fix: what should change
Meta fixed the issue in September 2022. The author's own recommendations are:
- Register exact redirect URIs, never an endpoint that forwards to a caller-supplied URL. If the guest list names a door, that door should not open onto any corridor the visitor chooses.
- Use code flow with PKCE: fragment tokens follow redirects, while codes bound to a verifier are useless when stolen. In plain terms, send a one-time claim ticket instead of the cloakroom ticket itself, and make the ticket only redeemable by the person who started the process.
- Re-review OAuth trust after migrations, because a login rewrite changes what an allowed URI does.
- Restrict post-login
nexttargets with an allow-list of paths, and clear the fragment on every onward hop.
The report includes this illustrative snippet for the last point:
from urllib.parse import urlsplitSAFE_NEXT_PATHS = {"/", "/account", "/store"} def finish_login(request, session): session.establish_from(request) nxt = request.query.get("next", "/") parts = urlsplit(nxt) if parts.scheme or parts.netloc or parts.path not in SAFE_NEXT_PATHS: nxt = "/" return Redirect(urlsplit(nxt).path + "#", headers={"Referrer-Policy": "no-referrer"})
Line by line, in plain words:
from urllib.parse import urlsplitbrings in a ready-made tool for taking a web address apart into its pieces.SAFE_NEXT_PATHS = {"/", "/account", "/store"}is the allow-list: only these three destinations are permitted after login. Anything else is refused.def finish_login(request, session):starts the function that runs when a login finishes.session.establish_from(request)sets up the user's session from the incoming request, so the server knows who just logged in.nxt = request.query.get("next", "/")reads thenextvalue from the address, and falls back to/if none was given.parts = urlsplit(nxt)breaks that value into scheme (likehttps), network location (the domain) and path.if parts.scheme or parts.netloc or parts.path not in SAFE_NEXT_PATHS:checks for trouble: a full web address with its own scheme or domain, or a path that is not on the allow-list.nxt = "/"replaces anything suspicious with the home page.return Redirect(urlsplit(nxt).path + "#", headers={"Referrer-Policy": "no-referrer"})sends the user onward to the safe path, adds an empty#to clear any fragment that might be carrying a token, and sets a header telling the browser not to pass the previous address along to the next site.
Variants to test: where else to look
- Post-migration redirect URIs. Re-test every registered redirect URI after a login rewrite. A positive result is an endpoint that still receives tokens but now forwards to a caller-supplied destination.
next-style parameters. Try values pointing at other subdomains of the same domain. A positive result is a redirect to a subdomain you do not control the content of, especially one with its own open redirect.- Fragment survival. Use the implicit flow and watch whether the fragment survives each hop. A positive result is the token appearing in the URL of a page you control.
- Open redirects on sibling subdomains. Look for a subdomain that forwards to a third-party service with an open redirect. A positive result is a chain from the trusted endpoint to your page.
- Login CSRF. Check whether the login state can be set for the victim without their interaction. A positive result is the victim being placed in the state your flow needs.
Glossary
- Access token: a string that grants access to an account or data; whoever holds it can use it.
- Allow-list: a list of things that are permitted, with everything else refused by default.
- BountyCon: a Meta-run security conference whose bonuses were included in the payout, as stated in the report.
- CSRF (Cross-Site Request Forgery): making a logged-in user's browser perform an action they did not intend.
- CVE: a public identifier for a known security vulnerability; none was reported here.
- CVSS: a scoring system for the severity of a vulnerability; not reported here.
- First-party: belonging to the platform itself rather than to an outside developer.
- Fragment: the part of a web address after
#, which browsers keep when following redirects. - Implicit flow: an OAuth style that puts the token directly in the web address.
- JavaScript: code that runs in the browser and can control page behaviour, including navigation.
- Login CSRF: a CSRF that places the victim into a login state chosen by the attacker.
- OAuth: a protocol that lets one site confirm your identity to another without sharing your password.
- Open redirect: a feature that forwards visitors to any address supplied in the link, without checking it.
- PKCE: a protection for OAuth code flow where a one-time code is bound to a secret verifier, so a stolen code is useless.
- Query string: the part of a web address after
?, carrying settings such asnext=.... - Redirect chain: a sequence of forwardings from one address to the next.
- Redirect URI: an address a login service is allowed to send users and tokens to.
- Token: a string proving identity or granting access, passed between systems.
- URL: a web address.