From Sign-Up to Stored XSS in Profile: A Real Bug Bounty Report
The application blocked raw HTML in sign-up fields via ASP.NET request validation, but URL-encoded input bypassed this and was later rendered unencoded into an image tag's attribute in the profile page. An attacker could store a script that executes when other users view or interact with the profile.
medium.com
Published on medium.com
In this post, I’ll walk you through how I discovered a Stored XSS vulnerability during a bug bounty program.
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
The application relied only on request-side validation that could be bypassed with URL encoding, and failed to output-encode user data before rendering it into an HTML attribute.
Impact
Because the payload is stored, it executes for every user who views the profile page, allowing an attacker to steal cookies or session tokens, inject phishing content, deface the page, or load external malicious scripts.
What the attacker needed
Ability to sign up or log in; victim views the profile page; victim hovers over the image
The fix
The application should apply output encoding (HtmlEncode) before rendering user data, strip dangerous event-handler attributes, and use whitelisting for allowed input rather than blacklisting.
How it was found
- Submit a raw HTML tag in the FName field and observe the ASP.NET request validation error.
- Encode the payload with URL encoding and submit it again; the request is accepted.
- View the profile page and see the input rendered inside an img tag attribute.
- Hover over the image to trigger the stored script.
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.
A stored cross-site scripting (XSS) bug lets an attacker save malicious code in a website's database, so it runs in other visitors' browsers later. Here, the site checked for obvious HTML when you signed up, but a different encoding slipped past that check, and the profile page then placed the saved text directly into the page without making it safe.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.