Skip to content
XSS Write-up Beginner

Microsoft bug reports lead to ranking on Microsoft MSRC Quarterly Leaderboard (Q3 2022)

A parameter on a Microsoft Power Apps authentication page reflected user input without sanitisation, allowing an attacker to inject JavaScript that would execute in a victim's browser. The researcher demonstrated the flaw with a simple script payload.

Supakiad S Follow

Published on medium.com

Supakiad S. (m3ez)

Supakiad S. (m3ez), on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

This is the story of my first valid bug on the Microsoft bug bounty programme, a reflected Cross-site Scripting (XSS) issue in the Power Apps platform that earned me a place on the Microsoft MSRC 2022 Q3 Security Researcher Leaderboard, at rank 44.

The Microsoft Security Response Center (MSRC) is the part of Microsoft that engages with security researchers working to protect Microsoft's customers and the wider ecosystem. Before hunting, I went through the list of in-scope and ongoing programmes on the Microsoft Bounty Programs page and chose the Microsoft Dynamics 365 and Power Platform programme.

The target itself is the Power Apps platform. While analysing the platform and the applications built on it, I noticed that an application sent requests to https://apps.powerapps.com. That drew my attention, and the whole finding lives in one of the authentication-related frames served from that host.

Setup

No special accounts, roles or tooling are described. The work was done from a browser: navigating to the endpoint, viewing the HTML source, and editing a query string parameter. The only precondition is that the endpoint is reachable, which it is, since it is served publicly from apps.powerapps.com.

Finding it

I navigated to the following URL:

Text
https://apps.powerapps.com/authflow/authframe?telemetryLocation=global

The page displayed nothing. However, after viewing the HTML source, I noticed that the value of the telemetryLocation parameter was reflected into the page.

To confirm that I controlled the value, I changed the parameter from global to m3ez. The result proved that I could control the telemetryLocation value. A parameter that is echoed back into the markup is exactly the kind of thing worth testing for XSS, so I moved on to injection.

Exploitation

Step 1: confirm reflection of markup

I injected the following JavaScript payload into the parameter:

Text
</script>

The page reflected the payload without any input validation or sanitisation mechanism.

Step 2: build a working XSS payload

I then injected the following XSS payload into the telemetryLocation parameter:

Text
</script><body/onload=alert(`m3ez`)>

The first part closes a script element. The second part opens a body element with an onload handler, so the handler fires as soon as the injected element is parsed. The final URL was:

Text
https://apps.powerapps.com/authflow/authframe?telemetryLocation=</script><body/onload=alert(`m3ez`)>

After opening the link, the XSS payload executed. That confirmed the finding: the endpoint is vulnerable to reflected Cross-site Scripting.

Root cause

The telemetryLocation query parameter is written into the page's HTML without validation or sanitisation. The value is written into the page's HTML without validation or sanitisation, and the application does not neutralise the </script> sequence that lets an attacker introduce new markup with an event handler.

Impact

An attacker who can get a victim to open a crafted link to the authframe endpoint can execute JavaScript in the context of apps.powerapps.com. The report does not go further into what an attacker could reach from that origin, so the practical consequences beyond script execution in that origin are not established here. The victim has to click the crafted URL; the payload is reflected, not stored.

Reporting

After confirming the vulnerability, I reported it through the MSRC portal:

  1. Navigated to the MSRC Researcher Portal's "Report a Vulnerability" page.
  2. Entered the vulnerability details, including Impact, PoC and Evidence, and submitted the form.

Four days later the MSRC team replied and confirmed my report. The same day, the Microsoft bounty team replied that they were reviewing a possible bounty award, and a few hours later I received the news that the report was eligible.

On payment: Microsoft supports award delivery through either Bugcrowd or Microsoft Payment Central, and the bounty team asked which provider I preferred. A few weeks later I received an email from Bugcrowd containing a submission claiming link from the Microsoft Bug Bounty Program, and after claiming it I received my first reward from the programme. A few months later my name appeared on the 2022 Q3 leaderboard, and I was recognised on the quarterly leaderboard, with some MSRC swag as a reward.

Disclosure timeline

Date Event
Sep 23, 2022 Vulnerability discovered and reported through the MSRC portal
Sep 27, 2022 MSRC team confirmed; ticket moved to Review/Repro
Sep 27, 2022 MSRC status changed from Review/Repro to Develop
Dec 1, 2022 MSRC status changed to Pre-Release and Complete
Dec 23, 2022 Public release of the security advisory

Fix

The report does not describe the code change Microsoft made. The fix that addresses this class of bug is to stop writing the telemetryLocation value into the script context unescaped: either encode it for the context it lands in, or pass it through a data attribute or JSON block that is safely serialised, and validate it against an allowlist of expected values. Which of these Microsoft applied is not stated.

Variants to test

  • Other parameters on the same authframe endpoint: change each one to a unique marker and inspect the HTML source. A positive result is the marker appearing verbatim in the response, especially inside a <script> block.
  • The same telemetryLocation parameter on other Power Apps or authentication-flow endpoints: a positive result is the same reflection, and then the </script> probe breaking out of the script context.
  • Telemetry and location parameters on other Microsoft properties: these often carry low-risk-looking values that developers assume are safe. A positive result is a reflected value that survives into executable markup.
  • Any reflected value inside a script block: send </script> alone first. If it comes back unescaped, follow with a handler-bearing element such as the body/onload payload above and check whether it fires.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

A security researcher found a bug in a Microsoft website. The bug let him make a web page run his own small piece of code in the browser of anyone who opened a specially crafted link. Bugs like this are called Cross-site Scripting, or XSS for short. He reported it to Microsoft, Microsoft confirmed it, paid him a reward, and later put his name on a public list of top bug reporters for the third quarter of 2022, at position 44.

This article walks through the whole story from the beginning, assuming you have never done security testing before. You only need a computer and a web browser. Every technical word is explained the first time it appears, and there is a glossary at the end.

Part 0: who is writing, and what is the MSRC?

The author is Supakiad Satuwan, a security consultant from Thailand. This was his first valid bug on the Microsoft bug bounty programme. A bug bounty programme is a scheme where a company pays people outside the company for finding and reporting security problems in its products, instead of punishing them. The company gets a warning about a weakness before criminals find it, and the researcher gets money and recognition.

The organisation that runs this for Microsoft is the Microsoft Security Response Center, or MSRC. It is the part of Microsoft that works with security researchers to protect Microsoft's customers and the wider ecosystem. You can think of it as the front desk where reports of security problems are received, checked and tracked.

Part 1: choosing where to look

Microsoft runs several bounty programmes, each covering different products. Before starting, the author went to the Microsoft Bounty Programs page, which lists which programmes are in scope (meaning which products you are allowed to test and get paid for) and which are currently running.

After reading the list, he chose the Microsoft Dynamics 365 and Power Platform programme. Picking a programme first matters because testing a product that is not in scope means your report will not be accepted, no matter how good the bug is. It is like checking which races you are allowed to enter before you start training.

Part 2: the hunt

Looking at the target

He started on the Power Apps platform. Power Apps is a Microsoft service for building business applications, often with very little programming: you assemble screens and forms from ready-made pieces. Those apps run in a web browser and talk to Microsoft's servers in the background.

While watching how the platform and the apps on it behaved, he noticed that an application sent requests to https://apps.powerapps.com. A request is simply the browser asking a server for something, such as a page, an image or some data. Seeing traffic go to a particular address is a hint that there is something interesting to look at there, so he followed it.

He then opened this address in his browser:

Text
https://apps.powerapps.com/authflow/authframe?telemetryLocation=global

Let us take that address apart, because the whole bug lives in it.

  • https:// is the normal secure web protocol. It means the connection between your browser and the server is encrypted.
  • apps.powerapps.com is the name of the server. The apps part is a subdomain, a smaller section of the powerapps.com domain.
  • /authflow/authframe is the path. It points to a particular page on that server. The word authflow suggests it is part of the sign-in process, and authframe suggests it is a frame, a page designed to be shown inside another page.
  • ? marks the start of the query string, the part of a URL that carries extra information.
  • telemetryLocation=global is a parameter inside that query string. The name of the parameter is telemetryLocation and its value is global. Telemetry means measurements and status information that a program sends back to its maker, and a location here is presumably a label saying where the measurements come from.

The page displayed nothing visible. That is common for frames used behind the scenes during sign-in. But he did not stop at what was visible: he used the browser's "view source" feature, which shows the raw HTML that the server sent, the instructions the browser uses to build the page. In that source, he saw that the value of the telemetryLocation parameter, the word global, had been copied into the page.

This copying of a value from the request into the response is called reflection. It is worth pausing on why that matters. If a website takes something a visitor typed into the address bar and pastes it into the page without checking it, then the visitor controls part of the page's content. Normally that is harmless, but if the pasted text can include instructions that the browser treats as code, the visitor can make the page do things the site's authors never intended.

To confirm he really was in control, he changed the value from global to m3ez, his own handle. The page showed m3ez where global had been. That proved the value was not fixed by the server but came straight from the URL, and that anyone could put anything they liked there.

Trying an injection

A value that is echoed back into a page is exactly the kind of thing to test for XSS. Cross-site Scripting is a class of bug where an attacker manages to get their own JavaScript, the programming language that browsers run, executed as part of a page belonging to someone else. The name comes from the idea that script from one place ends up running in the context of another. The danger is that the browser cannot tell the difference between code the site wrote and code an attacker slipped in: both run with the same trust, and can do anything the site itself could do in that tab.

There are two main flavours. Reflected XSS means the malicious value travels in the request and is echoed straight back in the response, so the victim has to be tricked into opening a crafted link. Stored XSS means the value is saved on the server, for example in a comment, and served to everyone who later views the page. This case is the reflected kind.

His first probe was this:

Text
</script>

In plain words: </script> is the HTML tag that marks the end of a block of script. HTML is written as a series of tags, and most come in pairs, an opening tag such as <script> and a closing tag such as </script>. If a value is placed inside a script block and the site does not neutralise a closing tag that arrives in that value, the browser believes the script has ended there. Everything after it is then treated as ordinary page markup, which the attacker can shape.

So sending </script> is a cheap way to ask one question: does the site let my text through unchanged? The answer here was yes. The page reflected the payload with no input validation or sanitisation. Validation means checking that a value looks like what it is supposed to be, for example that a location is one of a known set of words. Sanitisation means cleaning a value so that any dangerous characters in it can no longer act as code. Neither was happening.

Building a working payload

With the closing tag confirmed, he sent this into the telemetryLocation parameter:

Text
</script><body/onload=alert(`m3ez`)>

Line by line, in plain words:

  • </script> closes a script block, exactly as in the probe.
  • <body/onload=alert(m3ez)> opens a body element, the part of an HTML page that holds its visible content, and attaches an event handler to it. An event handler is a piece of code that the browser runs when something happens. onload means "when this element has finished loading". So the browser is told: as soon as this body element is ready, run the code that follows.
  • alert(m3ez) is the code that runs. alert is a built-in browser function that pops up a small dialog box showing a message. The message here is m3ez, the author's handle. It is deliberately harmless: a pop-up proves code ran, without doing anything else. In a real attack, this is where an attacker would put code that steals data or performs actions on the victim's behalf.

The final URL was:

Text
https://apps.powerapps.com/authflow/authframe?telemetryLocation=</script><body/onload=alert(`m3ez`)>

This is the same address as before, with the crafted payload in place of global. When he opened it, the payload executed: the browser ran his code as part of the Microsoft page. That confirmed the finding. The endpoint is vulnerable to reflected Cross-site Scripting.

Why the bug existed

The telemetryLocation query parameter was written into the page's HTML without validation or sanitisation. The value was written into the page's HTML, and the application did not neutralise the </script> sequence that lets an attacker introduce new markup with an event handler.

What an attacker could do with it

An attacker who can persuade a victim to open a crafted link to the authframe endpoint can run JavaScript in the context of apps.powerapps.com. "In the context of" means the code runs as if it belonged to that site, with the same access the site's own code has in that tab. The victim has to click the crafted URL, because the payload is reflected and not stored. The report does not go further into what an attacker could reach from that origin, so the practical consequences beyond script execution there are not established.

Part 3: reporting it

Once he had confirmed the vulnerability, he reported it through the MSRC portal. The portal is a website where researchers submit findings and track what happens to them. The steps were:

  1. Navigate to the MSRC Researcher Portal's "Report a Vulnerability" page.
  2. Enter the vulnerability details, including Impact, PoC and Evidence, and submit the form.

A few of those words are worth unpacking. Impact is a description of what harm the bug could cause and who is affected. PoC, short for proof of concept, is the smallest reliable demonstration that the bug is real, here the crafted URL and the pop-up it produces. Evidence is the supporting material, such as a screenshot of the pop-up.

Four days later, the MSRC team replied and confirmed the report. The same day, the Microsoft bounty team replied that they were reviewing a possible bounty award, and a few hours later came the news that the report was eligible.

Part 4: getting paid

Microsoft delivers bounty awards through either Bugcrowd or Microsoft Payment Central, and the bounty team asked which provider he preferred. Bugcrowd is a company that runs bug bounty programmes on behalf of clients and handles the payments. A few weeks later he received an email from Bugcrowd containing a submission claiming link from the Microsoft Bug Bounty Program. After claiming it, he received his first reward from the programme.

A few months later his name appeared on the 2022 Q3 leaderboard, the public ranking of researchers for that quarter, and he was recognised on the quarterly leaderboard, with some MSRC swag as a reward.

Disclosure timeline

A disclosure timeline records when each stage of a bug's life happened, from discovery to the public advisory, the notice Microsoft publishes about a fixed security issue.

Date Event
Sep 23, 2022 Vulnerability discovered and reported through the MSRC portal
Sep 27, 2022 MSRC team confirmed; ticket moved to Review/Repro
Sep 27, 2022 MSRC status changed from Review/Repro to Develop
Dec 1, 2022 MSRC status changed to Pre-Release and Complete
Dec 23, 2022 Public release of the security advisory

How it was fixed

The report does not describe the code change Microsoft made. The general fix for this class of bug is to stop writing the telemetryLocation value into the script context unescaped: either encode it for the context it lands in, or pass it through a data attribute or JSON block that is safely serialised, and validate it against an allowlist of expected values. Encoding means converting characters that have a special meaning in HTML into harmless equivalents, so they display as text rather than acting as code. An allowlist is a list of values that are permitted, with everything else rejected. Which of these Microsoft applied is not stated.

Other places to look for the same bug

  • Other parameters on the same authframe endpoint: change each one to a unique marker and inspect the HTML source. A positive result is the marker appearing verbatim in the response, especially inside a <script> block.
  • The same telemetryLocation parameter on other Power Apps or authentication-flow endpoints: a positive result is the same reflection, and then the </script> probe breaking out of the script context.
  • Telemetry and location parameters on other Microsoft properties: these often carry low-risk-looking values that developers assume are safe. A positive result is a reflected value that survives into executable markup.
  • Any reflected value inside a script block: send </script> alone first. If it comes back unescaped, follow with a handler-bearing element such as the body/onload payload above and check whether it fires.

Glossary

  • Allowlist: a list of values that are explicitly permitted, with everything else rejected.
  • Bug bounty programme: a scheme in which a company pays outside researchers for finding and reporting security problems in its products.
  • Bugcrowd: a company that runs bug bounty programmes for clients and handles reward payments.
  • Cross-site Scripting (XSS): a bug class where an attacker gets their own JavaScript to run as part of another site's page.
  • Disclosure timeline: a record of when each stage of a bug, from discovery to public advisory, happened.
  • Encoding: converting characters with special meaning in HTML into harmless equivalents so they display as text.
  • Event handler: code the browser runs when something happens, such as an element finishing loading.
  • Evidence: supporting material for a report, such as a screenshot of the bug in action.
  • HTML: the language used to describe the structure and content of web pages.
  • Impact: a description of what harm a bug could cause and who is affected.
  • JavaScript: the programming language that browsers run to make pages interactive.
  • MSRC (Microsoft Security Response Center): the part of Microsoft that works with security researchers to protect its customers and the wider ecosystem.
  • Parameter: a named value carried in a URL's query string, such as telemetryLocation=global.
  • PoC (proof of concept): the smallest reliable demonstration that a bug is real.
  • Power Apps: a Microsoft service for building business applications, often with little programming.
  • Query string: the part of a URL after the ? that carries extra information.
  • Reflected XSS: XSS where the malicious value travels in the request and is echoed straight back, so the victim must open a crafted link.
  • Reflection: a website copying a value from the request into its response.
  • Request: the browser asking a server for something, such as a page or some data.
  • Sanitisation: cleaning a value so that dangerous characters in it can no longer act as code.
  • Stored XSS: XSS where the malicious value is saved on the server and served to everyone who later views the page.
  • Subdomain: a smaller section of a domain, such as apps in apps.powerapps.com.
  • Telemetry: measurements and status information a program sends back to its maker.
  • Validation: checking that a value looks like what it is supposed to be.
  • View source: a browser feature that shows the raw HTML the server sent.

More by Supakiad S

View all

3 more disclosed reports, best first.

More from Microsoft

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.