Reflected XSS in Facebook’s mirror websites
A reflected cross-site scripting vulnerability existed in a PHP endpoint on Facebook mirror websites, where user input was reflected inside a single-quoted href attribute. An attacker could craft a URL that, when visited by a victim, would execute arbitrary JavaScript in the context of the mirror site.
Published on medium.com
{{media:0}}
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
This is a write-up of a reflected cross-site scripting bug that affected Facebook mirror websites. The researcher, Sudhanshu Rajbhar, found it while enumerating subdomains of the thefacebook.com domain, having noticed that many published write-ups concerned bugs on thefacebook.com subdomains. The vulnerable host discussed in most detail is mirror-ext.glbx.thefacebook.com, a mirror site whose /help/ page is an ordinary help page listing a support email address. The same bug was later reproduced on other Facebook mirror domains.
Setup
The work needed no accounts or special roles. The tooling was:
- Findomain, Subfinder and Assetfinder for subdomain collection.
- httprobe to filter the collected hosts down to live HTTP services.
- ffuf for directory brute forcing, driven by a small script the researcher calls
dir.py. - A browser for inspecting page source and testing payloads.
No versions are given in the report.
Finding it
After subdomain enumeration, the researcher's habit is to run directory brute forcing against every host that httprobe reports as live, then review the results for easy wins. The driver script is invoked as:
python3 dir.py httprobe.txt
While reviewing the ffuf output for https://mirror-ext.glbx.thefacebook.com, only one directory appeared.


The researcher opened http://mirror-ext.glbx.thefacebook.com/help/. It was a normal help page with the support email address and did not look interesting at first, but the page source contained something worth following up.

The second line of the source referenced an endpoint under the /.layout directory. Requesting http://mirror-ext.glbx.thefacebook.com/.layout/mirror.php returned a blank page, with nothing further in the source to work with.

The next step was to look for more PHP files under the /.layout directory, using different wordlists.
All the files found behaved like mirror.php, returning a blank page, except one: header.php.

At http://mirror-ext.glbx.thefacebook.com/.layout/header.php, the page source showed the requested endpoint being reflected inside the href value of an anchor tag. That made it a candidate for reflected XSS, so testing began.
Appending characters such as ">< to the end of the URL produced a not found page.

The researcher did not give up, since the reflection suggested XSS was reachable. Parameter brute forcing on the endpoint found no parameters. Adding a slash followed by another directory name, however, did not produce the not found error seen before. This approach came from a brutelogic blog post the researcher had read previously.

http://mirror-ext.glbx.thefacebook.com/.layout/header.php/shirley
Retrying with ">< showed that those characters were being URL encoded.
The researcher then realised the href value sat inside single quotes, so the next attempt used a single quote.
An early attempt had been to inject href='/javascript:alert()' directly, but this did not work because a slash precedes the input. Searching for a way to place two href attributes in a single anchor tag led to a Stack Overflow answer, and the final payload was built from that solution.

The payload executed, confirming XSS on a Facebook domain. Knowing of other Facebook mirror domains, the researcher tried to replicate the same bug on them.

mirror.facebook.net was also vulnerable. A further subdomain, http://mirror.t.tfbnw.net/, was vulnerable too, but the report has no screenshot of it.
Exploitation
Step 1: locate the hidden directory
Directory brute forcing of mirror-ext.glbx.thefacebook.com surfaced a single directory. The /help/ page source referenced an endpoint under /.layout/, a directory not otherwise linked from the site.
Step 2: enumerate PHP files under /.layout
Requesting /.layout/mirror.php returned a blank page. Brute forcing the directory with different wordlists found several PHP files, all blank like mirror.php, except header.php:
http://mirror-ext.glbx.thefacebook.com/.layout/header.php
Step 3: confirm the reflection
The source of header.php reflected the requested path inside an anchor tag's href value. Appending ">< to the URL returned a not found page, and parameter brute forcing found no parameters.
Step 4: use a path segment instead of a parameter
Adding a slash and a directory name after header.php avoided the not found error:
http://mirror-ext.glbx.thefacebook.com/.layout/header.php/shirley
The researcher tried this because of a brutelogic blog post read in the past.
Step 5: work around encoding and quoting
Sending ">< again showed the characters were URL encoded. The href value was wrapped in single quotes, so a single quote was used instead. Injecting href='/javascript:alert()' did not work because a slash sits immediately before the input.
Step 6: final payload
Using the Stack Overflow technique for two href attributes in one anchor tag, the final payload executed.

Step 7: replicate on other mirrors
The same payload worked on mirror.facebook.net.

It also worked on http://mirror.t.tfbnw.net/, for which no screenshot exists.
Root cause
The header.php script reflected the requested path into an anchor tag's href attribute. Double quotes and angle brackets were URL encoded, and the attribute value was delimited by single quotes. The leading slash before the input blocked a direct javascript: URL. The report does not show the server-side code, so the exact implementation is not stated.
Impact
An attacker who can get a victim to follow a crafted link to a vulnerable mirror host can execute JavaScript in the context of that Facebook mirror domain. The report demonstrates this with an alert and does not describe any further actions, data access or account impact. The same payload was reproduced on mirror-ext.glbx.thefacebook.com, mirror.facebook.net and mirror.t.tfbnw.net.
Fix
Regarding the fix, the single quote is now converted to &.
The researcher received a $500 bounty.

Variants to test
- Hidden directories referenced in page source. Fetch the source of ordinary pages such as help or support pages and look for paths under dot-directories like
/.layout/. A positive result is a directory that responds differently from the rest of the site. - PHP files that accept extra path segments. Append
/nameafter a.phpfile. A positive result is a page that renders normally instead of returning not found, with the segment reflected somewhere in the response. - Reflection inside single-quoted attributes. Send a single quote and check whether it survives unencoded. A positive result is a broken attribute in the rendered HTML.
- Blocked
javascript:schemes. Where a slash or other prefix blocksjavascript:, try the two-hreftechnique from the Stack Overflow answer the researcher used. A positive result is script execution from the secondhref. - Sibling mirror domains. Once a payload works on one mirror host, replay it against other mirrors of the same product. A positive result is the same reflection and execution on the second host.
Looking for XSS more generally
The second half of the write-up covers the researcher's method. The Burp Suite extension reflector checks parameters whose values are reflected in the page source and reports which symbols (", >, <, {, }, ' and others) are also reflected. The workflow is to browse the application, visit every page and fill in every input field, then check the Burp issue tab for findings.
For automation, tools such as ParamSpider and gau collect endpoints that carry parameters, and kxss or dalfox can then be run against them to look for XSS. The report shows dalfox in action.

For beginners, the researcher recommends reading XSS blogs, in particular brutelogic's Brute XSS site, the Respect XSS blog, and the AwesomeXSS repository, and practising on PortSwigger Web Security Academy and XSS-related CTF challenges. Search fields and submit forms are highlighted as fields more prone to being vulnerable.
Video POC
The report includes a video proof of concept, referenced after the bounty screenshot.
What happened, in plain words
A security researcher found a bug on some of Facebook's "mirror" websites. A mirror website is a copy of a site, usually placed on a different address so that it can serve the same content faster or from another location. Think of it like a photocopy of a shop's price list pinned up in a second branch: same content, different address.
The bug was a reflected cross-site scripting (XSS) bug. XSS means that a website takes something a visitor sends it and puts it back into the page without cleaning it up first. If the visitor sends a piece of text that a browser treats as code, the browser will run that code as if the website itself had written it. "Reflected" means the text is not stored on the server; it bounces straight back in the same response, like shouting into a canyon and hearing your own words come back.
The researcher found a page that echoed part of the web address back into the page. By crafting a special address, he made the page run a small piece of JavaScript (the language browsers use to make pages interactive). He proved it with a pop-up alert box, then found the same bug on other Facebook mirror domains. The single quote is now converted to &, and he was paid a $500 bounty. A bounty is a reward a company pays to someone who reports a security problem responsibly instead of abusing it.
This article walks through exactly how he did it, step by step, and then explains his general method for hunting XSS. Everything below assumes you can use a browser and a computer and nothing more.
The starting point: subdomains
A domain is the name of a website, like thefacebook.com. A subdomain is a name placed in front of it, like mirror-ext.glbx.thefacebook.com. Companies use subdomains to split up services: one for mail, one for help, one for mirrors, and so on. Each subdomain can be a separate server with its own quirks, which is why bug hunters like them: a big company may guard its main site carefully but forget about a small subdomain.
The researcher had read many write-ups about bugs found on thefacebook.com subdomains and wanted to find one himself. So he started by collecting as many subdomains of thefacebook.com as he could.
To do that he used tools that gather subdomain names from public sources:
These tools collect subdomain names from public sources. It is like collecting every phone number printed on a company's public leaflets.
Filtering to live hosts
A long list of subdomain names is not much use if half of them no longer exist. The researcher ran the list through httprobe, a tool that tries to connect to each name over HTTP (the protocol browsers use to fetch pages) and keeps only the ones that answer. The result is a list of hosts that are actually alive.
Directory brute forcing
Next, the researcher has a habit: for every live host, he tries lots of common folder and file names to see what exists. This is called directory brute forcing. A website's folders are like rooms in a building. The front door (the home page) is obvious, but there may be side rooms that nobody links to and that the owners forgot about. Brute forcing means taking a long list of common room names (a wordlist) and trying each one to see which doors open.
The tool he uses for this is ffuf. He drives it with a small script of his own, which he calls dir.py, and runs it like this:
python3 dir.py httprobe.txt
Line by line:
python3runs the Python programming language interpreter, version 3. Python is a popular language for small automation scripts.dir.pyis the name of the researcher's script. It presumably reads the list of hosts and calls ffuf for each one, though the report does not show its contents.httprobe.txtis a text file containing the live hosts that httprobe produced, one per line.
So the command means: "take my list of live hosts and run the directory search against every one of them."
The first interesting host
While reviewing the ffuf output for https://mirror-ext.glbx.thefacebook.com, only one directory turned up.


The screenshots show the ffuf results for that host. The important detail is that a single directory was found, which the researcher then decided to open.
The help page and a hidden path
He opened http://mirror-ext.glbx.thefacebook.com/help/. At first glance it was an ordinary help page listing a support email address, nothing that looked like a security problem. But he looked at the page source: the raw HTML that the server sends to the browser before the browser draws the page. Viewing source is like reading a recipe instead of looking at the finished cake; sometimes you see ingredients the chef did not intend to show.

In the source, on the second line, there was a reference to an endpoint under a hidden directory. An endpoint is simply a specific address on a server that does something when you request it. The path was /.layout/mirror.php. The path was /.layout/mirror.php.
He requested http://mirror-ext.glbx.thefacebook.com/.layout/mirror.php and got a blank page.

The next question was whether other files in the same hidden folder behave differently.
Finding header.php
He ran directory brute forcing again, this time against the /.layout folder, using different wordlists.
Several PHP files turned up. PHP is a programming language commonly used on web servers to build pages on the fly. All of the files behaved like mirror.php, returning a blank page, except one: header.php.

http://mirror-ext.glbx.thefacebook.com/.layout/header.php
This is the address of the one file that did not come back blank.
Spotting the reflection
Looking at the source of header.php, the researcher saw that the address he had requested was being echoed back inside the href value of an anchor tag. An anchor tag is the HTML element that makes a clickable link; its href attribute holds the destination address. When a page repeats your input back to you, that is called a reflection. If the page does not clean the input first, a reflection can become XSS.
This made the page a candidate, so testing began.
First attempts and a not found page
He appended characters such as ">< to the end of the URL. In HTML, a double quote can close an attribute value and > can close a tag, so these characters are the classic way to break out of a link and start writing your own markup. The result was a not found page.

The result was a not found page.
Parameters and a different idea
He did not give up, because the reflection suggested XSS was reachable. He tried brute forcing for parameters. A parameter is the part of a URL after a question mark, like ?name=value, used to pass information to the page. No parameters were found.
Then he tried something different: adding a slash and then another directory name after header.php. This time he did not get the not found error. The idea came from a brutelogic blog post he had read before, which describes how PHP scripts can accept extra path segments.

http://mirror-ext.glbx.thefacebook.com/.layout/header.php/shirley
Here header.php is followed by /shirley.
Encoding gets in the way
He retried with ">< and found that those characters were being URL encoded. URL encoding is a way of writing special characters safely in a web address: a double quote becomes %22, for example. It is like spelling out a word letter by letter over the phone when the line is bad. Encoding neutralises the characters that would otherwise break out of the HTML.
The single quote detail
He then realised something important: the href value was wrapped in single quotes, not double quotes. In HTML you can delimit an attribute with either kind of quote. If the page uses single quotes and does not encode single quotes, then a single quote is the character that breaks out.
Why the obvious payload failed
An early attempt had been to inject href='/javascript:alert()' directly. javascript: is a URL scheme that tells the browser to run the code that follows instead of navigating to a page. It did not work, because a slash sits immediately before the input. The browser saw something like /javascript:alert(), which is a path on the same site, not the javascript: scheme.
Think of it like a door labelled "exit" that is actually painted on a wall: the word is there, but the mechanism is not.
The two-href trick
He searched for a way to put two href attributes into a single anchor tag and found a Stack Overflow answer. The final payload was built from that solution.

The payload executed, and an alert box appeared. That confirmed XSS on a Facebook domain.
Other mirrors
Knowing there were more Facebook mirror domains, he tried the same thing on them.

mirror.facebook.net was also vulnerable. A further subdomain, http://mirror.t.tfbnw.net/, was vulnerable too, but there is no screenshot of it.
The fix and the reward
After the report, the single quote is converted to &.
The single quote is now converted to &. The researcher received a $500 bounty.

Video POC
The report also includes a video proof of concept, referenced after the bounty screenshot. A proof of concept (POC) is a small demonstration that a bug is real, usually the shortest possible action that shows the effect, here the alert box.
How to look for XSS yourself
The second half of the write-up is about method. The researcher uses a Burp Suite extension called reflector. Burp Suite is a tool that sits between your browser and the website so you can see and change the traffic. The extension watches parameters whose values are reflected in the page source and reports which symbols (", >, <, {, }, ' and others) also come back unencoded.
The workflow is simple: browse the application, visit every page, fill in every input field, then look at the Burp issue tab to see what it found.
For automation, tools such as ParamSpider and gau collect endpoints that carry parameters, and kxss or dalfox can then be run against them to look for XSS. The report shows dalfox in action.

Advice for beginners
The researcher recommends reading XSS blogs, in particular brutelogic's Brute XSS site, the Respect XSS blog, and the AwesomeXSS repository. He also suggests practising on PortSwigger Web Security Academy and on XSS-related CTF challenges. A CTF (capture the flag) is a practice competition where you solve security puzzles in a safe environment. Search fields and submit forms are highlighted as the kinds of input more likely to be vulnerable.
Glossary
- Anchor tag: the HTML element that creates a clickable link; its
hrefattribute holds the destination. - Attribute: a setting on an HTML element, written as
name="value", such ashrefon a link. - Bounty: a reward a company pays for a responsibly reported security bug.
- Brute forcing: trying a long list of possible names or values automatically to see which ones work.
- Burp Suite: a tool that intercepts and inspects traffic between your browser and a website.
- CTF: capture the flag, a practice competition with security puzzles.
- Directory: a folder on a web server, visible as a path segment in a URL.
- Domain: the name of a website, such as
thefacebook.com. - Endpoint: a specific address on a server that performs an action when requested.
- ffuf: a tool for brute forcing directories and files on web servers.
- href: the attribute of an anchor tag that holds the link destination.
- HTML: the language that describes the structure of a web page.
- httprobe: a tool that checks which hostnames respond over HTTP.
- JavaScript: the programming language browsers run to make pages interactive.
- Mirror website: a copy of a site served from a different address.
- Not found page: the response a server gives when the requested address does not exist.
- Parameter: the part of a URL after
?, used to pass values to a page, like?name=value. - PHP: a programming language commonly used to build web pages on the server.
- Proof of concept (POC): a small demonstration that a bug is real.
- Reflection: when a page repeats input back to the visitor.
- Reflected XSS: cross-site scripting where the malicious input bounces straight back in the response instead of being stored.
- Subdomain: a name placed in front of a domain, like
mirror-ext.glbx.thefacebook.com. - URL encoding: writing special characters in a web address in a safe form, such as
%22for a double quote. - Wordlist: a list of common names or words used by brute forcing tools.