MIME sniffing XSS
A researcher found stored cross-site scripting on Google sites where the response used a non-HTML content type, so the script would only run if the browser sniffed the content as HTML. Google accepted several such reports and paid bounties even though no working proof of concept was produced.
Published on komodosec.com
Let’s start at the end. This one got me seriously confused.
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 returned user-controlled content with a non-HTML content type and without the nosniff header, so a browser could sniff it as HTML and execute embedded script.
Impact
An attacker could run script in a victim's browser only if that browser sniffed the stored content as HTML; the author notes no working proof of concept was made and that some Google engineers doubted the risk.
What the attacker needed
Stored user input on a Google site; browser sniffs content as HTML; victim views the stored content
The fix
Servers should send the X-Content-Type-Options: nosniff header and encode user-controlled output, though the text does not say a specific fix was applied.
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.
When a server sends a file, it labels it with a content type, such as 'this is an image' or 'this is a web page'. Some browsers ignore that label and guess from the file's contents instead, which is called MIME sniffing. If a site stores text a user controls and the browser guesses it is a web page, any script inside it can run, which is cross-site scripting.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.