Skip to content
Memory corruption Advisory Advanced CVE-2026-4674

Out of bounds read in CSS (CVE-2026-4674)

The diff-ruleset copy path in Blink ignores the failure result of RuleMap::Add(), so when a deliberate hash collision makes insertion fail it relocates bloom-hash metadata on the wrong RuleData. This desynchronises the stored bloom-hash offset and causes an out-of-bounds read when bloom-hash slices are copied.

Syn4pse Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 25 days

Summary

When Blink builds a “diff ruleset” during stylesheet mutation, RuleMap::AddFilteredRulesFromOtherSet copies selected RuleData entries into a new RuleMap but ignores the boolean result of RuleMap::Add(). Under deliberate AtomicString::Hash() collisions (documented as a supported failure mode of RobinHoodMap), RuleMap::Add() can return false; the copy path still treats backing.back() as the newly-added element and relocates bloom-hash metadata on the wrong RuleData. This desynchronizes RuleData::bloom_hash_pos_ from the source ruleset backing and leads to an OOB access in RuleData::MovedToDifferentRuleSet when copying bloom-hash slices.

Details

The intended behavior is that adding a key to a RuleMap either succeeds (appending a new RuleData to backing) or, if insertion fails due to collision pressure, a safe fallback is taken. The normal RuleSet build path already anticipates this: RuleSet::AddToBucket checks map.Add(...) and, on failure, places a de-bucketed copy of the rule into universal_rules_ to preserve correctness.

In RuleSet::AddToBucket, insertion failure is explicitly treated as an adversarial collision case and handled without touching unrelated RuleData:

C++
if (!map.Add(key, rule_data)) {
  RuleData rule_data_copy = rule_data;
  UnmarkAsCoveredByBucketing(rule_data_copy.MutableSelector());
  AddToBucket(universal_rules_, rule_data_copy);
  return;
}

However, the diff ruleset path (used by RuleSetDiff::CreateDiffRuleset) does not apply this pattern. In RuleMap::AddFilteredRulesFromOtherSet, the result of Add() is ignored and the code unconditionally assumes that backing.back() is the RuleData that was just appended:

In RuleMap::AddFilteredRulesFromOtherSet, the copy loop ignores the return value from Add() and immediately uses backing.back():

C++
if (only_include.Contains(const_cast<StyleRule*>(rule_data.Rule()))) {
  Add(key, rule_data);
  new_rule_set.NewlyAddedFromDifferentRuleSet(
      rule_data, scope_seeker.Seek(rule_data.GetPosition()),
      old_rule_set, backing.back());
}

RuleMap::Add() can return false when the underlying Robin Hood table cannot accommodate another key with the same 24-bit AtomicString::Hash() (bounded probe length). This failure is explicit in the implementation:

In RuleMap::Add:

C++
RobinHoodMap<AtomicString, Extent>::Bucket* bucket = buckets.Insert(key);
if (bucket == nullptr) {
  return false;
}

When Add() fails in the diff-copy loop, backing is not appended, but backing.back() still returns the previous RuleData. NewlyAddedFromDifferentRuleSet() then calls RuleData::MovedToDifferentRuleSet() on that wrong element, which performs an unchecked copy out of the source ruleset’s bloom backing using the bloom_hash_pos_ stored in the RuleData:

In RuleData::MovedToDifferentRuleSet, bloom_hash_pos_ is used as an offset into old_backing without validating that it still refers to that backing vector:

C++
unsigned new_pos = new_backing.size();
new_backing.insert(new_backing.size(),
                   old_backing.data() + bloom_hash_pos_,
                   bloom_hash_size_);
bloom_hash_pos_ = new_pos;

Because the wrong RuleData has typically already been relocated into the diff ruleset’s bloom_hash_backing_, its bloom_hash_pos_ now refers to the diff backing. Reusing that value as an offset into the source ruleset’s old_backing produces an out-of-bounds source pointer passed into Vector<uint16_t>::insert(), leading to the OOB.

Bisection

This issue is introduced by the commit c3afc7e99450e707a4df6ef81b86b71d7def8c09, which introduce the incorrect implementation for the RuleMap::Add() calls.

Reproduction

Download the chrome from https://storage.googleapis.com/chromium-browser-asan/linux-release/asan-linux-release-1591355.zip

Run command:

Bash
./chrome --no-sandbox poc.html

The ASAN crash is shown in the asan.txt

Suggested Fix

In RuleMap::AddFilteredRulesFromOtherSet, handle RuleMap::Add() failure explicitly.

The original report as published on the Chromium issue tracker, by Syn4pse. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 diff-ruleset copy loop ignores the boolean result of RuleMap::Add() and unconditionally treats backing.back() as the newly added element, unlike the normal build path which falls back to universal_rules_.

Impact

An attacker could trigger an out-of-bounds read in the renderer, which the report demonstrates as an ASAN crash; no further impact such as code execution is claimed.

What the attacker needed

Victim loads attacker-supplied HTML; many colliding selector hashes

The fix

RuleMap::AddFilteredRulesFromOtherSet should handle RuleMap::Add() failure explicitly, as the normal build path already does.

How it was found

  1. Download the provided ASAN Chrome build.
  2. Run the browser against the supplied HTML proof-of-concept file.
  3. Observe the out-of-bounds read reported by ASAN.

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.

A web browser stores style rules in a lookup table keyed by hashes of their selectors. If an attacker crafts many selectors whose hashes collide, the table can refuse a new entry, but one code path wrongly assumes the entry was added and updates the wrong record, so a later copy reads past the end of an array. That out-of-bounds read can crash the browser tab.

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.

More by Syn4pse

View all

13 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.