Skip to content
Memory corruption Advisory Advanced CVE-2021-30625

Google Chrome Blink setBaseAndExtent use after free vulnerability

A use-after-free flaw in Chrome's Selection API setBaseAndExtent method can be triggered by a crafted web page, causing memory corruption that may lead to arbitrary code execution. The victim must visit a malicious site to trigger the crash.

Marcin Towalski Follow

Originally disclosed on Cisco Talos

High 8.3 View original

A use-after-free vulnerability exists in the Selection API of Blink rendering engine in Google Chrome 92.0.4515.131 (Stable) and 94.0.4597.1 (Canary). A specially-crafted web page can trigger reuse of previously freed memory which can lead to arbitrary code execution.

Marcin Towalski, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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 visibility check in UpdateCachedVisibleSelectionIfNeeded fails to account for content-visibility: hidden, so a layout object is freed during style recalculation but still used later in the selection code.

Impact

A remote attacker could cause memory corruption and potentially achieve arbitrary code execution, though the report only demonstrates a crash under AddressSanitizer.

What the attacker needed

Victim visits a malicious web page; Chrome version 92.0.4515.131 or 94.0.4597.1

The fix

The vendor patched the vulnerability, likely by correcting the visibility check to handle content-visibility: hidden.

How it was found

  1. Create a web page that calls setBaseAndExtent with an anchor node that is a parent of the focus node and an anchor offset less than or equal to the focus offset.
  2. Apply a style that sets content-visibility: hidden to the nodes involved.
  3. Load the page in Chrome to trigger the use-after-free and crash.

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 frees some memory but keeps a pointer to it and later uses that pointer. Here, a web page can make the browser's text-selection code use a layout object after it has been destroyed, which can crash the browser or let an attacker run their own code. The attacker only needs the victim to open a malicious page.

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 Marcin Towalski

View all

12 more disclosed reports, best first.

More from Cisco Talos

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.