Skip to content
XSS Write-up Intermediate

How I Found an XSS Vulnerability in a Microsoft subdomain

A Microsoft subdomain's contact form did not properly sanitise the subject field, allowing a stored cross-site scripting payload to execute when the message was viewed. An attacker could run JavaScript in the context of the admin who viewed the message, potentially stealing session cookies or CSRF tokens.

medium.com

Published on medium.com

It started out like any other day. In the evening, on my laptop, and the familiar feeling that maybe, just maybe, today I’d find something interesting.

Anonymousshetty, 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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the subject field was reflected into the page without sufficient output encoding, allowing HTML and JavaScript to break out of the intended context.

Impact

An attacker could execute JavaScript in the context of an administrator viewing the message, potentially exfiltrating session cookies or CSRF tokens, though a web application firewall blocked some payloads and a fetch-based exfiltration attempt was blocked.

What the attacker needed

Access to a message form on a Microsoft subdomain; victim (admin) views the submitted message; WAF bypass needed for some payloads

The fix

The report says Microsoft confirmed the issue and began mitigation steps, but does not state the exact fix; proper output encoding of the subject field should be applied.

How it was found

  1. Find a Microsoft subdomain with a feature to send a message to the admin.
  2. Send messages and check the developer console to see whether the subject input is sanitised.
  3. Try a payload from a LinkedIn post and observe that the response breaks out of the normal HTML flow.
  4. Send many variations until a payload is accepted and displays a clickable link.
  5. Click the link and confirm the JavaScript executes.
  6. Craft a payload that sends the document cookie to an external collaborator and confirm the pingback.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Cross-site scripting (XSS) is when a website lets an attacker sneak JavaScript code into a page that other people view. Here, a message form saved the attacker's code and showed it to an administrator, so the code ran in the administrator's browser. That could let the attacker read the administrator's session cookie, which is like a temporary login pass.

What is XSS?

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

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.