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

Use after free in DOM (CVE-2026-10016)

A use-after-free in Chromium's DOM code occurs when Document::ProcessBaseElement keeps a raw pointer into a <base> element's attribute storage while synchronously dispatching a JavaScript error event. An attacker-controlled handler can mutate the element, freeing that storage, so the resumed code dereferences freed memory and calls AddRef on an attacker-influenced pointer.

pwn2addr Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 8 days

Steps to reproduce the problem

  1. Download ASAN Chromium Download asan-win32-release_x64-1633823.zip

  2. Launch Chrome

chrome.exe --no-sandbox poc.html

Problem Description

Document::ProcessBaseElement borrows a raw const AtomicString* into a <base> element's mutable AttributeVector slot and then calls Document::UpdateBaseURL. UpdateBaseURL synchronously dispatches a JavaScript error event on any speculation-rules <script> whose source is not a JSON object. The handler can mutate the same <base> element so the AttributeVector backing buffer is freed and the slot pointed to by the saved raw pointer is reclaimed. When the outer call resumes, it reads target->impl_ from the freed bucket via StringImpl::find and scoped_refptr::operator=, dereferencing freed memory and calling StringImpl::AddRef on an attacker-influenced pointer value.

Any b.href = ... or b.target = ... from script enters Document::ProcessBaseElement via HTMLBaseElement::ParseAttribute (third_party/blink/renderer/core/html/html_base_element.cc:36). That function saves a raw const AtomicString* pointing into the first <base>'s target attribute storage, then calls UpdateBaseURL while that pointer is still live on the stack:

C++
// Document::ProcessBaseElement  third_party/blink/renderer/core/dom/document.cc:5099
5099:    const AtomicString* href = nullptr;
5100:    const AtomicString* target = nullptr;
...
5113:          target = &value;  // raw pointer into a mutable Attribute slot inside AttributeVector
...
5147:    if (base_element_url != base_element_url_) {  // forced true by the attacker changing `b.href`
...
5164:      UpdateBaseURL();  // synchronous callout while `target` is still borrowed above
5165:    }

UpdateBaseURL (document.cc:5019) iterates every HTMLScriptElement descendant on the same stack and calls ScriptLoader::DocumentBaseURLChanged on each. For a <script type="speculationrules"> element, that re-parses the original source under the new base URL via AddSpeculationRuleSet, which fires an error event when the JSON parses to anything other than an object (e.g., the top-level array []):

C++
// ScriptLoader::AddSpeculationRuleSet  third_party/blink/renderer/core/script/script_loader.cc:1380
1380:    if (speculation_rule_set_->error_type() ==
1381:            SpeculationRuleSetErrorType::kSourceIsNotJsonObject ||  // `[]` is JSON but not an object, this branch fires
1382:        speculation_rule_set_->error_type() ==
1383:            SpeculationRuleSetErrorType::kInvalidRulesetLevelTag) {
...
1386:      element_->DispatchErrorEvent();  // runs attacker `onerror` JS on the same stack while `target` is still borrowed

A single setAttribute from the onerror handler is enough to free the buffer target borrowed from. Vector::push_back falls into Vector::AppendSlowCase when at capacity, which allocates a new BufferPartition buffer, moves the elements over, and frees the old one:

C++
// Vector::AppendSlowCase  third_party/blink/renderer/platform/wtf/vector.h:2380
2382:  Vector<T, InlineCapacity, Allocator>::AppendSlowCase(U&& val) {
2383:    DCHECK_EQ(size(), capacity());
...
2386:    ptr = ExpandCapacity(size() + 1, ptr);  // allocates new buffer, copies, FREES the buffer `target` points into
2392:  }

With six attributes the AttributeVector (Vector<Attribute, 4>) already uses an external 96-byte buffer, one setAttribute grows it and frees that buffer, leaving target dangling.

When the error event returns, Document::ProcessBaseElement resumes and dereferences the stale pointer three times:

C++
// Document::ProcessBaseElement  third_party/blink/renderer/core/dom/document.cc:5167
5167:    AtomicString old_base_target = base_target_;
5168:    if (target) {
5169:      if (target->contains('\n') || target->contains('\r')) {  // UAF
...
5172:      if (target->contains('<')) {                              // UAF
...
5175:      base_target_ = *target;                                   // UAF

Summary

Use-After-Free via re-entrant attribute mutation during synchronous speculation-rules error dispatch

Custom Questions

Type of crash:

renderer

Crash state:

Please see asan.log

Reporter credit:

pwn2addr

Additional Data

Category: Security
Chrome Channel: Canary
Regression: N/A \

The original report as published on the Chromium issue tracker, by pwn2addr. 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 a raw pointer into a mutable attribute vector was kept live across a synchronous JavaScript callout that could reallocate and free that vector.

Impact

The stale pointer is dereferenced and AddRef is called on an attacker-influenced value, which could crash the renderer and may allow further exploitation.

What the attacker needed

ASAN Chromium build; victim opens a crafted HTML page

How it was found

  1. Download the ASAN Chromium build.
  2. Launch Chrome with the proof-of-concept page.

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 it has already released, then uses it again. Here the browser holds a reference to a <base> element's attribute while it runs a script event; the script changes the element, the old memory is freed, and the browser then reads the freed memory. This can crash the browser and, in principle, let an attacker influence what happens next.

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 pwn2addr

View all

71 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.