Reflected XSS bypass using Double Encoding
A reflected HTML injection point was being auto-uppercased by the site, which broke normal script payloads. By double-encoding the payload (URL-encoding the HTML entities), the author got lowercase letters through and achieved reflected cross-site scripting.
medium.com
Published on medium.com
Double encoding can bypass WAF detection and also evade automatic string conversion on the parameter we're injecting. Here's an example:
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 application reflected user input into HTML without proper output encoding, and its uppercase conversion was applied before the browser decoded HTML entities, so encoded characters slipped through.
Impact
An attacker could run script in a victim's browser in the context of the site, which could be used to read data or act as the user.
What the attacker needed
Victim clicks a crafted link; reflected parameter is reachable
The fix
The site should HTML-encode reflected input on output rather than relying on an uppercase conversion as a filter.
How it was found
- Inject a simple HTML tag into the result parameter and confirm it is reflected in the page source.
- Notice that the reflected text is automatically converted to uppercase.
- Try HTML entity encoding for the letters and observe that the ampersand and hash characters break the payload.
- URL-encode the ampersand and hash so the entities survive, and confirm lowercase letters appear.
- Build a full SVG onload payload using the double-encoded letters and confirm the alert fires.
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.
The page echoed back whatever was typed into a URL parameter, so an attacker could inject HTML. The site then forced all letters to uppercase, which broke the usual script. The author hid the letters inside encoded characters so the browser decoded them back to lowercase after the site had done its uppercasing, and the script ran.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.