Skip to content
Memory corruption Advisory Advanced CVE-2024-7000

Use after free in CSS (CVE-2024-7000)

A use-after-free flaw exists in the CSS style rule scope handling code, where the prelude text is re-parsed and rules are reparented. An attacker could potentially trigger memory corruption by causing the scope's nesting rule to be freed and then reused during reparenting.

Anonymous Follow

Originally disclosed on Chrome VRP

Bounty$500 Medium View original
  • Fix shipped in 2 months

Same as issue 339788215

void StyleRuleScope::SetPreludeText(const ExecutionContext* execution_context, String value, CSSNestingType nesting_type, StyleRule* parent_rule_for_nesting, bool is_within_scope, StyleSheetContents* style_sheet) { auto* parser_context = MakeGarbageCollected<CSSParserContext>(*execution_context); Vector<CSSParserToken, 32> tokens = CSSTokenizer(value).TokenizeToEOF();

StyleRule* old_parent = style_scope_->RuleForNesting(); style_scope_ = StyleScope::Parse(tokens, parser_context, nesting_type, parent_rule_for_nesting, is_within_scope, style_sheet);

// Reparent rules within the @scope's body. Reparent(old_parent, style_scope_->RuleForNesting()); }

The original report as published on the Chromium issue tracker, by Anonymous. 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 code frees the old nesting rule during re-parsing but then passes the stale old_parent pointer into Reparent, causing a use-after-free.

Impact

Could lead to memory corruption, potentially allowing code execution or a browser crash, though the text does not describe a working exploit.

What the attacker needed

None stated

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 is a memory bug where a program keeps using a piece of memory after it has been freed. Here, the browser's CSS engine re-parses a scope rule and then tries to reparent rules, which can touch memory that is no longer valid. This can crash the browser or, in the worst case, let an attacker run their own code.

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 Anonymous

View all

2,270 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.