Type Confusion in CSS (CVE-2026-11076)
A type confusion in Blink's CSSOM lets a CSSSupportsRule wrapper end up backed by a StyleRuleLayerBlock after a detached rule tree is cloned and wrappers are reattached by index. The report claims this could leak heap memory out of bounds and cause a misaligned free, potentially leading to remote code execution, though the steps are unverified.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 59 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 security team.
Overview: A potential type confusion exists in Blink's CSSOM implementation when reattaching CSS wrappers to cloned style rules by index. An attacker can desynchronize the wrapper list from the rule list, binding a CSSConditionRule wrapper to a StyleRuleLayerBlock object. Accessing the condition text reads an internal Vector as a StringImpl, leading to a heap information leak and a misaligned free that can potentially be exploited for remote code execution.
Affected files:
third_party/blink/renderer/core/css/css_grouping_rule.ccthird_party/blink/renderer/core/css/css_condition_rule.ccthird_party/blink/renderer/core/css/css_style_rule.ccthird_party/blink/renderer/core/css/style_rule.h
Estimated timestamp from git blame: 2026-03-05
Disclaimer
These are suggested/potential steps and analysis, as our tooling agent doesn't yet have the ability to run code to verify a live exploit.
Summary
A potential type confusion vulnerability exists in Blink's CSSOM implementation. When a parent rule's selector is modified, its child rules are cloned, and CSSGroupingRule::Reattach is called to bind existing JavaScript wrappers to the newly cloned rule objects. This reattachment occurs by index. If the wrapper list and the rule list are intentionally desynchronized while the rule tree is detached from the document, an attacker can cause a CSSSupportsRule wrapper to be backed by a StyleRuleLayerBlock object.
Root Cause Analysis
In third_party/blink/renderer/core/css/css_grouping_rule.cc, the Reattach method validates that the new backing rule is a StyleRuleGroup using To<StyleRuleGroup>(rule). However, it lacks strict type validation to ensure the rule is of the exact subclass expected by the wrapper (e.g., StyleRuleCondition for a CSSSupportsRule).
void CSSGroupingRule::Reattach(StyleRuleBase* rule) {
DCHECK(rule);
group_rule_ = To<StyleRuleGroup>(rule);
for (unsigned i = 0; i < child_rule_cssom_wrappers_.size(); ++i) {
if (child_rule_cssom_wrappers_[i]) {
child_rule_cssom_wrappers_[i]->Reattach(
group_rule_->ChildRules()[i].Get());
}
}
}
When a CSS tree is detached (e.g., via replaceSync), mutating a rule (like changing .selectorText) attempts to replace it in the parent stylesheet using StyleSheetContents::ReplaceRuleIfExists. This fails for detached rules, leaving the parent with a stale pointer to the old rule. Meanwhile, mutating the child (e.g., insertRule) updates the wrapper list. Re-mutating the parent later forces a clone of the stale rule tree and a reattachment using the shifted wrapper list, causing a type confusion.
Exploitation Path (Suggested Steps)
An attacker could potentially trigger this via the following sequence:
- Setup: Create a nested CSS structure:
.a { .w { @supports (x:y) {} @layer foo.bar.baz { .z { color: red } } } }. Acquire CSSOM wrappers for.a,.w, and@supports. Critically, do not access the@layerrule so its wrapper initializes asnullptr. - Detach: Detach the rules by executing
replaceSync('div { color: blue }')on the stylesheet. - Desynchronize: Mutate
.wby executingw.selectorText = '.ww'. Because the tree is detached,.afails to update its reference and keeps the old.wbackend rule. Then, insert a rule into.w(w.insertRule('.r {}', 0)). This shifts the@supportswrapper to index 1 and expands the wrapper vector to size 3 ([nullptr, sup, nullptr]). - Trigger Type Confusion: Mutate
.a(a.selectorText = '.aa')..aclones the old.wbackend rule (which only has 2 children) and callsReattach().Reattach()iterates over the size-3 wrapper list. The@supportswrapper at index 1 is erroneously bound to the@layerbackend rule. Thenullptrat index 2 safely skips the loop, bypassing the fatalCHECK_LT(2, 2)vector bounds check. - Heap OOB Read (ASLR Defeat): The attacker evaluates
sup.conditionText. This invokesCSSConditionRule::ConditionTextInternal(), which casts theStyleRuleLayerBlockto aStyleRuleConditionand readscondition_text_(aString). This memory overlaps exactly withLayerName name_(aVector<AtomicString, 1>). TheStringImpl*pointer reads the Vector's buffer pointer. The resulting fakelength_field overlaps with upper 32 bits of the first heap pointer in the layer name buffer. This massive fake length allows JavaScript to read thousands of bytes out-of-bounds from the PartitionAlloc heap. - Misaligned Free (Memory Corruption): During the
Stringconstruction,impl_->AddRef()is called, which increments the lower 32 bits of the firstAtomicStringpointer in the Vector buffer, permanently misaligning it. When Garbage Collection occurs, the Vector destructor callsRelease()on this corrupted pointer, leading to a misaligned free in PartitionAlloc, providing a powerful primitive for Remote Code Execution.
Proposed Fix
Add strict runtime type checking in CSSGroupingRule::Reattach to ensure the existing wrapper is compatible with the new underlying rule type before reattaching. If the types do not match (or perhaps simply if the rule type enums do not match), the wrapper should not be reattached or should be safely invalidated.
void CSSGroupingRule::Reattach(StyleRuleBase* rule) {
DCHECK(rule);
group_rule_ = To<StyleRuleGroup>(rule);
for (unsigned i = 0; i < child_rule_cssom_wrappers_.size(); ++i) {
if (child_rule_cssom_wrappers_[i]) {
// Check bounds to prevent OOB access if lists are desynced
if (i >= group_rule_->ChildRules().size()) {
child_rule_cssom_wrappers_[i]->SetParentRule(nullptr);
continue;
}
StyleRuleBase* child_rule = group_rule_->ChildRules()[i].Get();
// Validate type compatibility before reattaching
if (child_rule_cssom_wrappers_[i]->GetType() == child_rule->GetType()) {
child_rule_cssom_wrappers_[i]->Reattach(child_rule);
} else {
child_rule_cssom_wrappers_[i]->SetParentRule(nullptr);
// Optionally clear the wrapper or handle the mismatch safely
}
}
}
}
Additionally, investigate fixing the lifecycle of detached rules to ensure ReplaceRuleIfExists either succeeds on detached subtrees or prevents mutations when rules become permanently orphaned.
Evaluated with Chrome root at commit: 09ec9e7cc4d24823d20b6d37cf3d282734f6bf0f
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
Likely the reattachment loop matches wrappers to cloned child rules purely by index and only checks the general group type, not the exact subclass, so a desynchronised wrapper list binds a wrapper to the wrong rule type.
Impact
The report claims a heap information leak that could defeat ASLR and a misaligned free that could potentially be exploited for remote code execution, but the authors state they could not run code to verify a live exploit.
What the attacker needed
Ability to run JavaScript in the page; crafted CSSOM mutation sequence
The fix
Strict runtime type checking and bounds checks should be added in the reattachment loop so mismatched wrappers are invalidated instead of rebound, and the lifecycle of detached rules should be reviewed.
How it was found
- Build a nested rule structure and obtain wrappers for the outer rules and the supports rule, leaving the layer rule's wrapper uninitialised.
- Detach the rules from the document by replacing the stylesheet contents.
- Change the middle rule's selector so the parent keeps a stale reference, then insert a rule into it to shift the wrapper list.
- Change the outer rule's selector to force a clone of the stale tree and a reattachment using the shifted wrapper list.
- Read the supports rule's condition text to trigger an out-of-bounds heap read.
- Wait for garbage collection so the corrupted pointer is released, causing a misaligned free.
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 keep a JavaScript-visible object for each CSS rule, and when rules are copied they try to reconnect those objects to the new copies by position. If the list of objects and the list of rules get out of step, an object meant for one kind of rule can point at a different kind. Reading it then treats one field as another, which can expose memory the page should not see.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.