Inappropriate implementation in CSS (CVE-2026-17878)
The CSS serialiser for the font-feature-settings property wrapped the OpenType tag in double quotes without escaping characters inside it, even though the parser accepts quotes, backslashes and braces in a tag. If an application reads an element's cssText and reinserts it into a style block, an attacker could break out of the string and inject arbitrary CSS.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 49 days
Flapjack, 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: The CSSFontFeatureValue::CustomCSSText() method fails to escape double quotes when serializing the font-feature-settings property. An attacker can use CSS hex escapes to inject a tag containing quotes, which is valid per OpenType specs. When the element's cssText is serialized and reused in a <style> block, it can lead to arbitrary CSS injection.
Affected files:
third_party/blink/renderer/core/css/css_font_feature_value.ccthird_party/blink/renderer/core/css/properties/css_parsing_utils.cc
Estimated timestamp from git blame: 2018-01-29
Summary
A serialization bug in CSSFontFeatureValue::CustomCSSText() allows for potential CSS injection and mutation XSS (mXSS). The method manually serializes the font feature tag_ member by wrapping it in double quotes without escaping internal characters. Because the CSS parser correctly allows characters in the range [0x20, 0x7E] for OpenType tags (including quotes and braces), an attacker can craft a 4-character tag that breaks out of the CSS string context upon serialization.
Root Cause
In third_party/blink/renderer/core/css/properties/css_parsing_utils.cc (ConsumeFontSettingsTagAndValue), the parser validates the font feature tag. It ensures the tag is exactly 4 characters long and that each character is between 0x20 and 0x7E. This range intentionally includes characters like " (0x22), \ (0x5C), and } (0x7D).
However, in third_party/blink/renderer/core/css/css_font_feature_value.cc, the CustomCSSText() function manually concatenates the tag value during serialization:
String CSSFontFeatureValue::CustomCSSText() const {
StringBuilder builder;
builder.Append('"');
builder.Append(tag_);
builder.Append('"');
// ...
Because tag_ is not properly escaped, an attacker can inject quotes that prematurely close the serialized string.
Potential Exploitation Scenario
Note: These are suggested steps based on code analysis; a working proof of concept has not been executed.
An attacker can exploit this if a web application or DOM sanitizer reads an element's cssText and places it into a <style> block (a common pattern for CSP compliance or shadow DOM styling).
- The attacker controls an inline style and injects a 4-character payload using CSS hex escapes:
// Inject the tag `"}/*`
element.style.fontFeatureSettings = '"\\22\\7d\\2f\\2a"';
// Inject a custom property to hold the rest of the payload
element.style.setProperty('--payload', '*/ body { background: red; } /*');
-
The browser parses these successfully. When the application reads
element.style.cssText, Blink'sStylePropertySerializerserializes the properties. -
Due to the lack of escaping, the resulting
cssTextbecomes:
font-feature-settings: ""}/*"; --payload: */ body { background: red; } /*;
- The application inserts this into a
<style>block, e.g.:
<style>.user-rule { font-feature-settings: ""}/*"; --payload: */ body { background: red; } /*; }</style>
- When the browser parses this new
<style>block:""completes thefont-feature-settingsstring.}prematurely closes the.user-ruleCSS block./*starts a CSS comment that swallows the remainder of the first line.*/(from the custom property) closes the comment.- The attacker's injected CSS
body { background: red; }is evaluated as active CSS in the global scope.
Impact
This vulnerability can be leveraged to bypass application-level CSS sanitizers that rely on the browser's CSS serialization. This can lead to CSS-based data exfiltration or UI spoofing.
Suggested Fix
In third_party/blink/renderer/core/css/css_font_feature_value.cc, use SerializeString(tag_, builder) (available via third_party/blink/renderer/core/css/css_markup.h) instead of manually appending quotes. This ensures the tag is properly escaped, matching the correct behavior already implemented in CSSFontVariationValue::CustomCSSText().
Evaluated with Chrome root at commit: 2155cb00003ec35716a76ed3246eae995f87b7ff
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
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 serialiser concatenated the tag between literal quote characters instead of using the existing string-escaping helper, while the parser deliberately allowed quote, backslash and brace characters in tags.
Impact
Could bypass application-level CSS sanitizers that rely on the browser's serialisation, potentially leading to CSS-based data exfiltration or UI spoofing, but only where an application reuses cssText in a style block and no working proof of concept was executed.
What the attacker needed
App copies cssText into a style block; attacker controls an inline style value
The fix
The serialiser should use the existing string-escaping helper for the tag instead of appending raw quotes, matching the variation-value serialiser.
How it was found
- Set the element's font-feature-settings to a four-character tag written with CSS hex escapes so it contains a quote and a brace.
- Set a custom property on the same element holding the rest of the injected CSS.
- Read the element's cssText, which the browser serialises without escaping the tag.
- Insert that serialised text into a style block in the page.
- The browser parses the new style block, the brace closes the rule early and the injected CSS applies globally.
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.
Browsers turn style rules into text when a page asks for them, and that text is meant to be safe to reuse. Here the browser put a value inside quote marks but did not escape quote marks that were already part of the value, so the text could contain a quote that ends the string early. A site that copies this text into a new style block could then run CSS the attacker chose.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.