Use after free in CSS (CVE-2026-5273)
A use-after-free in Chrome's CSS rule matching occurs when a style attribute is lazily synchronised during selector matching, causing a vector reallocation that frees a buffer still referenced by a dangling AtomicString. An attacker could potentially control the freed memory via heap spray to influence CSS matching and cause a small write through a reference count increment.
- Fix shipped in 14 days
Steps to reproduce the problem
- Save the attached poc.html to disk
- Open poc.html in Chrome (no flags required, works with file:// protocol)
- Renderer crashes on page load ? no user interaction required
Tested on:
- Chrome 146.0.7680.x stable (Linux x64) ? ASAN build crashes
- Chrome 147.0.7722.0 ? ASAN build crashes
- Current main/ToT vulnerable code unchanged
The PoC requires two <style> elements with input[style][type="text"] selectors
(creating two RuleSet bundles) and JavaScript that sets an inline style then
forces style resolution via getComputedStyle().
Problem Description
heap-use-after-free READ of size 8 in blink::AtomicString::LowerASCII(), called
from ElementRuleCollector::CollectMatchingRulesInternal() on the InputRules path.
Root cause: element_rule_collector.cc (~line 952) takes a const AtomicString&
reference into Vector<Attribute> heap storage. During CSS rule matching, the
[style] selector triggers SynchronizeAttributeHinted(kStyleAttr), which appends
the lazy style attribute via AppendAttributeInternal(). This grows the vector,
calling ReallocateBuffer() which frees the old buffer. The reference is now
dangling. The next bundle iteration calls input_type.LowerASCII() ? reading
StringImpl* from offset 24 of the freed 32-byte region.
MiraclePtr Status: NOT PROTECTED. No raw_ptr<T> wraps this allocation.
The freed buffer is in PartitionAlloc's 32-byte bucket. The dangling read
dereferences a StringImpl* at offset 24. If the slot is reclaimed via heap
spray, the attacker controls what LowerASCII() reads, influencing which CSS
InputRules are matched. Additionally, LowerASCII(AtomicString source) receives
source by value ? the copy constructor calls AddRef() on the attacker-controlled
StringImpl*, producing a 4-byte write (refcount increment) at an
attacker-influenced address.
Fix: change const AtomicString& to const AtomicString (value copy) at line ~952.
Additional Comments
Attachments:
- poc.html: minimized 10-line PoC, crashes on page load, no flags
- asan_trace.txt: full symbolized ASAN trace from Chrome 146 stable
- controlled_uaf_demo.cc: standalone C++ demonstrating controlled read/write
- README.md: full root cause analysis with memory layout and exploitability
Summary
heap-use-after-free READ in ElementRuleCollector InputRules path, page load, MiraclePtr unprotected
Custom Questions
Type of crash:
Renderer (tab) crash
Crash state:
ERROR: AddressSanitizer: heap-use-after-free on address 0x7b795a082658
READ of size 8 at 0x7b795a082658 thread T0 (chrome)
Crash stack:
#0 blink::AtomicString::LowerASCII() const
#1 blink::ElementRuleCollector::CollectMatchingRulesInternal<false>()
#2 blink::ScopedStyleResolver::CollectMatchingElementScopeRules()
#3 blink::StyleResolver::MatchAuthorRules()
#4 blink::StyleResolver::MatchAllRules()
#5 blink::StyleResolver::ApplyBaseStyleNoCache()
#6 blink::StyleResolver::ResolveStyle()
#7 blink::Element::OriginalStyleForLayoutObject()
Freed by:
#0 free
#1 blink::Vector<blink::Attribute, 4u>::ReallocateBuffer()
#2 blink::Vector<blink::Attribute, 4u>::ExpandCapacity()
#3 blink::Vector<blink::Attribute, 4u>::AppendSlowCaseblink::Attribute()
#4 blink::MutableAttributeCollection::Append()
#5 blink::Element::AppendAttributeInternal()
#6 blink::Element::SetSynchronizedLazyAttribute()
#7 blink::Element::SynchronizeStyleAttributeInternal() const
#8 blink::Element::SynchronizeAttributeHinted() const
#9 blink::ElementRuleCollector::CollectMatchingRulesForListInternal<false, false>()
0x7b795a082658 is located 24 bytes inside of 32-byte region [0x7b795a082640,0x7b795a082660)
MiraclePtr Status: NOT PROTECTED
No raw_ptr<T> access to this region was detected prior to this crash.
This crash is still exploitable with MiraclePtr.
Full symbolized ASAN trace attached as asan_trace.txt.
Reporter credit:
Anonymous
Additional Data
Category: Security
Chrome Channel: Not sure
Regression: N/A \
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 const reference into a Vector<Attribute> is invalidated when SynchronizeAttributeHinted appends the lazy style attribute, causing the vector to reallocate and free the old buffer while the reference is still used.
Impact
The report demonstrates a renderer crash and argues that with heap spray an attacker could influence CSS matching and cause a small write, but no full exploit or code execution is shown.
What the attacker needed
Victim loads a crafted HTML page; Chrome renderer process; no user interaction required
The fix
The report suggests changing the const AtomicString& parameter to a value copy (const AtomicString) at the relevant line.
How it was found
- Save the attached poc.html to disk.
- Open poc.html in Chrome without any flags, using the file:// protocol.
- The renderer crashes on page load with no user interaction required.
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 use-after-free happens when a program keeps a pointer to memory after freeing it, then reads or writes through that pointer. Here, Chrome's style engine held a reference into a list of attributes, but adding a missing style attribute caused the list to move in memory, leaving the reference pointing at freed memory. The report shows a crash and argues that an attacker who can control what lands in that freed memory might influence which CSS rules apply and trigger a small write.
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.