Policy bypass in Blink (CVE-2026-11292)
A logic flaw in Blink's HTML parser allows speculative preloads to bypass a restrictive <meta> Content Security Policy when an HTTP CSP header is also present. An attacker could exfiltrate data or initiate cross-origin fetches that the <meta> CSP intended to block.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 50 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.
Overview: A logic flaw in HTMLDocumentParser allows speculative preloads to bypass a restrictive <meta> Content Security Policy. The parser incorrectly compares the total number of applied CSP policies (which includes HTTP headers) against the count of <meta> CSP tags seen by the preload scanner. If a page has an HTTP CSP header and a <meta> CSP tag, preloads can be dispatched before the <meta> tag's policy is actually enforced.
Affected files:
third_party/blink/renderer/core/html/parser/html_document_parser.ccthird_party/blink/renderer/core/html/parser/html_preload_scanner.ccthird_party/blink/renderer/core/frame/csp/content_security_policy.ccthird_party/blink/renderer/core/loader/document_loader.ccthird_party/blink/renderer/core/loader/http_equiv.cc
Estimated timestamp from git blame: 2025-03-26
Summary
A potential vulnerability exists in the speculative preloading logic of Blink's HTML parser when the experimental AllowPreloadingWithCSPMetaTag feature is enabled.
The HTMLDocumentParser::AllowPreloading() function attempts to gate speculative preloads until all CSP <meta> tags discovered by the preload scanner have been fully processed by the HTML tree builder. However, the synchronization logic is flawed: it compares the total count of parsed CSP policies (which includes policies delivered via HTTP response headers) against the number of <meta> CSP tags encountered by the scanner. If an HTTP CSP policy is present, the equality check can pass prematurely, allowing preloads to bypass a restrictive <meta> CSP tag.
Technical Details
In third_party/blink/renderer/core/html/parser/html_document_parser.cc, the AllowPreloading() function contains the following check:
return static_cast<int>(csp->GetParsedPolicies().size()) == seen_csp_meta_tags_;
csp->GetParsedPolicies().size(): This returns the total number of policies in theContentSecurityPolicyobject. Crucially, this vector is populated at navigation commit with any policies derived from HTTP headers (includingContent-Security-Policy-Report-Only).seen_csp_meta_tags_: This counter is incremented by theHTMLPreloadScanneronly when it encounters a<meta http-equiv="content-security-policy">tag in the HTML markup.
Because these two values measure different things, an attacker can manipulate them to match prematurely.
Potential Attack Scenario
Note: The following steps describe a theoretical attack sequence based on code analysis; a functional exploit has not been executed.
- The attacker serves (or finds) a page that returns an HTTP response header, such as
Content-Security-Policy-Report-Only: default-src 'self'. During navigation commit, this policy is added, soGetParsedPolicies().size()equals 1. - The attacker injects HTML (e.g., via XSS) containing a restrictive CSP meta tag:
<meta http-equiv="content-security-policy" content="default-src 'none'">. - Immediately following the meta tag, the attacker injects a resource load that would normally be blocked, e.g.,
{{media:0}}. - The
HTMLPreloadScannerscans the markup. It sees the<meta>tag and incrementsseen_csp_meta_tags_to 1. - The scanner queues the attacker's
<img>preload and yields back to theHTMLDocumentParser. - The parser calls
AllowPreloading()to see if the queued preload can be dispatched. - The check
!csp->IsActive()is bypassed becauseIsActive()returns true if any policy is present (including the header). - The parser evaluates
GetParsedPolicies().size() == seen_csp_meta_tags_. Since both are 1, it incorrectly returnstrue. - The attacker's speculative preload is dispatched over the network to
attacker.example, successfully bypassing the restrictive<meta>CSP. - Later, the main HTML tree builder processes the
<meta>tag and adds its policy (bringingGetParsedPolicies().size()to 2), but it is too late to block the leak.
Impact
This results in a renderer-side CSP bypass, allowing an attacker to exfiltrate data or initiate cross-origin fetches that the page's <meta> CSP intended to block. The impact is currently limited by the fact that the AllowPreloadingWithCSPMetaTag runtime feature is experimental.
Suggested Fix
To fix this synchronization issue, the parser must compare comparable counts.
One approach is to track the number of parsed meta tag policies specifically. ContentSecurityPolicy could maintain a separate counter or expose a method like GetParsedMetaPoliciesCount() that AllowPreloading() checks against seen_csp_meta_tags_.
Alternatively, seen_csp_meta_tags_ could be initialized at navigation commit to the number of HTTP header policies present, effectively transforming it into an expected_total_policies_ counter.
Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b
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
The parser compares the total number of parsed CSP policies (including HTTP headers) with the number of <meta> CSP tags seen by the preload scanner, so the counts can match prematurely.
Impact
This could allow an attacker to exfiltrate data or initiate cross-origin fetches that the page's <meta> CSP intended to block, though the impact is limited because the feature is experimental.
What the attacker needed
Experimental feature enabled; attacker can inject HTML; page has an HTTP CSP header
The fix
The parser should compare comparable counts, for example by tracking the number of parsed meta tag policies separately or by initialising the seen meta tag counter to the number of HTTP header policies.
How it was found
- The attacker serves a page with an HTTP CSP header, such as Content-Security-Policy-Report-Only: default-src 'self'.
- The attacker injects HTML containing a restrictive CSP meta tag.
- Immediately after the meta tag, the attacker injects a resource load that would normally be blocked.
- The preload scanner sees the meta tag, increments its counter, and queues the resource preload.
- The parser checks AllowPreloading(), and because the policy count equals the meta tag count, it allows the preload.
- The preload is dispatched over the network, bypassing the meta CSP.
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.
Content Security Policy (CSP) is a rule that tells the browser which resources a page may load. This report found that when a page has both a CSP header and a CSP meta tag, the browser could start loading some resources before it had applied the meta tag's rules. That means an attacker who can inject HTML could make the browser fetch data to an outside server even though the page's CSP was supposed to stop it.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.