How I found an XSS vulnerability via using emojis
The site's input filter removed common XSS characters but mishandled emoji and other Unicode input, allowing an attacker to inject a working script payload. An attacker could execute JavaScript in a victim's browser.
Published on medium.com
One day I was working on Swisscom’s bug bounty program and I found a subdomain let’s call now redacted.swisscom.ch
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 server applied character encoding conversions (Windows-1252 to UTF-8, then UTF-8 to ASCII) after filtering, which turned benign Unicode characters into dangerous ones like < and >.
Impact
An attacker could execute arbitrary JavaScript in a victim's browser, potentially stealing data or performing actions as the victim.
What the attacker needed
Victim visits a crafted URL
How it was found
- Find a subdomain and test its parameters for XSS.
- Notice that common malicious characters are removed.
- Try emoji and Unicode characters and observe that some produce quote characters.
- Use a GitHub emoji list to find characters that also produce angle brackets.
- Craft a payload using an emoji that becomes an image tag with an error handler.
- Reproduce the encoding behaviour locally with a PHP script to understand the conversion.
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 into a page that other people view. Here the site tried to block dangerous characters, but emojis and other Unicode characters slipped through and turned into the characters needed for an attack.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.