Applying a small bypass to steal Facebook Session tokens in Uber
An XSS vulnerability was found in Uber's search endpoint due to insufficient filtering of angle brackets and the word 'script', which could be bypassed using HTML encoding and mixed case. Combined with a misconfigured Facebook login flow, an attacker could steal a victim's Facebook token and hijack their Uber session.
It was a Saturday at 2:00 AM, and I was with a friend looking for some security flaws to report on a private show. After searching several things we could not detect anything (the scope was small and the sites mostly static).
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
Uber runs a public blog on www.uber.com, and the Spanish (Chile) edition of that blog has a search feature at the following endpoint:
https://www.uber.com/es-CL/blog/santiago/search/
Through this endpoint a user can search for information on the blog. The site itself is static: the business logic, user sessions and authentication live on a separate host, auth.uber.com. That split matters later, because the XSS lands on the static host while the sensitive session material sits on the authentication host.
Uber also allows login with Facebook, which is the second ingredient of the attack: any site that offers Facebook login and has a poorly implemented integration can be affected if an XSS exists on it.
Setup
No special accounts, roles or tooling are described. The researcher was browsing the Uber scope and testing the search endpoint by hand, injecting vectors and watching how the front end and the DOM behaved. The later exploitation work was done together with a friend, Stefano (@stefanohablando), who pointed out the mechanism for tunnelling the XSS into a Facebook token extraction.
The preconditions for the full attack, as the report lays them out, are:
- A reflected XSS on
www.uber.comthat survives the site's input filtering. - A Facebook login integration on Uber that lets JavaScript on the page call the Facebook SDK to obtain a token, i.e. an inadequate ACL on
auth.uber.com. - A Content Security Policy on
www.uber.comthat does not block the call to JavaScript code. - A victim who is authenticated with Facebook.
Finding it
The endpoint was found by chance while looking for an information search in Santiago de Chile. The first attempt was a plain XSS vector, which did not succeed.

The researcher then tried multiple obfuscated HTML characters and analysed the behaviour of the front end and the DOM. Two observations came out of that:
- It was possible to inject the smaller-than and greater-than characters.
- When a slash was placed, the vector was revoked, and if the vector contained the word
script, that was deleted as well.
So the filter blocked two things: the slash character and the literal string script.
Exploitation
Step 1: bypass the filter
The bypass was simple: obtain the slash character through its HTML encoding, %2f, and write script with mixed lower and upper case so the literal string match fails.
The resulting payload was:
<%fscripT><script>confirm(document.domain)<%2fscripT>
The slash was supplied as %2f and script was written with mixed lower and upper case, which got the payload past the filter. The XSS was then exploited correctly, and confirm(document.domain) fired.

Step 2: check the Facebook integration
A couple of days later, at the h1-702 Bug Bounty event, Stefano explained that there was a mechanism to tunnel the XSS so that a Facebook session token could be obtained from an Uber user's account, and from that the user's session. The reasoning is that Uber allows login with Facebook, and any website with this mechanism poorly implemented could be affected if an XSS vulnerability exists.
The procedure requires a JavaScript call to a Facebook functionality that lets a user extract the token. Before that, it had to be checked whether Uber had that inappropriate configuration. This check matters because www.uber.com is static, while the business logic and user sessions are on auth.uber.com.
The Facebook functionality used for the token extraction is documented in the Facebook Developers quickstart:
https://developers.facebook.com/docs/javascript/quickstart/

With that JavaScript code, if Uber allowed it, the Facebook token extraction from an Uber account could be performed. The same small slash bypass and mixed-case script trick had to be applied to execute it successfully.
Step 3: confirm the two conditions
After several tests, two things were established:
- Uber did not have an adequate ACL, since it was possible to make the call of the Facebook token contained in
auth.uber.com. - The CSP was not implemented correctly in
www.uber.com, therefore it was possible to make the call to JavaScript code.
Step 4: build the exploit
When all the conditions above were met, an exploit was created. It works by sending a malicious link to a victim who is authenticated with Facebook. The link triggers the XSS, which obtains that user's Facebook token. With the token, the valid user session is established, and finally the user's mail is obtained and the UUID is sent to that mail as proof of concept.
In doing all this, the victim would get something like the following:

Root cause
The XSS comes from the search endpoint and an incomplete filter. The filter removed the slash character and the literal string script, but %2f and mixed case got past it. The report does not describe the server-side code, so the exact implementation is not shown.
The escalation to a session compromise comes from two configuration mistakes on Uber's side, as the report states them: an inadequate ACL that allowed the Facebook token call to be made from auth.uber.com, and a CSP on www.uber.com that was not implemented correctly and therefore did not stop the JavaScript call. The report does not give the CSP directives or the ACL rules involved.
Impact
An attacker who can get a victim authenticated with Facebook to open a crafted link can obtain that user's Facebook token, establish the valid user session, and obtain the user's mail. The proof of concept stopped at sending the UUID to the victim's mail.
Fix
What the findings imply should be fixed is the input filter on the search endpoint (normalise encodings and match case-insensitively, or better, encode output contextually), the ACL that permits the Facebook token call from auth.uber.com, and the CSP on www.uber.com.
Variants to test
- Encoding-based filter bypass. On any reflected parameter, try HTML-encoded and double-encoded special characters such as
%2f,%3c,%3ein place of the literal characters. A positive result is the browser interpreting the decoded characters as markup rather than text. - Case-mixed keyword bypass. Where a blacklist removes a keyword such as
script, try mixed case (fscripT,ScRiPt). A positive result is the keyword surviving the filter and executing. - Facebook token extraction via SDK. On sites offering Facebook login, check whether page JavaScript can call the Facebook SDK to retrieve a token for the logged-in user. A positive result is a token returned to the page's own script.
- CSP coverage check. After finding an XSS, check whether the CSP actually blocks inline or external script execution. A positive result is the payload executing despite the policy.
- Cross-host trust. Where authentication lives on a separate host from the static site, test whether the static host's XSS can reach the authentication host's token endpoints. A positive result is a token call succeeding from the compromised origin.
What happened, in plain words
A security researcher was spending a late Saturday night looking for bugs on a private bug bounty programme. A bug bounty programme is an arrangement where a company pays people to find security problems in its systems and report them privately, instead of those problems being used against the company. After finding nothing on the small programme, he switched to Uber's programme, which has a much larger scope. Scope means the list of websites and systems a researcher is allowed to test.
By chance he landed on a search page on Uber's public blog, the Spanish (Chile) edition. That page lets a visitor type a search term and returns results. He tried to inject a small piece of code into the search box, a common test called an XSS vector, and it did not work. XSS, short for Cross-Site Scripting, is a vulnerability where a website takes something a user typed and puts it into the page in a way that makes the browser treat it as code rather than as plain text. If that happens, an attacker can make the victim's browser run the attacker's code on the victim's behalf.
He kept testing with different encoded characters and watched how the page behaved. He found that the site blocked two things: the slash character / and the literal word script. He then found a simple way around both: write the slash as its HTML encoding %2f, and write script with mixed upper and lower case. The payload worked, and the browser ran his code.
A few days later, at a bug bounty event, a friend explained a way to turn that XSS into something much more serious: stealing a Facebook session token from an Uber user's account. Uber lets people log in with Facebook, and if that login integration is set up loosely, a page with an XSS can ask Facebook for the logged-in user's token. A token is a short piece of text that proves who you are, a bit like a cloakroom ticket: whoever holds it can collect the coat. With the token, the attacker can act as the victim.
The researcher checked two things: whether Uber's authentication host would let the page make that Facebook token call, and whether the site's Content Security Policy would block the JavaScript. A Content Security Policy, or CSP, is a set of rules a website sends to the browser saying which scripts are allowed to run. Both checks came back in the attacker's favour. He then built a full exploit: a malicious link that, when opened by a victim logged in with Facebook, grabs the token, establishes the victim's session, reads the victim's email address, and sends a UUID to that email as proof. A UUID is a long random-looking identifier used to label something uniquely.
The search page
Uber runs a public blog on www.uber.com. The Spanish (Chile) edition of that blog has a search feature at this address:
https://www.uber.com/es-CL/blog/santiago/search/
Reading that address from left to right: https is the secure version of the protocol browsers use to fetch pages; www.uber.com is the site; es-CL says the page is in Spanish for Chile; blog/santiago points at the Santiago blog section; and search/ is the search feature itself. When you type a term into the search box and submit, the term travels to this address and the page shows results.
One detail matters a lot later. The blog site itself is static, meaning the pages are fixed files served as they are, with no server-side logic deciding what to show per user. The business logic, the user sessions and the authentication live on a different host, auth.uber.com. A host is one named machine on the internet, and different hosts can have different rules and different security settings. So the XSS lands on the static blog host, while the sensitive session material sits on the authentication host. That split matters because the XSS lands on the static blog host while the session material sits on the authentication host.
Uber also allows login with Facebook. That is the second ingredient: any site that offers Facebook login and has a poorly implemented integration can be affected if an XSS exists on it.
Setting up
The report describes no special accounts, roles or tools. The researcher was browsing the Uber scope and testing the search endpoint by hand, injecting vectors and watching how the front end and the DOM behaved. The DOM, or Document Object Model, is the browser's in-memory model of the page: the tree of elements the browser builds from the HTML, which scripts can read and change. Watching the DOM tells you whether your input became part of the page's structure or stayed as harmless text.
The later exploitation work was done together with a friend, Stefano (@stefanohablando), who pointed out the mechanism for tunnelling the XSS into a Facebook token extraction. Tunnelling here means using the XSS as a stepping stone to reach something else, in this case the Facebook login machinery.
The full attack needs four things to line up, as the report lays them out:
- A reflected XSS on
www.uber.comthat survives the site's input filtering. Reflected means the malicious input is echoed straight back in the response to the same request, rather than being stored on the server for later visitors. - A Facebook login integration on Uber that lets JavaScript on the page call the Facebook SDK to obtain a token, which the report describes as an inadequate ACL on
auth.uber.com. An ACL, or Access Control List, is the set of rules saying who or what is allowed to do something. An SDK, or Software Development Kit, is a bundle of ready-made code a site can load to talk to another service, here Facebook. - A Content Security Policy on
www.uber.comthat does not block the call to JavaScript code. - A victim who is authenticated with Facebook, meaning logged in.
Finding it
The endpoint was found by chance while looking for an information search in Santiago de Chile. The first attempt was a plain XSS vector, which did not succeed.

The researcher then tried multiple obfuscated HTML characters and analysed the behaviour of the front end and the DOM. Obfuscated here means written in an unusual encoded form, so that a filter looking for the plain characters does not recognise them. Two observations came out of that:
- It was possible to inject the smaller-than and greater-than characters,
<and>. Those two characters are how HTML marks the start and end of a tag, so being able to inject them is the first half of getting markup into a page. - When a slash was placed, the vector was revoked, and if the vector contained the word
script, that was deleted as well. A closing tag needs a slash, as in</script>, and the tag name itself isscript, so the filter was targeting exactly the two pieces needed to close a script tag.
So the filter blocked two things: the slash character and the literal string script. That is a blacklist approach: instead of defining what is allowed, it lists what is forbidden. Blacklists are fragile because there is usually another way to write the same thing.
Exploitation
Step 1: bypass the filter
The bypass was simple: obtain the slash character through its HTML encoding, %2f, and write script with mixed lower and upper case so the literal string match fails. %2f is the percent-encoding of the slash character; percent-encoding is how special characters are written in URLs and in HTML so they can travel safely. The filter blocked the slash character and the word script, and neither appeared in the form it was watching for.
The resulting payload was:
<%fscripT><script>confirm(document.domain)<%2fscripT>
Line by line, in plain words:
- The filter, which matched the literal characters, saw neither a slash nor the lowercase word
script. confirm(document.domain)is the JavaScript that runs.document.domainasks the browser for the domain of the current page, andconfirm(...)shows that value in a pop-up box with an OK button. It is a harmless way to prove code execution: if the box appears, your code ran.
The %2f supplies the closing slash without the filter seeing a slash character, and the mixed-case fscripT avoids the deletion of the word script. The XSS was then exploited correctly, and confirm(document.domain) fired.

Step 2: check the Facebook integration
A couple of days later, at the h1-702 Bug Bounty event, Stefano explained that there was a mechanism to tunnel the XSS so that a Facebook session token could be obtained from an Uber user's account, and from that the user's session. The reasoning is that Uber allows login with Facebook, and any website with this mechanism poorly implemented could be affected if an XSS vulnerability exists.
The procedure requires a JavaScript call to a Facebook functionality that lets a user extract the token. Before that, it had to be checked whether Uber had that inappropriate configuration. This check matters because www.uber.com is static, while the business logic and user sessions are on auth.uber.com. In other words, the page with the XSS is not the page that holds the session, so the question is whether the session host will still answer a token request coming from the blog host.
The Facebook functionality used for the token extraction is documented in the Facebook Developers quickstart:
https://developers.facebook.com/docs/javascript/quickstart/
That address is Facebook's own documentation page for its JavaScript SDK. The researcher did not need to invent anything: the SDK is designed so that a website can ask Facebook, on behalf of the visitor, for information about that visitor's Facebook login. The danger is that if the integration is poorly implemented, a page with an XSS can make the same request.

With that JavaScript code, if Uber allowed it, the Facebook token extraction from an Uber account could be performed. The same small slash bypass and mixed-case script trick had to be applied to execute it successfully, because the payload still had to get past the same filter on the same search page.
Step 3: confirm the two conditions
After several tests, two things were established:
- Uber did not have an adequate ACL, since it was possible to make the call of the Facebook token contained in
auth.uber.com. In plain terms, the authentication host accepted the token request even though it came from a page that should not have been trusted to make it. - The CSP was not implemented correctly in
www.uber.com, therefore it was possible to make the call to JavaScript code. The policy that should have stopped the injected script from running, or from reaching out to Facebook, did not do its job.
Both conditions had to hold at once. The XSS gives code execution on a static blog page, and the inadequate ACL and incorrect CSP were the other conditions the exploit needed.
Step 4: build the exploit
When all the conditions above were met, an exploit was created. An exploit is the finished, working attack, packaged so it can be delivered to a target. It works by sending a malicious link to a victim who is authenticated with Facebook. The link triggers the XSS, which obtains that user's Facebook token. With the token, the valid user session is established, and finally the user's mail is obtained and the UUID is sent to that mail as proof of concept. A proof of concept is a demonstration that the attack works, kept as harmless as possible: here it stops at emailing an identifier rather than doing anything destructive.
In doing all this, the victim would get something like the following:

Why the filter failed
The XSS itself comes from the search endpoint reflecting input into the page with an incomplete filter. The filter removed the slash character and the literal string script, but %2f and mixed case got past it. The report does not describe the server-side code, so the exact implementation is not shown.
The escalation to a session compromise comes from two configuration mistakes on Uber's side, as the report states them: an inadequate ACL that allowed the Facebook token call to be made from auth.uber.com, and a CSP on www.uber.com that was not implemented correctly and therefore did not stop the JavaScript call. The report does not give the CSP directives or the ACL rules involved.
What an attacker could do
An attacker who can get a victim authenticated with Facebook to open a crafted link can obtain that user's Facebook token, establish the valid user session, and obtain the user's mail. The proof of concept stopped at sending the UUID to the victim's mail.
What should be fixed
What the findings imply should be fixed is the input filter on the search endpoint (normalise encodings and match case-insensitively, or better, encode output contextually), the ACL that permits the Facebook token call from auth.uber.com, and the CSP on www.uber.com.
Things to try on other sites
- Encoding-based filter bypass. On any reflected parameter, try HTML-encoded and double-encoded special characters such as
%2f,%3c,%3ein place of the literal characters. A positive result is the browser interpreting the decoded characters as markup rather than text. - Case-mixed keyword bypass. Where a blacklist removes a keyword such as
script, try mixed case (fscripT,ScRiPt). A positive result is the keyword surviving the filter and executing. - Facebook token extraction via SDK. On sites offering Facebook login, check whether page JavaScript can call the Facebook SDK to retrieve a token for the logged-in user. A positive result is a token returned to the page's own script.
- CSP coverage check. After finding an XSS, check whether the CSP actually blocks inline or external script execution. A positive result is the payload executing despite the policy.
- Cross-host trust. Where authentication lives on a separate host from the static site, test whether the static host's XSS can reach the authentication host's token endpoints. A positive result is a token call succeeding from the compromised origin.
Glossary
- Bug bounty programme: an arrangement where a company pays researchers to find and privately report security problems in its systems.
- Scope: the list of websites and systems a researcher is allowed to test.
- XSS (Cross-Site Scripting): a vulnerability where a site puts user input into a page in a way that makes the browser run it as code.
- Reflected XSS: XSS where the malicious input is echoed back in the response to the same request, rather than stored on the server.
- Vector: the specific piece of input used to attempt an attack, such as a test string in a search box.
- Payload: the part of the input that actually performs the action once it is interpreted.
- HTML encoding / percent-encoding: a way of writing special characters using codes, such as
%2ffor the slash, so they can travel safely in URLs and HTML. - Obfuscation: writing something in an unusual encoded or disguised form so a filter does not recognise it.
- Blacklist filter: a filter that lists forbidden characters or words instead of defining what is allowed.
- Tag: the markup in HTML that marks the start or end of an element, written between
<and>. - DOM (Document Object Model): the browser's in-memory tree of the page, which scripts can read and change.
- Front end: the part of a website that runs in the browser, as opposed to the server.
- Static site: a site made of fixed files served as they are, with no per-user server-side logic.
- Host: one named machine on the internet, such as
www.uber.comorauth.uber.com. - Session: the state that keeps you logged in as you move between pages.
- Token: a short piece of text that proves who you are, like a cloakroom ticket; whoever holds it can act as you.
- Authentication: the process of proving who you are, usually by logging in.
- Facebook SDK: a bundle of ready-made JavaScript from Facebook that a site loads to talk to Facebook, including asking for a user's token.
- ACL (Access Control List): the rules saying who or what is allowed to do something.
- CSP (Content Security Policy): rules a site sends to the browser saying which scripts are allowed to run.
- Exploit: the finished, working attack, packaged so it can be delivered to a target.
- Proof of concept: a demonstration that an attack works, kept as harmless as possible.
- UUID: a long random-looking identifier used to label something uniquely.
- h1-702: the bug bounty event where the researcher learned the token extraction mechanism.