Insufficient validation of untrusted input in SanitizerAPI (CVE-2026-14023)
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 32 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: The HTML Sanitizer API's safe-mode URL stripping can potentially be bypassed by using prefixed HTML or SVG elements in XML-parsed contexts (e.g. calling ShadowRoot.setHTML on an XHTML host). This is due to a prefix-sensitive comparison check in SanitizeJavascriptNavigationAttributes that fails to match and sanitize navigation URLs for elements that carry a prefix. As a result, untrusted inputs containing javascript: URLs can bypass safe-mode sanitization and potentially execute arbitrary script upon interaction.
Affected files:
third_party/blink/renderer/core/sanitizer/sanitizer.cc
Estimated timestamp from git blame: 2025-02-21
Root Cause Analysis
In Sanitizer::SanitizeJavascriptNavigationAttributes (located in third_party/blink/renderer/core/sanitizer/sanitizer.cc), the sanitizer implements safe-mode URL stripping for navigation attributes. It performs comparison checks on element tags using QualifiedName::operator==:
const QualifiedName& qname = element->TagQName();
if (qname == html_names::kATag || qname == html_names::kAreaTag ||
qname == html_names::kBaseTag) {
RemoveAttributeIfProtocolIsJavaScript(element, html_names::kHrefAttr);
} else if (qname == svg_names::kATag || ...) { ... }
However, QualifiedName::operator== performs pointer-equality of the internal implementation (impl_), which is prefix-sensitive:
bool operator==(const QualifiedName& other) const { return impl_ == other.impl_; }
By contrast, QualifiedName::Matches is prefix-insensitive:
bool Matches(const QualifiedName& other) const {
return impl_ == other.impl_ || (LocalName() == other.LocalName() &&
NamespaceURI() == other.NamespaceURI());
}
Most other parts of the Sanitizer (such as element/attribute filtering via SanitizerNameSet and SanitizerNameMap) use Matches (prefix-insensitive). This means a prefixed element, such as <h:a xmlns:h='http://www.w3.org/1999/xhtml'>, is successfully recognized as an anchor element and kept by ActionForNode and SanitizeElement. But when it reaches SanitizeJavascriptNavigationAttributes, {prefix:"h",local:"a",ns:xhtml} == {prefix:null,local:"a",ns:xhtml} evaluates to false. As a result, the element falls through all arms of SanitizeJavascriptNavigationAttributes without having its javascript: URL stripped from the navigation attribute (e.g., href).
Suggested Potential Trigger Path
Note: These are potential steps to trigger the issue, as our automated analysis tools do not have the capability to execute code or run a live proof of concept.
-
A page is served with the
application/xhtml+xmlMIME type, causing it to be parsed as XHTML. -
The script on the page calls
shadowRoot.setHTML(untrusted)with an untrusted input containing a prefixed HTML/SVG element containing ajavascript:URL in a navigation attribute:HTML <h:a xmlns:h="http://www.w3.org/1999/xhtml" href="javascript:alert(document.domain)">Click Me</h:a> -
Because
force_htmlis not set by default during XHTML shadow root HTML insertion, the XML parser path is taken. -
The XML parser parses
<h:a>and constructs a realHTMLAnchorElementwithTagQNamecontaining a prefix. -
The sanitizer processes the node:
ActionForNodeandSanitizeElementcheck the element using prefix-insensitive maps, allowing it and itshrefattribute to persist. -
SanitizeJavascriptNavigationAttributesfails to match the prefix-sensitiveqname == html_names::kATagcomparison, bypassing the safety check and leaving thehref="javascript:..."value intact. -
The unsanitized anchor element is inserted into the shadow root. If a user clicks it, the JavaScript payload executes.
Suggested Fix
Update Sanitizer::SanitizeJavascriptNavigationAttributes in third_party/blink/renderer/core/sanitizer/sanitizer.cc to use prefix-insensitive comparisons. This can be done by changing the == operator checks on QualifiedName to use .Matches(). For example:
const QualifiedName& qname = element->TagQName();
if (html_names::kATag.Matches(qname) || html_names::kAreaTag.Matches(qname) ||
html_names::kBaseTag.Matches(qname)) {
RemoveAttributeIfProtocolIsJavaScript(element, html_names::kHrefAttr);
} else if (svg_names::kATag.Matches(qname) || ...)
Additionally, review other places in sanitizer.cc where == or != is used on QualifiedName objects (such as CHECK_NE assertions on element tags or the name == html_names::kHTMLTag check in ReplaceElement) and convert them to use .Matches() to avoid similar prefix-sensitive bypasses of security hardening checks.
Evaluated with Chrome root at commit: fb72408a8493c46bc75fae1c70d03daec96b3040
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.
What is known
A medium-severity XSS bug in SanitizerAPI (Google Chrome). Chrome VRP made it public on 30 June 2026 as CVE-2026-14023. Fixed in version 150.0.7871.46.
About XSS
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.