How I found RXSS in Facebook, Twitter and Google training academy
The error_description parameter in the Facebook callback endpoint was not sanitised, allowing an attacker to inject JavaScript and execute it in a victim's browser. This could let an attacker steal cookies and obtain the access_token used for authentication on training websites using the Intellum service.
Published on blog.flawminers.com
On December 23, 2019, I received an email from Facebook Workplace introducing the ‘New Workplace Academy,’ which directed me to the domain ‘https://training.wplearn.com.’ While investigating this domain, I discovered it utilized a third-party service called ‘Intellum.’ During my testing, I identified a reflected XSS…
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
On 23 December 2019 the author received an email from Facebook Workplace announcing the "New Workplace Academy", which pointed at https://training.wplearn.com. Looking at that host, the author found it was built on a third-party learning platform, Intellum. Testing the login flow of the site turned up a reflected XSS in the login functionality.
From there the author used Google dorking to find other organisations running the same Intellum service. Twitter and Google both appeared, and so did Facebook Blueprint, part of the Facebook ecosystem. The author's reproduction steps list the Facebook Blueprint, Workplace training, Twitter Flight School and Google retail training domains.
Setup
No special tooling is described beyond a browser and an intercepting proxy, which the author used while logging into Facebook Blueprint to capture the authentication request. The precondition is simply reaching the Facebook login flow that the training sites use: the vulnerable parameter lives in the OAuth-style callback URL that the site hands to Facebook and that Facebook redirects back to.
Finding it
While logging into Facebook Blueprint and intercepting the request, the author observed this endpoint:
GET/login.php?skip_api_login=1&api_key=xxx&...etc&cancel_url=https://www.facebookblueprint.com/authentication/fb_callback?error=access_denied&error_code=200&error_description=Permissionserror&error_reason=user_denied&state=xxxx#_=_&display=page&locale=en_US&pl_dbl=0
The interesting part is the cancel_url value. It points at the site's own /authentication/fb_callback path and carries the parameters Facebook appends when a user declines the permission dialog: error=access_denied, error_code=200, error_description, error_reason=user_denied and state. The author found no sanitisation applied to the error_description parameter. That made it possible to inject a JavaScript payload and trigger reflected XSS.
Exploitation
Step 1: identify the reflected parameter
The callback URL contains error_description=Permissionserror, and the author found no sanitisation applied to it.
Step 2: inject the payload into the callback
The author's reproduction steps replace the value with a payload placeholder on each affected host:
https://www.facebookblueprint.com/authentication/fb_callback?error=access_denied&error_code=200&error_description={{Inject_your_payload_here}}
https://training.wplearn.com/authentication/fb_callback?error=access_denied&error_code=200&error_description={{Inject_your_payload_here}}
https://www.twitterflightschool.com/authentication/fb_callback?error=access_denied&error_code=200&error_description={{Inject_your_payload_here}}
https://googleretailtraining.exceedlms.com/authentication/fb_callback?error=access_denied&error_code=200&error_description={{Inject_your_payload_here}}
Each URL keeps the error=access_denied and error_code=200 parameters that the callback expects and puts the script in error_description. The report does not include the specific payload string used.
Step 3: reach the callback through the login flow
The parameter is part of the cancel_url passed to Facebook's login endpoint, so the callback is normally reached when the user denies the permission request. The callback is normally reached when the user denies the permission request.
Root cause
The callback handler at /authentication/fb_callback reflects the error_description query parameter into the page without sanitisation. Because the value is attacker-controlled through the URL, and the URL can be embedded in the cancel_url of the login request, the reflection is reachable by anyone who can get a victim to follow a link. The report describes this as a zero-day in the Intellum service itself, so the mistake is in the shared platform code rather than in each customer's site.
Impact
The author states that exploiting the flaw could potentially let an attacker steal user cookies and obtain the access_token used for authentication on training websites that use Intellum. The author states the flaw could potentially let an attacker steal cookies and obtain the access_token used on training websites using Intellum. The report hedges this as a potential outcome ("could potentially enable"), and does not demonstrate cookie or token theft in the text.
Fix
The report does not describe the code change. It records that Meta triaged the report on 8 January 2020, marked it successfully fixed on 13 January 2020, and that the author confirmed the fix the same day; a bounty was awarded on 26 February 2020. The author notes that no response was received to the notification about the underlying Intellum issue and that no CVE was issued. Despite Twitter's domain being ineligible, their team decided to reward the report (HackerOne report 770349). Google clarified that the discovered domains did not belong to them, resulting in no reward.
Variants to test
The author's own takeaway is to always check error_description= parameters for XSS. The dorks used to find other Intellum customers were:
inurl:/student/catalog "Facebook"
inurl:/student/catalog "Twitter"
inurl:/student/catalog "Google"
Concrete things to try on other targets:
- Swap the vendor name in the dork for other organisations and look for hosts on the same learning platform;
- On any OAuth or SSO callback, put a test string in
error_descriptionand see whether it comes back unencoded in the response body.
What happened, in plain words
In December 2019 the author got an email from Facebook Workplace about a new "Workplace Academy", and the email linked to https://training.wplearn.com. When the author looked at that site, it turned out not to be built by Facebook at all: it ran on a learning platform made by a company called Intellum. Many organisations rent this kind of platform instead of building their own training site, the same way a restaurant might rent a booking system rather than write one.
While testing how the login on that site worked, the author found a bug called reflected XSS. In plain words: a page on the site took a piece of text from the address bar (the URL) and pasted it straight into the page it showed back, without cleaning it. If that text is a small script, the browser runs it as if the site itself had written it. That is the whole idea of reflected XSS: your input bounces off the server and comes back as code.
Then the author searched the web with Google for other organisations using the same Intellum platform. Twitter and Google showed up, and so did Facebook Blueprint, another Facebook training product. The author's reproduction steps list all of them, and the report describes the bug as a zero-day in the Intellum service.
The pieces you need to know first
Before the steps make sense, a few everyday ideas:
- A URL and its query string. A URL like
https://example.com/page?name=Samhas two parts: the address of the page, and after the?a list of name=value pairs called parameters. The server reads those pairs to decide what to show. Anything in them comes from whoever typed the link, so it is untrusted. - A cookie. A small piece of data a website asks your browser to store and send back on every request, so the site can remember who you are. If someone else gets your cookie, they can often act as you.
- A token (here, an
access_token). A long string that acts like a temporary key or wristband: the site gives it to you after login and checks it on later requests instead of asking for your password again. Stealing it is like stealing the wristband. - OAuth / "Log in with Facebook". A way for one site to let Facebook handle the login. The training site sends your browser to Facebook, you approve or deny, and Facebook sends you back to the training site with a result. That return trip is called a callback.
- An intercepting proxy. A tool that sits between your browser and the website and lets you pause and read each request and response. It is like a mail filter you can open and inspect before delivery.
- Sanitisation (escaping). Cleaning or neutralising user text before putting it in a page, so characters like
<and>are shown as text rather than treated as HTML tags. Without it, text can become code. - Google dorking. Using special search operators in Google to find pages with a particular pattern in their URL, for example pages that all share a path. It is a way of finding sites built on the same product.
Setting up
The report describes no special tooling beyond a browser and an intercepting proxy. The author used the proxy while logging into Facebook Blueprint to capture the authentication request. The only precondition is reaching the Facebook login flow that the training sites use, because the vulnerable parameter lives in the callback URL that the site hands to Facebook and that Facebook sends the browser back to.
Finding it
While logging into Facebook Blueprint and intercepting the request, the author saw this endpoint:
GET/login.php?skip_api_login=1&api_key=xxx&...etc&cancel_url=https://www.facebookblueprint.com/authentication/fb_callback?error=access_denied&error_code=200&error_description=Permissionserror&error_reason=user_denied&state=xxxx#_=_&display=page&locale=en_US&pl_dbl=0
Line by line, in plain words:
GETis the type of request a browser makes when it simply asks for a page.login.phpis the page being requested, Facebook's login handler.skip_api_login=1,api_key=xxx,display=page,locale=en_US,pl_dbl=0are settings Facebook's login page uses. The report shows them as they appeared;xxxstands in for a real value.cancel_url=is the important one. It tells Facebook where to send the browser if the login does not complete. Its value is a full URL pointing back at the training site's own path,/authentication/fb_callback.- Inside that
cancel_urlare the parameters Facebook appends when a user declines the permission dialog:error=access_denied,error_code=200,error_description=Permissionserror,error_reason=user_deniedandstate=xxxx. #_=_is a fragment at the end of the URL. Browsers keep it for themselves and do not send it to the server.
The interesting part is error_description. The author found no sanitisation applied to the error_description parameter. So whatever text sits in error_description ends up rendered as part of the page. If that text is a script, the browser runs it. That is the reflected XSS.
Exploitation
Step 1: identify the reflected parameter
The callback URL contains error_description=Permissionserror. Because the value is echoed back into the page without sanitisation, anything placed there is rendered as part of the response.
Step 2: inject the payload into the callback
The reproduction steps replace the value with a placeholder on each affected host:
https://www.facebookblueprint.com/authentication/fb_callback?error=access_denied&error_code=200&error_description={{Inject_your_payload_here}}
https://training.wplearn.com/authentication/fb_callback?error=access_denied&error_code=200&error_description={{Inject_your_payload_here}}
https://www.twitterflightschool.com/authentication/fb_callback?error=access_denied&error_code=200&error_description={{Inject_your_payload_here}}
https://googleretailtraining.exceedlms.com/authentication/fb_callback?error=access_denied&error_code=200&error_description={{Inject_your_payload_here}}
Line by line:
- Each line is one full URL to the callback path
/authentication/fb_callbackon a different training site: Facebook Blueprint, Workplace training, Twitter Flight School and Google retail training. error=access_deniedanderror_code=200are kept because the callback expects them; they mimic the normal "user said no" result.error_description={{Inject_your_payload_here}}is the slot where the script goes. The double braces are just a placeholder meaning "put your payload here"; they are not part of the attack.- The report does not include the specific payload string used.
Step 3: reach the callback through the login flow
The parameter is part of the cancel_url passed to Facebook's login endpoint, so the callback is normally reached when the user denies the permission request. The attacker's job is to get a victim to follow a crafted link so that the callback renders the injected value. The author states this could potentially let an attacker steal user cookies and obtain the access_token.
Root cause
The callback handler at /authentication/fb_callback reflects the error_description query parameter into the page without sanitisation. Because the value is controlled by whoever builds the URL, and the URL can be embedded in the cancel_url of the login request, anyone who can get a victim to follow a link can reach the reflection. The report describes this as a zero-day in the Intellum service itself, so the mistake is in the shared platform code rather than in each customer's site. In everyday terms: the landlord built the door, and every tenant's shop has the same faulty lock.
Impact
The author states that exploiting the flaw could potentially let an attacker steal user cookies and obtain the access_token used for authentication on training websites that use Intellum. The author states the flaw could potentially let an attacker steal cookies and obtain the access_token used on training websites using Intellum. The report hedges this as a potential outcome ("could potentially enable") and does not demonstrate cookie or token theft in the text.
Fix
The report does not describe the code change. It records that Meta triaged the report on 8 January 2020, marked it successfully fixed on 13 January 2020, and that the author confirmed the fix the same day; a bounty was awarded on 26 February 2020. The author notes that no response was received to the notification about the underlying Intellum issue and that no CVE was issued. Despite Twitter's domain being ineligible, their team decided to reward the report (HackerOne report 770349). Google clarified that the discovered domains did not belong to them, resulting in no reward.
Variants to test
The author's own takeaway is to always check error_description= parameters for XSS. The dorks used to find other Intellum customers were:
inurl:/student/catalog "Facebook"
inurl:/student/catalog "Twitter"
inurl:/student/catalog "Google"
Line by line:
inurl:/student/catalogtells Google to return only pages whose address contains that path.- The quoted word after it asks Google to also match pages mentioning that company name, so the results are likely to be that company's training portal.
Concrete things to try on other targets:
- Swap the vendor name in the dork for other organisations and look for hosts on the same learning platform;
- On any OAuth or SSO callback, put a test string in
error_descriptionand see whether it comes back unencoded in the response body.
Glossary
- Access token: a temporary key a site gives you after login and checks on later requests, so you do not resend your password.
- API: a defined way for one piece of software to talk to another, like a service counter with set questions and answers.
- Callback: the URL a login provider sends your browser back to after you approve or deny a login.
- Cookie: a small piece of data a site stores in your browser and receives back on each request, often used to remember who you are.
- CVE: a public identifier for a known security flaw, so people can refer to the same issue.
- Endpoint: a specific address on a server that accepts requests, such as
/authentication/fb_callback. - Escaping / sanitisation: cleaning user text before showing it, so characters are displayed as text and not treated as code.
- Fragment: the part of a URL after
#, kept by the browser and not sent to the server. - Google dorking: using special search operators to find pages matching a pattern, such as a shared URL path.
- Intercepting proxy: a tool between browser and server that lets you pause, read and change requests and responses.
- Intellum: the third-party learning platform on which the affected training sites were built.
- OAuth: a scheme that lets one site use another site (here Facebook) to handle login, without sharing your password.
- Parameter / query string: the name=value pairs after the
?in a URL, read by the server and controlled by whoever wrote the link. - Payload: the piece of input an attacker sends to trigger a bug, here a small script.
- Reflected XSS: a flaw where input from the URL is echoed back into the page without cleaning, so a script in the URL runs in the browser as if the site wrote it.
- SSO (single sign-on): logging in once with one account to access several separate sites.
- Triaged: a bug report reviewed and accepted as valid by the receiving security team.
- Zero-day: a flaw that is not yet known to the vendor, so no fix exists at the time it is found.