Skip to content
XSS Disclosed report Intermediate CVE-2019-11715

Incorrect parsing of style tag leads to XSS if HTML+CSS is allowed but no JS

A CSS parser bug in Firefox allows an attacker to bypass a JavaScript filter that permits HTML and CSS but blocks JavaScript. By crafting a style tag with a malformed closing sequence, the attacker can inject an SVG element with an onload handler that executes JavaScript.

Linus Särud Follow

Originally disclosed on Mozilla

  • Fixed in 17 days
  • Paid in 26 days
  • Disclosed after 17 days
Text
I was pentesting a web-site with a Javascript-filter. It wanted to allow HTML+CSS but no Javascript. During the assessment I found a CSS-parser bug in Firefox, where the parsing is different from other tested web browsers (Chrome/Safari) in how you terminate CSS.

This trick allowed me to bypass their protection and I think it is likely it will work in other places as well.

This was tested on the latest stable/regular version on OSX.

PoC: https://playground.zulln.se/poc/firefoxcss.html

Source code:
<style></style</style><img src="</style><svg/onload=alert(document.domain)>">

The original report as published on Mozilla's Bugzilla, by Linus Särud. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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

How it worked

Root cause

Likely the CSS parser in Firefox incorrectly handles the termination of a style tag when it contains a malformed closing sequence, allowing subsequent HTML to be parsed as part of the style content or vice versa, leading to script execution.

Impact

An attacker could bypass the JavaScript filter and execute arbitrary JavaScript in the context of the vulnerable website when viewed in Firefox, potentially leading to data theft or other client-side attacks.

What the attacker needed

Victim uses Firefox; website allows HTML+CSS but filters JavaScript; attacker can inject HTML

How it was found

  1. Identify a website that allows HTML and CSS but filters JavaScript.
  2. Craft a style tag with a malformed closing sequence that Firefox parses differently.
  3. Include an SVG element with an onload handler that executes JavaScript.
  4. Load the page in Firefox to trigger the alert.

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 report has not been written yet. The Original tab links to the source.

Websites often try to block dangerous code (JavaScript) while allowing safe content like HTML and CSS. This report shows that Firefox interprets a broken style tag differently from other browsers, letting an attacker sneak in JavaScript that runs when the page loads. The trick relies on a specific way of closing the style tag that Firefox mishandles.

What is XSS?

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

More by Linus Särud

View all

1 more disclosed report, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

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.