Booking.com OAuth Account Takeover in Three Small Gaps
Booking.com's Facebook OAuth login accepted redirect URIs matched only by origin, and an open redirect on that domain could forward the authorisation code to an attacker. The Android app also let the client choose the exchange redirect URI, so a stolen code could be redeemed, leading to account takeover.
Published on masimshahzad.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
Booking.com is a hosted travel booking service, and the feature at the centre of this case is its "Log in with Facebook" OAuth flow. Booking.com also owns Kayak, and the same login path worked there. The write-up is an analytical case study of a public disclosure by Salt Labs researcher Aviad Carmel, not the author's own discovery. Booking.com fixed the issues within weeks of the December 2022 report, before the March 2023 publication.

The illustration above is AI-generated and accompanies the article.
The chain combined three small gaps into a one-click account takeover: a loose redirect URI registration, an open redirect on the account domain, and a client-supplied exchange URI. The author maps the issues to CWE-601 (URL Redirection to Untrusted Site), CWE-346 (Origin Validation Error) and CWE-472 (External Control of Assumed-Immutable Web Parameter), noting that this mapping is analytical and not from the source. There is no CVE because the target is a hosted service. Severity and bounty are not reported.
Setup
The write-up does not describe a lab setup, tooling or versions. The preconditions it does state are:
- A victim account that uses "Log in with Facebook" on Booking.com, plus its linked Kayak login.
- One link on a legitimate
facebook.comURL was enough to trigger the chain.
Accounts created with Google were also exposed, because Booking matched the Facebook email to the existing account.
Finding it
The write-up presents three minor-looking gaps that, individually, would not be enough. The write-up presents them at a high level rather than with captured requests.
Gap one: redirects registered by origin, not path. Facebook only enforced that the code returned to Booking's account domain. Any path on that domain was accepted.
Gap two: an open redirect on that domain. A settings flow read its next destination from inside its state parameter, with no allowlist. If the OAuth redirect is aimed at that flow, and a response mode is requested that puts the code in the URL fragment, the browser carries the victim's code to an outside site.
Gap three: the client chose the exchange URI. A stolen code alone failed, because Facebook requires the exchange to repeat the original redirect URI, and the website sent a fixed one. The Android app's login request, however, carried a result URI that the backend used for the exchange. Supplying the malicious link's URI made Facebook accept the code.
Exploitation
The write-up intentionally omits reproduction details. What follows is the chain as described, without the concrete endpoints, parameters or payloads, which the source does not publish.
Step 1: aim the OAuth redirect at the open redirect
Because Facebook accepted any path on Booking's account domain, the attacker could point the OAuth redirect at the settings flow that reads its next destination from its state parameter. The settings flow reads its next destination from its state parameter with no allowlist, so the attacker can set the next destination to an outside site.
Step 2: request a fragment response mode
The attacker requests a response mode that places the authorization code in the URL fragment. The browser then carries the victim's code to the outside site when the settings flow redirects there.
Step 3: exchange the code with a client-supplied URI
A stolen code alone is not enough: Facebook requires the exchange to repeat the original redirect URI, and the website sends a fixed one. The Android app's login request carries a result URI that the backend uses for the exchange. By supplying the malicious link's URI, the attacker makes Facebook accept the code and complete the exchange.
Step 4: use the session
With the exchange complete, the attacker holds the victim's session. The login also worked on Kayak, and accounts created with Google were exposed because Booking matched the Facebook email to the existing account.
Root cause
The design mistakes are:
- Origin-only redirect registration. Facebook enforced only the account domain, so any path there was a valid redirect target. This turns any redirect on that domain into a code leak.
- Open redirect driven by client-editable state. The settings flow read its next destination from inside its state parameter with no allowlist, so the attacker could send the code to an outside site.
- Client-controlled exchange URI. The Android app's login request let the client set the result URI used for the exchange, so the attacker could satisfy Facebook's requirement to repeat the original redirect URI.
- Email-based account linking. Booking matched the Facebook email to an existing account, so every login method was as weak as the weakest one.
Each gap was minor on its own: the origin check was too loose, the state parameter had no allowlist, and the exchange URI was client-supplied. The write-up does not describe the server-side code, so the exact implementation is not shown.
Impact
The attacker got the victim's session: personal data, booking history, reservations, and the power to act as them, including cancelling bookings. The login also worked on Kayak. Accounts created with Google were exposed too, because Booking matched the Facebook email to the existing account. The victim only clicked a trusted-domain link.
The write-up does not report a severity rating or a bounty.
Fix
Booking.com fixed the issues within weeks of the December 2022 report. The author's own recommendations are:
- Register exact redirect URIs. Origin matching turns any redirect into a leak.
- Keep the exchange redirect URI on the server, for web and mobile alike.
- Allowlist post-login destinations as relative paths, never inside a client-editable state blob.
- Bind codes to the starting session with single-use state and PKCE where supported.
The author includes this illustrative code:
REDIRECT_URI = "https://account.example.com/oauth/callback/facebook" def finish_login(session, request): expected = session.pop("oauth_state", None) verifier = session.pop("pkce_verifier", None) if expected is None or not constant_time_eq(request.state, expected): return error(400, "invalid_state") tokens = idp_exchange(code=request.code, redirect_uri=REDIRECT_URI, code_verifier=verifier) return login_as(verified_identity(tokens))def safe_next(path): ok = path.startswith("/") and not path.startswith("//") and "\\" not in path return path if ok else "/"
Variants to test
- Origin-only redirect registration. Check whether the identity provider accepts any path on the registered domain. A positive result is a redirect to an arbitrary path on that domain being accepted.
- Open redirect via state. Look for flows that read a next destination from a client-editable state parameter without an allowlist. A positive result is the flow redirecting to an outside site.
- Fragment response mode. Check whether the authorization server supports a response mode that places the code in the URL fragment. A positive result is the code appearing in the fragment of the redirect.
- Client-supplied exchange URI. Inspect mobile login requests for a result URI that the backend uses for the exchange. A positive result is the backend accepting a URI the client supplied.
- Email-based account linking. Check whether accounts are linked by email across login methods. A positive result is a weaker login method granting access to an account created with a stronger one.
Key takeaways
- Three "low" OAuth findings made one critical.
- Mobile clients are OAuth attack surface; review what their requests let a user set.
- Linking accounts by email makes every login method as weak as the weakest.
The research is credited to Aviad Carmel (Salt Labs, Salt Security), published as "Traveling with OAuth: Account Takeover on Booking.com" on 2 March 2023, including Booking.com's statement. The report date comes from SecurityWeek.
What happened, in plain words
Booking.com is a website where people book hotels, flights and holidays. It also owns Kayak, another travel search site. Both sites let you sign in with your Facebook account instead of creating a separate password. That kind of sign-in is called OAuth, and this article is about how three small mistakes in that sign-in process could be joined together so that an attacker could take over someone's Booking.com account, and the linked Kayak account too.
The research was done by Aviad Carmel of Salt Labs (part of Salt Security). The case study you are reading is an analysis of that public disclosure, not the author's own discovery. The issues were reported in December 2022 and fixed within weeks, before the research was published on 2 March 2023. The report date comes from SecurityWeek.

The illustration above is AI-generated and accompanies the article.
Each of the three gaps looked minor on its own. None of them would have been enough by itself. Chained together, they produced a one-click account takeover: the victim clicks one link on a legitimate facebook.com address, and the attacker ends up logged in as the victim. The author maps the issues to three standard weakness categories, CWE-601 (URL Redirection to Untrusted Site), CWE-346 (Origin Validation Error) and CWE-472 (External Control of Assumed-Immutable Web Parameter), and notes that this mapping is analytical and not from the source. There is no CVE because the target is a hosted service rather than a piece of software with version numbers. Severity and bounty are not reported.
Before going further, a few everyday comparisons will help.
- OAuth is like a cloakroom ticket. You do not hand the cloakroom your house keys; you show a ticket and they fetch your coat. With "Log in with Facebook", Booking.com never sees your Facebook password. Facebook gives Booking.com a short-lived ticket, called an authorization code, and Booking.com swaps that ticket for proof of who you are.
- An API is the counter where two computer programs talk to each other. When Booking.com's website asks Facebook "is this ticket valid?", it does so through an API, a set of addresses and rules for machine-to-machine requests.
- A token or session cookie is the wristband you get after signing in. Your browser stores it and shows it on every later request, so the site knows it is still you. Whoever holds the wristband is treated as you.
- A redirect is a forwarding instruction. A web server can answer a request with "not here, go to this other address instead", and the browser follows it automatically.
- A redirect URI is the return address you give when you start an OAuth login: "when you are done, send the ticket back to this address".
- An open redirect is a forwarding instruction where the destination is taken from something the user can edit. It is like a receptionist who will forward your parcel to any address a stranger writes on a form.
Setup
The write-up does not describe a lab setup, tooling or versions. What it does state are the preconditions:
- A victim account that uses "Log in with Facebook" on Booking.com, plus its linked Kayak login.
- One link on a legitimate
facebook.comURL was enough to trigger the chain.
Accounts created with Google were also exposed, because Booking matched the Facebook email to the existing account. In other words, if you had signed up with Google but later used the Facebook button with the same email address, the two were treated as one account, and the weaker path opened the stronger one.
Finding it
The write-up presents three minor-looking gaps that, individually, would not be enough. The write-up presents them at a high level rather than with captured requests.
Gap one: redirects registered by origin, not path. Facebook only enforced that the code returned to Booking's account domain. Any path on that domain was accepted. Think of a building: Facebook checked that the courier delivered to the right building, but not to the right office inside it. Every office in that building could receive the parcel.
Gap two: an open redirect on that domain. A settings flow read its next destination from inside its state parameter, with no allowlist. The state parameter is a value the login flow carries along from step to step, like a note pinned to a form saying where to go next. If the note is written by the browser rather than the server, the visitor can rewrite it. If the OAuth redirect is aimed at that flow, and a response mode is requested that puts the code in the URL fragment, the browser carries the victim's code to an outside site. The URL fragment is the part of a web address after the # sign; browsers keep it out of normal server requests, but scripts on the page can read it.
Gap three: the client chose the exchange URI. A stolen code alone failed, because Facebook requires the exchange to repeat the original redirect URI, and the website sent a fixed one. The Android app's login request, however, carried a result URI that the backend used for the exchange. Supplying the malicious link's URI made Facebook accept the code. The exchange is the moment the ticket is swapped for the wristband. Facebook checks that the swap happens at the same address the ticket was issued for, so the attacker had to make the swap look like it came from the malicious address.
Exploitation
The write-up intentionally omits reproduction details. What follows is the chain as described, without the concrete endpoints, parameters or payloads, which the source does not publish.
Step 1: aim the OAuth redirect at the open redirect
Because Facebook accepted any path on Booking's account domain, the attacker could point the OAuth redirect at the settings flow that reads its next destination from its state parameter. The settings flow reads its next destination from its state parameter with no allowlist, so the attacker can set the next destination to an outside site. This step matters because it turns a legitimate return address into a springboard: the ticket lands on Booking's own domain, as Facebook requires, but that page immediately forwards it wherever the attacker wrote in the note.
Step 2: request a fragment response mode
The attacker requests a response mode that places the authorization code in the URL fragment. The browser then carries the victim's code to the outside site when the settings flow redirects there. The fragment is chosen because it travels with the browser's address bar rather than being sent to the server as a normal request, so the code reaches the attacker's site without needing to be logged anywhere in between.
Step 3: exchange the code with a client-supplied URI
A stolen code alone is not enough: Facebook requires the exchange to repeat the original redirect URI, and the website sends a fixed one. The Android app's login request carries a result URI that the backend uses for the exchange. By supplying the malicious link's URI, the attacker makes Facebook accept the code and complete the exchange. The lesson here is that a mobile app is not a sealed box: its requests can be inspected and altered, and anything the app is allowed to set, an attacker can set too.
Step 4: use the session
With the exchange complete, the attacker holds the victim's session. The login also worked on Kayak, and accounts created with Google were exposed because Booking matched the Facebook email to the existing account. The victim never typed a password anywhere; they clicked a link that looked like it belonged to a trusted domain.
Root cause
The design mistakes are:
- Origin-only redirect registration. Facebook enforced only the account domain, so any path there was a valid redirect target. This turns any redirect on that domain into a code leak.
- Open redirect driven by client-editable state. The settings flow read its next destination from inside its state parameter with no allowlist, so the attacker could send the code to an outside site.
- Client-controlled exchange URI. The Android app's login request let the client set the result URI used for the exchange, so the attacker could satisfy Facebook's requirement to repeat the original redirect URI.
- Email-based account linking. Booking matched the Facebook email to an existing account, so every login method was as weak as the weakest one.
Each gap was minor on its own: the origin check was too loose, the state parameter had no allowlist, and the exchange URI was client-supplied. The write-up does not describe the server-side code, so the exact implementation is not shown.
Impact
The attacker got the victim's session: personal data, booking history, reservations, and the power to act as them, including cancelling bookings. The login also worked on Kayak. Accounts created with Google were exposed too, because Booking matched the Facebook email to the existing account. The victim only clicked a trusted-domain link.
The write-up does not report a severity rating or a bounty.
Fix
Booking.com fixed the issues within weeks of the December 2022 report. The author's own recommendations are:
- Register exact redirect URIs. Origin matching turns any redirect into a leak.
- Keep the exchange redirect URI on the server, for web and mobile alike.
- Allowlist post-login destinations as relative paths, never inside a client-editable state blob.
- Bind codes to the starting session with single-use state and PKCE where supported. PKCE is an extra check where the app proves it is the same app that started the login, using a secret it keeps to itself.
The author includes this illustrative code:
REDIRECT_URI = "https://account.example.com/oauth/callback/facebook" def finish_login(session, request): expected = session.pop("oauth_state", None) verifier = session.pop("pkce_verifier", None) if expected is None or not constant_time_eq(request.state, expected): return error(400, "invalid_state") tokens = idp_exchange(code=request.code, redirect_uri=REDIRECT_URI, code_verifier=verifier) return login_as(verified_identity(tokens))def safe_next(path): ok = path.startswith("/") and not path.startswith("//") and "\\" not in path return path if ok else "/"
Line by line, in plain words:
REDIRECT_URI = "https://account.example.com/oauth/callback/facebook"fixes the one exact return address on the server. It is not read from the browser, so nobody can swap it.def finish_login(session, request):starts the function that completes a login, given the user's session and the incoming request.expected = session.pop("oauth_state", None)takes the state value that was stored on the server when the login began, and removes it so it can only be used once. If there is none, the result isNone.verifier = session.pop("pkce_verifier", None)does the same for the PKCE secret, again single use.if expected is None or not constant_time_eq(request.state, expected):checks that a stored state existed and that the state coming back matches it.constant_time_eqcompares without leaking timing information, so an attacker cannot guess the value by measuring how long the comparison takes.return error(400, "invalid_state")refuses the login when the check fails.tokens = idp_exchange(code=request.code,starts the swap of the ticket for tokens, using the code from the request.redirect_uri=REDIRECT_URI,sends the fixed server-side address, not one supplied by the client.code_verifier=verifierproves the same app that started the login is finishing it.return login_as(verified_identity(tokens))logs the user in once the identity behind the tokens has been verified.def safe_next(path):begins a helper that decides whether a post-login destination is safe.ok = path.startswith("/") and not path.startswith("//") and "\\" not in pathaccepts only paths that start with a single slash, and rejects ones starting with a double slash or containing a backslash, which are common tricks for escaping to another site.return path if ok else "/"returns the requested path when it is safe, and the site's home page otherwise.
Variants to test
- Origin-only redirect registration. Check whether the identity provider accepts any path on the registered domain. A positive result is a redirect to an arbitrary path on that domain being accepted.
- Open redirect via state. Look for flows that read a next destination from a client-editable state parameter without an allowlist. A positive result is the flow redirecting to an outside site.
- Fragment response mode. Check whether the authorization server supports a response mode that places the code in the URL fragment. A positive result is the code appearing in the fragment of the redirect.
- Client-supplied exchange URI. Inspect mobile login requests for a result URI that the backend uses for the exchange. A positive result is the backend accepting a URI the client supplied.
- Email-based account linking. Check whether accounts are linked by email across login methods. A positive result is a weaker login method granting access to an account created with a stronger one.
Key takeaways
- Three "low" OAuth findings made one critical.
- Mobile clients are OAuth attack surface; review what their requests let a user set.
- Linking accounts by email makes every login method as weak as the weakest.
The research is credited to Aviad Carmel (Salt Labs, Salt Security), published as "Traveling with OAuth: Account Takeover on Booking.com" on 2 March 2023, including Booking.com's statement. The report date comes from SecurityWeek.
Glossary
- OAuth: a way for one website to let you sign in through another account, such as Facebook, without sharing your password with the first site.
- Authorization code: the short-lived ticket Facebook hands back after you approve a login, which the website swaps for proof of identity.
- API: a set of addresses and rules that lets two programs talk to each other.
- Token: a value that proves who you are or what you are allowed to do, shown on requests after you sign in.
- Session cookie: the browser-stored value that keeps you logged in between page loads.
- Session: the logged-in state tied to that cookie; whoever holds it is treated as you.
- Redirect: a server instruction telling the browser to go to a different address.
- Redirect URI: the return address given at the start of an OAuth login, where the ticket should be sent.
- Open redirect: a redirect whose destination comes from user-editable input, so it can be pointed at an outside site.
- Origin: the combination of scheme, host and port that identifies a site, for example
https://account.example.com. - Path: the part of a web address after the domain, such as
/settings. - State parameter: a value carried through a login flow from step to step, often holding where to go next; if the browser can edit it, an attacker can rewrite it.
- Allowlist: a fixed list of permitted values; anything not on the list is refused.
- Response mode: the setting that decides how the authorization code is returned, for example in the query string or in the URL fragment.
- URL fragment: the part of a web address after the
#sign, which browsers keep out of normal server requests but scripts can read. - Exchange: the step where the website swaps the authorization code for tokens, proving the login is genuine.
- Client: the program making the request, such as a browser or a mobile app.
- Backend: the server-side software that does the real work behind a website or app.
- Account takeover: an attack where someone else gains control of your account.
- CWE: a catalogue of common software weakness types, used to label findings.
- CVE: an identifier for a publicly known vulnerability in a specific product; hosted services usually do not get one.
- PKCE: an extra OAuth protection where the app proves it is the same app that started the login, using a secret it keeps to itself.
- Constant-time comparison: comparing two values in a way that takes the same time regardless of where they differ, so timing cannot be used to guess them.
- Hosted service: software run by a company for its users, rather than installed by customers, so there is no version for a CVE to point at.