Inappropriate implementation in CSS (CVE-2026-11186)
The CSS serialization logic for the type() component of image-set() fails to escape special characters, breaking the CSSOM round-trip invariant. An attacker could smuggle arbitrary CSS declarations past sanitizers that rely on the browser's serialization, potentially leading to UI redressing or data exfiltration.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 49 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team. Please see go/chrome-ai-generated-security-bugs-faq for more information.
Overview: The serialization logic for CSSImageSetTypeValue fails to escape special characters like double quotes when outputting its .cssText. This breaks the CSSOM round-trip invariant, allowing an attacker to smuggle arbitrary CSS declarations past sanitizers using CSS escape sequences. This constitutes a potential CSS mutation Cross-Site Scripting (mXSS) vulnerability.
Affected files:
third_party/blink/renderer/core/css/css_image_set_type_value.ccthird_party/blink/renderer/core/css/css_image_set_option_value.ccthird_party/blink/renderer/core/css/css_image_set_value.cc
Estimated timestamp from git blame: 2023-03-03
Summary
A potential CSS mutation Cross-Site Scripting (mXSS) vulnerability exists in the CSS serialization logic for the type() component of the image-set() function. The vulnerability allows an attacker to inject arbitrary CSS declarations into a stylesheet by exploiting a serialization flaw that fails to escape special characters.
Technical Details
When a CSS property containing an image-set() function is parsed, the Blink CSS tokenizer correctly decodes CSS escape sequences. For example, \22 is decoded to a literal double quote (") and \29 to a literal closing parenthesis ()).
The parsed string is stored in a CSSImageSetTypeValue object. However, when the CSSOM tree is serialized back to a string (e.g., when a script reads element.style.cssText), the CustomCSSText() method in third_party/blink/renderer/core/css/css_image_set_type_value.cc fails to properly escape this string:
String CSSImageSetTypeValue::CustomCSSText() const {
StringBuilder result;
result.Append("type(\"");
result.Append(type_); // <--- Bug: Raw string appended without escaping
result.Append("\")");
return result.ReleaseString();
}
Unlike other string-based CSS values (such as CSSStringValue), CSSImageSetTypeValue does not use the blink::SerializeString() helper function (defined in css_markup.cc). Because it blindly concatenates the unescaped type_ string, any literal quotes or parentheses injected by the attacker are emitted raw into the serialized output.
Attack Scenario & Potential Impact
This flaw breaks the parse -> serialize -> parse idempotency invariant. Attackers can leverage this to bypass DOM sanitizers (like DOMPurify) or server-side CSS validators that rely on the safety of the browser's CSSOM serialization.
- An attacker provides a payload like
image-set(url(x) 1x type("a\22 \29 \29 ;color:red;--x:\22 "))to a vulnerable application. - The initial parser decodes the string safely, storing it in the CSSOM.
- A sanitizer reads
.cssTextto validate or sanitize the DOM. The serialized output becomesbackground-image: image-set(url("x") 1x type("a" ) ) ;color:red;--x:" "));. - The sanitizer assigns the "safe" string back to an element.
- Upon reparsing, the literal quotes and parentheses break out of the
type()andimage-set()functions, causing the browser to evaluatecolor:red;as a new, valid CSS declaration.
This can be exploited to inject arbitrary CSS properties, leading to UI redressing or sensitive data exfiltration (e.g., via injected background-image requests based on user interaction).
Suggested Reproduction Steps
Note: These steps demonstrate the logic flaw using browser APIs; our tooling agent cannot execute code to verify the exploit directly.
-
Open the browser console.
-
Create a div and assign a crafted
image-setpayload:JavaScript const d = document.createElement('div'); d.style.backgroundImage = 'image-set(url(x) 1x type("a\\22 \\29 \\29 ;color:red;--x:\\22 "))'; -
Read the serialized CSS text:
JavaScript console.log(d.style.cssText); // Output contains literal unescaped characters: background-image: image-set(url("x") 1x type("a" ) ) ;color:red;--x:" ")); -
Trigger the round-trip parse by assigning the serialized text back:
JavaScript d.setAttribute('style', d.style.cssText); -
Verify that the injected property was parsed:
JavaScript console.log(d.style.color); // Expected: "red"
Suggested Fix
Update CSSImageSetTypeValue::CustomCSSText() to use the blink::SerializeString() function, similar to how CSSStringValue handles string serialization. This will ensure that special characters within the MIME type string are correctly escaped.
#include "third_party/blink/renderer/core/css/css_markup.h"
String CSSImageSetTypeValue::CustomCSSText() const {
StringBuilder result;
result.Append("type(");
SerializeString(type_, result);
result.Append(")");
return result.ReleaseString();
}
Evaluated with Chrome root at commit: 661452647ddb2827305122ff3273bd5dea403f09
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
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 CustomCSSText() method for CSSImageSetTypeValue concatenates the raw type string without using the standard escaping helper, so special characters are emitted unescaped.
Impact
This could allow an attacker to bypass DOM sanitizers or server-side CSS validators, leading to UI redressing or sensitive data exfiltration via injected background-image requests based on user interaction.
What the attacker needed
Attacker can supply CSS containing image-set(); sanitizer relies on cssText serialization
The fix
The CustomCSSText() method should be updated to use the blink::SerializeString() helper to properly escape special characters.
How it was found
- Open the browser console.
- Create a div and assign a crafted image-set payload to its backgroundImage style.
- Read the serialized CSS text from the style's cssText property.
- Assign the serialized text back to the element's style attribute.
- Check the element's style.color property to see if the injected declaration was parsed.
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.
When a browser reads CSS code, it stores it in a structured form and can write it back out as text. This report says that for one specific CSS feature, the browser writes the text back without properly escaping certain characters, so the text can look different from what was originally parsed. A security tool that checks the text might be fooled into thinking it is safe, allowing extra CSS rules to sneak in.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.