2 XSS on Microsoft
Two reflected cross-site scripting vulnerabilities were found on Microsoft subdomains. An attacker could execute JavaScript in a victim's browser by crafting a URL with a malicious parameter value.
Published on medium.com
The story begins that one day I was feeling funky and texted my friend that I feel like Microsoft has been escaping from my radar. I am gonna find something on it.
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 write-up covers two reflected cross-site scripting findings on Microsoft subdomains, reached through Google dorking rather than through any prior knowledge of the applications. The researcher, Mohammad Nikouei (@NikoueiMohammad), describes the whole exercise as starting from a hunch and finishing the first finding within 15 minutes.
The two targets are legacy-looking ASP.NET pages. The first is a subdomain that had not been maintained or updated for a while, with a copyright notice from 2014, no favicon, and a language the researcher did not recognise. The second is a separate subdomain that the researcher found by reusing the first subdomain as a clue. The report does not name the applications or describe what they normally do beyond the parameters they accept.
Setup
The report lists no accounts, roles or special access. Everything was done from the outside against public hosts. The tools involved are:
- Google search, used for dorking and recursive filtering.
- Google Translate, which showed the first target was in Japanese, and which was used to translate a keyword for the second round of dorking.
x8, a parameter discovery tool, run against the first subdomain with a wordlist.- A browser, for view-source inspection and for confirming payload execution.
The only precondition worth noting is that the first subdomain already had two parameters in its URL, which gave the researcher a starting point before any tooling was used.
Finding it
The researcher began with a search for ASP.NET endpoints across Microsoft subdomains, on the reasoning that an .aspx endpoint stands out to someone hunting for input handling bugs:
site:*.microsoft.com ext:aspx
That returns far too many results, so the next step is to remove hosts that look uninteresting and repeat the exclusion recursively until something stands out:
-site:SAFE.microsoft.com
One subdomain survived the filtering. Two things drew attention to it: it had no favicon, and the researcher did not recognise the language of the site. Opening it showed an application that had not been maintained or updated for a while, with a copyright year of 2014 in the interface. That combination was enough to justify further probing.
The URL already carried two parameters, so those were tested first. They produced nothing. That is when x8 was brought in:
x8 -u XXS1.microsoft.com -w WORDLIST
x8 reported that a parameter named message was being reflected. The host name in the command is shown as XXS1.microsoft.com in the report, and the wordlist is a placeholder.
Exploitation
Step 1: reflected XSS through the message parameter
With message confirmed as reflected, the researcher sent the following payload:
message=xss%27-alert(origin)-%27
The %27 sequences are URL-encoded single quotes. The payload closes whatever quoting context the value is placed in, calls alert(origin) and then opens a new quote to keep the surrounding syntax balanced. The report states that the alert fired.
Because this payload was straightforward, the researcher expected it to be reported as a duplicate and decided to look for a second, independent finding rather than stop there.
Step 2: pivoting on the language of the first target
The first subdomain was in Japanese, as the researcher saw through Google Translate. That suggested a new dork: add the Japanese word for "search" to the query and see whether other Microsoft hosts with the same language turn up, filtering recursively as before:
site:*.microsoft.com 検索 -site:SAFE.microsoft.com
After filtering, one result stood out:
https://xss2.microsoft.com/
Step 3: reading the source of the second target
Attempts against the second subdomain did not produce anything at first, and the researcher was close to moving on. A second look at the page source paid off and revealed this endpoint:
xss2.microsoft.com/REDACTED/REDACTED?id=1&appid=22&uid=54
The endpoint takes three parameters: id, appid and uid. All three failed to produce a reflection here.
Step 4: dorking for sibling paths
Rather than give up on the host, the researcher searched for other paths under the same directory prefix:
site:xss2.microsoft.com/REDACTED/REDACTED
This returned an endpoint that looked similar to the one already under test, with one more path segment:
xss2.microsoft.com/REDACTED/REDACTED/REDACTED?id=1&appid=22&uid=54
The same three parameters were tried on it. This time the id parameter was reflected, and the researcher was able to execute JavaScript. The report does not give the exact payload used at this step, only that the id parameter was the one that reflected.
Root cause
Both findings are reflected XSS: a request parameter is written back into the HTML response without adequate encoding, so markup or script supplied by the attacker is interpreted by the browser. In the first case the vulnerable parameter is message; in the second it is id on the deeper path. The payload contains URL-encoded single quotes, which suggests the value was placed inside a quoted attribute or string, but that is an inference from the payload shape rather than something the report states.
The second finding is notable because the same parameter set was safe on one path and vulnerable on a sibling path one segment deeper. That points to per-page handling of input rather than a shared, centralised encoding routine: the safe endpoint and the vulnerable one sit under the same prefix but do not share the same output handling.
Impact
Both bugs are reflected XSS, so exploitation requires a victim to follow a crafted link to the affected host with the payload in the URL. Under that condition an attacker can run script in the origin of the Microsoft subdomain, which allows actions in the victim's browser in the context of that site. The severity and bounty are not given.
Fix
The appropriate fix for both endpoints is contextual output encoding of every reflected parameter, applied on each page that renders user input, including sibling paths under the same prefix, since the second finding shows that fixing one endpoint does not cover the others. A Content Security Policy that blocks inline script would reduce the impact but is not a substitute for encoding.
Variants to test
- Dork for legacy ASP.NET pages on any large programme. Search
site:*.target.com ext:aspx, then recursively exclude hosts that look maintained. A positive result is a host with an old copyright year, no favicon, or an unfamiliar language, which is worth manual inspection. - Run parameter discovery on any URL that already has query parameters. Use
x8 -u host -w WORDLISTand look for parameters reported as reflected. A positive result is a parameter name you did not see in the original URL appearing in the response. - Test the quote-breaking payload shape. Send
param=xss%27-alert(origin)-%27and watch for the alert. A positive result confirms reflection inside a quoted context and gives you the exact quoting character to work with. - Pivot on language. If a target is in a non-English language, add the local word for "search" (or another common feature word) to the dork and filter recursively. A positive result is a sibling host in the same language with a similar application.
- Enumerate sibling paths under a known endpoint. Take a discovered path such as
/A/B?id=1&appid=22&uid=54, dorksite:host/A/B, and test the same parameter set on every deeper path returned. A positive result is a parameter that reflects on one sibling but not another, which is exactly the pattern that produced the second finding here.
What happened, in plain words
A security researcher found two cross-site scripting (XSS) bugs on Microsoft websites. He did not have any special access or insider knowledge. He simply used Google to search for pages that looked old and forgotten, poked at them, and found that some of them took text from the address bar and pasted it straight into the page without cleaning it first. That means an attacker could craft a link that, when a victim clicks it, runs the attacker's JavaScript inside a Microsoft website.
The researcher describes the mission as successful in 15 minutes. The second one came from using the first as a clue: the first site was in Japanese, so he added the Japanese word for search to his dorks and found a second subdomain. The report does not name the applications or say what they are for, beyond the parameters they accept.
Background: the ideas you need
Before walking through the steps, here are the concepts that come up. Each is explained from scratch.
What a subdomain is
A domain is a name like microsoft.com. A subdomain is a name in front of it, like support.microsoft.com or xss2.microsoft.com. Large companies own thousands of subdomains, each often run by a different team, sometimes years ago and then forgotten. That is why hunters search across all of them.
What an ASP.NET page and an .aspx file are
ASP.NET is a framework from Microsoft for building websites. Pages built with it usually end in .aspx. To a security researcher, a URL ending in .aspx is a hint that the page may be old, may take input from the URL, and may not have been updated recently. It is like seeing a rusty gate: not proof of a problem, but worth a look.
What a parameter is
When you see a URL like example.com/page?id=1&name=hello, the part after the ? is the query string. It is made of parameters: id with value 1, and name with value hello. The & separates them. Websites use parameters to receive information from the browser, for example which article to show. If the site takes a parameter and puts it into the page without cleaning it, that is where XSS lives.
What reflected XSS is
XSS stands for cross-site scripting. It means an attacker gets their own JavaScript to run inside someone else's website, in the victim's browser. "Reflected" means the malicious text travels in the URL: the attacker sends a crafted link, the victim clicks it, the server reads the parameter and echoes it back into the page, and the browser runs it as if Microsoft had written it. The everyday comparison: imagine a receptionist who reads out loud whatever name a visitor gives, without checking it. If the visitor says a rude sentence instead of a name, the receptionist announces the rude sentence to the whole lobby. The receptionist is the server, the visitor is the attacker, and the lobby is the victim's browser.
What alert(origin) does
alert() is a JavaScript function that pops up a dialog box. origin is a built-in JavaScript value that holds the address of the current page (scheme, host and port). So alert(origin) shows a popup with the site's address. Researchers use it as harmless proof: if the popup appears, their JavaScript ran on that site. They are not stealing anything; they are demonstrating that they could.
What URL encoding is
Some characters cannot appear safely in a URL. The single quote ' is one of them. It is written as %27. So %27 in a URL means the same as '. This matters below because the payload uses %27 to sneak quotes into the page.
What Google dorking is
Dorking means using advanced search operators in Google to find specific kinds of pages. For example, site: limits results to one domain, and ext: limits results to a file extension. It is like using the library catalogue with very precise filters instead of browsing the shelves.
What x8 is
x8 is a small command-line tool. You give it a URL and a list of common parameter names (a wordlist). It tries each name on the URL and watches the response to see whether the value comes back in the page. If it does, the parameter is "reflected". It is like trying every key on a keyring in a lock to see which one turns.
What view-source is
Every browser can show you the raw HTML that the server sent, before the browser draws the page. In most browsers you right-click and choose "View page source", or type view-source: before the URL. Researchers read it to find hidden links, forms and parameters that are not visible on the page itself.
Setup
The report lists no accounts, roles or special access. Everything was done from the outside against public websites. The tools involved are:
- Google search, used for dorking and recursive filtering.
- Google Translate, which showed the first target was in Japanese, and which was used to translate a keyword for the second round of dorking.
x8, a parameter discovery tool, run against the first subdomain with a wordlist.- A browser, for view-source inspection and for confirming payload execution.
The only precondition worth noting is that the first subdomain already had two parameters in its URL, which gave the researcher a starting point before any tooling was used.
Finding it
The researcher began with a search for ASP.NET endpoints across Microsoft subdomains, on the reasoning that an .aspx endpoint stands out to someone hunting for input handling bugs:
site:*.microsoft.com ext:aspx
Line by line:
site:*.microsoft.comtells Google to return only pages on any subdomain ofmicrosoft.com. The*is a wildcard meaning "any subdomain".ext:aspxtells Google to return only pages whose file extension is.aspx.- Together, the query asks: "show me every ASP.NET page anywhere under microsoft.com".
That returns far too many results, so the next step is to remove hosts that look uninteresting and repeat the exclusion recursively until something stands out:
-site:SAFE.microsoft.com
Line by line:
- The leading space is just a separator; Google ignores extra spaces.
-site:SAFE.microsoft.commeans "exclude everything on this host". The host nameSAFE.microsoft.comis a placeholder for a host that looks well maintained and therefore boring.- "Recursive filtering" means you run the search, look at the results, pick another host that looks uninteresting, add another
-site:for it, run again, and repeat. Each round shrinks the list. It is like peeling an onion: you keep removing the outer layers until something catches your eye.
One subdomain survived the filtering. Two things drew attention to it: it had no favicon, and the researcher did not recognise the language of the site. A favicon is the little icon shown in the browser tab; a serious, maintained site almost always has one, so its absence is a small sign of neglect. Opening the site showed an application that had not been maintained or updated for a while, with a copyright year of 2014 in the interface. That combination was enough to justify further probing.
The URL already carried two parameters, so those were tested first. They produced nothing. That is when x8 was brought in:
x8 -u XXS1.microsoft.com -w WORDLIST
Line by line:
x8is the tool being run.-u XXS1.microsoft.comgives it the target URL. The host name is shown asXXS1.microsoft.comin the report; it is a stand-in for the real subdomain.-w WORDLISTgives it a file containing a list of common parameter names to try.WORDLISTis a placeholder for the actual file name.
x8 reported that a parameter named message was being reflected. "Reflected" here means: when the tool sent a value in message, that same value appeared in the HTML that came back. That is the raw material of XSS.
Exploitation
Step 1: reflected XSS through the message parameter
With message confirmed as reflected, the researcher sent the following payload:
message=xss%27-alert(origin)-%27
Line by line:
message=is the parameter name and the equals sign.xssis just filler text, so the value looks like a normal word at the start.%27is a URL-encoded single quote. It closes whatever quote the site wrapped the value in.-alert(origin)-is the JavaScript to run. The hyphens around it are there to keep the surrounding JavaScript syntactically valid once the quotes are rearranged.%27at the end opens a new quote, so the rest of the page's original code still has a quote to close.
The idea is: the site probably writes the value inside quotes, something like var x = 'VALUE';. By closing the quote early, injecting the call, and opening a new quote, the attacker turns the site's own code into code that runs alert(origin). The report states that the alert fired.
Because this payload was straightforward, the researcher expected it to be reported as a duplicate (someone else may have found the same thing first) and decided to look for a second, independent finding rather than stop there.
Step 2: pivoting on the language of the first target
The first subdomain was in Japanese, as the researcher saw through Google Translate. That suggested a new dork: add the Japanese word for "search" to the query and see whether other Microsoft hosts with the same language turn up, filtering recursively as before:
site:*.microsoft.com 検索 -site:SAFE.microsoft.com
Line by line:
site:*.microsoft.comagain limits results to Microsoft subdomains.検索is the Japanese word for "search". Google will return pages that contain this word, which tends to surface Japanese-language applications.-site:SAFE.microsoft.comagain excludes the boring host, and the researcher kept adding exclusions as before.
After filtering, one result stood out:
https://xss2.microsoft.com/
This is a second subdomain, found by reusing the first target as a clue.
Step 3: reading the source of the second target
Attempts against the second subdomain did not produce anything at first, and the researcher was close to moving on. A second look at the page source paid off and revealed this endpoint:
xss2.microsoft.com/REDACTED/REDACTED?id=1&appid=22&uid=54
Line by line:
xss2.microsoft.comis the host./REDACTED/REDACTEDare two path segments whose real names are hidden in the report. A path segment is the part of the URL between slashes, like folders on a computer.?id=1&appid=22&uid=54is the query string with three parameters:idset to1,appidset to22, anduidset to54.
All three parameters failed to produce a reflection here. In other words, the page accepted them but did not echo them back in a way that could be exploited.
Step 4: dorking for sibling paths
Rather than give up on the host, the researcher searched for other paths under the same directory prefix:
site:xss2.microsoft.com/REDACTED/REDACTED
Line by line:
site:xss2.microsoft.com/REDACTED/REDACTEDtells Google to return only pages under that specific host and path prefix. It is a way of asking: "what other pages live in this same folder?"
This returned an endpoint that looked similar to the one already under test, with one more path segment:
xss2.microsoft.com/REDACTED/REDACTED/REDACTED?id=1&appid=22&uid=54
Line by line:
- The host and the first two path segments are the same as before.
- A third
/REDACTEDsegment has been added, so this is a deeper page in the same folder. - The query string is identical:
id=1&appid=22&uid=54.
The same three parameters were tried on it. This time the id parameter was reflected, and the researcher was able to execute JavaScript. The report does not give the exact payload used at this step, only that the id parameter was the one that reflected.
Why the bugs exist
Both findings are reflected XSS: a request parameter is written back into the HTML response without adequate encoding, so markup or script supplied by the attacker is interpreted by the browser. In the first case the vulnerable parameter is message; in the second it is id on the deeper path. The payload contains URL-encoded single quotes, which suggests the value was placed inside a quoted attribute or string, but that is an inference from the payload shape rather than something the report states.
The second finding is notable because the same parameter set was safe on one path and vulnerable on a sibling path one segment deeper. That points to per-page handling of input rather than a shared, centralised encoding routine: the safe endpoint and the vulnerable one sit under the same prefix but do not share the same output handling. In everyday terms, two clerks in the same office handle the same form differently: one checks the name before reading it out, the other does not.
What an attacker could do
Both bugs are reflected XSS, so exploitation requires a victim to follow a crafted link to the affected host with the payload in the URL. Under that condition an attacker can run script in the origin of the Microsoft subdomain, which allows actions in the victim's browser in the context of that site. The severity and bounty are not given.
How to fix it
The appropriate fix for both endpoints is contextual output encoding of every reflected parameter, applied on each page that renders user input, including sibling paths under the same prefix, since the second finding shows that fixing one endpoint does not cover the others. A Content Security Policy that blocks inline script would reduce the impact but is not a substitute for encoding.
Things you can try yourself
- Dork for legacy ASP.NET pages on any large programme. Search
site:*.target.com ext:aspx, then recursively exclude hosts that look maintained. A positive result is a host with an old copyright year, no favicon, or an unfamiliar language, which is worth manual inspection. - Run parameter discovery on any URL that already has query parameters. Use
x8 -u host -w WORDLISTand look for parameters reported as reflected. A positive result is a parameter name you did not see in the original URL appearing in the response. - Test the quote-breaking payload shape. Send
param=xss%27-alert(origin)-%27and watch for the alert. A positive result confirms reflection inside a quoted context and gives you the exact quoting character to work with. - Pivot on language. If a target is in a non-English language, add the local word for "search" (or another common feature word) to the dork and filter recursively. A positive result is a sibling host in the same language with a similar application.
- Enumerate sibling paths under a known endpoint. Take a discovered path such as
/A/B?id=1&appid=22&uid=54, dorksite:host/A/B, and test the same parameter set on every deeper path returned. A positive result is a parameter that reflects on one sibling but not another, which is exactly the pattern that produced the second finding here.
Glossary
- ASP.NET: a framework from Microsoft for building websites; pages usually end in
.aspx. - Content Security Policy (CSP): a set of rules a site sends to the browser saying which scripts are allowed to run; it can block inline script but does not fix the underlying bug.
- Cross-site scripting (XSS): a bug where an attacker gets their own JavaScript to run inside someone else's website, in a victim's browser.
- Dorking: using advanced Google search operators (like
site:andext:) to find specific kinds of pages. - Endpoint: a specific URL on a server that accepts a request and returns a response.
- Favicon: the small icon shown in a browser tab next to the page title; its absence can hint at an unmaintained site.
- Output encoding: converting characters that have special meaning in HTML (like
<,>, quotes) into harmless equivalents before writing them into a page, so they are displayed as text rather than interpreted as code. - Parameter: a name and value pair in a URL's query string, such as
id=1inpage?id=1. - Path segment: one part of a URL between two slashes, like a folder name.
- Query string: the part of a URL after the
?, made of parameters separated by&. - Reflected XSS: XSS where the malicious input travels in the URL and is echoed back by the server into the page.
- Reflection: when a server copies a value from the request back into the response; harmless by itself, dangerous without encoding.
- Subdomain: a name in front of a domain, like
supportinsupport.microsoft.com. - URL encoding: writing characters that are not safe in a URL using
%codes, for example%27for a single quote. - View-source: a browser feature that shows the raw HTML the server sent, before the browser draws the page.
- Wordlist: a file containing a list of common names (here, parameter names) for a tool to try one by one.
x8: a command-line tool that tries many parameter names against a URL and reports which ones are reflected.