Inappropriate implementation in CSS (CVE-2026-13839)
A logic flaw in Blink's copy-on-write handling of CSS @keyframes rules means that mutating a keyframe through the CSSOM can alter the shared cached stylesheet. An attacker could poison styles for other documents in the same renderer process, potentially bypassing the Same-Origin Policy.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 44 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: A potential logic flaw in Blink's CSS Copy-on-Write (COW) implementation for @keyframes rules allows same-process CSS poisoning. Shallow cloning of keyframes and incomplete CSSOM wrapper reattachment causes mutations to affect shared StyleSheetContents. This could enable a Same-Origin Policy (SOP) bypass between documents sharing a renderer process.
Affected files:
third_party/blink/renderer/core/css/css_keyframes_rule.ccthird_party/blink/renderer/core/css/style_rule.ccthird_party/blink/renderer/core/css/css_keyframe_rule.cc
Estimated timestamp from git blame: 2025-09-16
Overview
A potential vulnerability exists in the Copy-on-Write (COW) implementation for CSS @keyframes rules. When a shared stylesheet is mutated via the CSS Object Model (CSSOM), Blink attempts to create a private fork to prevent modifying the globally cached version. However, due to broken cloning and wrapper reattachment logic, modifications to keyframes can leak into the shared StyleSheetContents, poisoning the stylesheet for other documents in the same renderer process.
Note: These findings are based on static code analysis by an AI tooling agent. The steps below are theoretical, as an executable proof-of-concept has not yet been developed.
Technical Details
The vulnerability stems from two implementation flaws in how Blink handles @keyframes during a CSSStyleSheet COW fork:
1. Shallow Copying of Keyframes
During a COW fork, StyleSheetContents::Copy() duplicates all rules via StyleRuleBase::Clone(). For @keyframes rules, this invokes the StyleRuleKeyframes copy constructor:
// third_party/blink/renderer/core/css/css_keyframes_rule.cc
StyleRuleKeyframes::StyleRuleKeyframes(const StyleRuleKeyframes& o) = default;
Because the copy constructor is defaulted, it performs a shallow copy of its members, including the keyframes_ vector (HeapVector<Member<StyleRuleKeyframe>>). Consequently, the newly cloned StyleRuleKeyframes object contains pointers to the exact same StyleRuleKeyframe instances as the original, cached stylesheet.
2. Missing Child Reattachment
After cloning the StyleSheetContents, Blink must update existing CSSOM wrappers to point to the newly allocated C++ rules.
While CSSKeyframesRule::Reattach updates its own internal keyframes_rule_ pointer, it fails to iterate through and reattach its child_rule_cssom_wrappers_ (unlike other grouping rules such as CSSGroupingRule::Reattach).
Furthermore, the reattachment method for the child wrapper itself assumes keyframes are immutable:
// third_party/blink/renderer/core/css/css_keyframe_rule.cc
void CSSKeyframeRule::Reattach(StyleRuleBase*) {
// No need to reattach, the underlying data is shareable on mutation.
NOTREACHED();
}
The Resulting Flaw
If an attacker holds a CSSKeyframeRule wrapper when a COW fork is triggered (e.g., by calling setProperty), the wrapper maintains a stale pointer to the original, shared StyleRuleKeyframe. Because StyleRuleKeyframe::MutableProperties() mutates the object in place, the change directly corrupts the shared cache.
Potential Attacker Steps
- An Attacker document (Origin A) and a Victim document (Origin B) are loaded into the same renderer process (e.g., same-site cross-origin on Desktop, or cross-site on platforms with relaxed site isolation like Android).
- Both documents load the same cross-origin stylesheet (e.g., a CSS framework from a CDN) containing a
@keyframesrule. - The Attacker uses JavaScript to traverse the CSSOM and obtain a reference to a nested
CSSKeyframeRule. - The Attacker mutates the rule via
keyframeRule.style.setProperty(...). - Because of the shallow copy and lack of wrapper reattachment, the mutation is applied to the globally shared
StyleSheetContentsin theMemoryCache. - The Victim document observes the poisoned CSS rules. The attacker can use this to spoof UI elements or perform cross-origin data exfiltration (e.g., injecting attribute selectors that trigger network requests via
background-image).
Suggested Fix
- Deep Copy Keyframes: Update the
StyleRuleKeyframescopy constructor to perform a deep copy of itskeyframes_array. It should create newStyleRuleKeyframeinstances based on the original data. - Reattach Children: Modify
CSSKeyframesRule::Reattachto iterate overchild_rule_cssom_wrappers_and invokeReattachon any instantiated child wrappers. - Implement Reattachment: Remove the
NOTREACHED()fromCSSKeyframeRule::Reattachand implement it to properly update its internalkeyframe_pointer to the newly cloned C++ object.
Evaluated with Chrome root at commit: b7d0c4d810da1b31400f198c70d9720fc8f0e5a0
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 defaulted copy constructor for StyleRuleKeyframes performs a shallow copy of its keyframe pointers, and CSSKeyframesRule::Reattach does not reattach child CSSOM wrappers, so mutations reach the shared StyleSheetContents.
Impact
The attacker could spoof UI elements or perform cross-origin data exfiltration, though the report notes the steps are theoretical and no proof-of-concept exists.
What the attacker needed
Attacker and victim in same renderer process; shared cross-origin stylesheet with @keyframes; attacker can run JavaScript
The fix
The report suggests deep-copying keyframes, reattaching child wrappers, and implementing CSSKeyframeRule::Reattach; it does not state that a fix was applied.
How it was found
- Load an attacker document and a victim document in the same renderer process.
- Have both documents load the same cross-origin stylesheet containing a @keyframes rule.
- Use JavaScript to obtain a reference to a nested CSSKeyframeRule.
- Mutate the rule via keyframeRule.style.setProperty.
- The mutation is applied to the shared StyleSheetContents in the MemoryCache.
- The victim document observes the poisoned CSS rules.
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.
Web pages share a cached copy of stylesheets to save memory. When a page changes a stylesheet through JavaScript, the browser is supposed to make a private copy first. Here, that copy step is incomplete for animation keyframes, so one page's changes can affect another page's styles. This could let a malicious site alter how a victim site looks or behaves.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.