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

Use after free in Compositing (CVE-2026-5290)

A compromised renderer can send a PaintPreviewCaptureResponse with a specific number of link entries that causes an underestimation of required memory in cc::RTree::Build, leading to a vector reallocation that leaves raw pointers dangling. When the user taps the preview, a use-after-free occurs in the browser process, potentially allowing arbitrary code execution or memory leaking.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 7 days

Project Fortify, an experimental security project, has identified the following potential security issue.

Overview: A compromised renderer can send a malicious PaintPreviewCaptureResponse IPC with a specific number of link entries (e.g., 1,771,562). This triggers a subtle math error in cc::RTree::Build during Paint Preview playback, causing a std::vector reallocation that leaves RAW_PTR_EXCLUSION pointers dangling. When the user taps the preview, a Use-After-Free occurs in the browser process.

Affected files:

  • cc/base/rtree.h
  • components/paint_preview/browser/paint_preview_client.cc
  • chrome/browser/paint_preview/services/paint_preview_tab_service.cc

Estimated timestamp from git blame: 2024-04-18

Summary

A potential Use-After-Free (UAF) vulnerability exists in the Chrome browser process when viewing large Paint Previews. A compromised renderer can provide a malicious PaintPreviewCaptureResponse with a specific number of LinkData entries that causes an underestimation of required memory in cc::RTree. This leads to a vector reallocation that invalidates raw pointers to tree nodes, subsequently resulting in a UAF when the tree is traversed during hit testing on Android.

Technical Analysis

1. Unbounded IPC Processing

During a Paint Preview capture, PaintPreviewClient::InProgressDocumentCaptureState::RecordSuccessfulFrame calls PaintPreviewCaptureResponseToPaintPreviewFrameProto to process LinkData from a renderer-provided response.

C++
for (const auto& link : response->links) {
  auto* link_proto = proto->add_links();
  link_proto->set_url(link->url.spec());
  RectToRectProto(link->rect, link_proto->mutable_rect());
}

There is no validation on the size of response->links against the expected max_capture_size. A compromised renderer can send an IPC message with exactly 1,771,562 link entries, which easily fits within Mojo/Protobuf limits (~70MB).

2. RTree Construction Underestimation

When the captured preview is loaded for viewing (e.g., during hit testing on Android), cc::RTree::Build is called. The function calculates a node_count to reserve in its nodes_ vector:

C++
size_t branch_count = kMaxChildren;
double depth = log(branches.size()) / log(branch_count);
size_t node_count =
    static_cast<size_t>((std::pow(branch_count, depth) - 1) /
                        (branch_count - 1)) +
    kMinChildren;
// ...
nodes_.reserve(node_count);

This formula calculates the number of internal nodes in a perfectly balanced tree but underestimates the actual number of nodes required by the STR (Sort-Tile-Recursive) algorithm in BuildRecursive. For N = 1,771,562 (which is 11^6 + 1), the required node count is exactly 177,163. However, the formula calculates node_count as 177156 + 6 = 177,162.

3. Use-After-Free (UAF)

Because nodes_.reserve() was called with 177,162, allocating the 177,163rd node (the root node) via nodes_.emplace_back(level) forces the std::vector<Node<T>> nodes_ to reallocate its backing buffer to a larger capacity.

cc::RTree uses a Branch structure that stores a raw pointer to a child Node:

C++
struct Branch {
  // ...
  // RAW_PTR_EXCLUSION: Performance reasons (based on analysis of speedometer3).
  RAW_PTR_EXCLUSION Node<U>* subtree = nullptr;
  // ...
};

These subtree pointers are explicitly excluded from MiraclePtr protection (RAW_PTR_EXCLUSION). During the std::vector reallocation, the nodes are moved to the new buffer, but the raw subtree pointers within those nodes are not updated. They are left pointing to the freed memory buffer.

When the user subsequently taps the Paint Preview on Android, PlayerCompositorDelegateAndroid::OnClick is invoked, which calls HitTester::HitTest, and finally rtree_.SearchRefs. This function traverses the dangling subtree pointers, leading to a Use-After-Free in the browser process.

Impact

A compromised renderer can trigger this UAF to achieve arbitrary code execution or memory leaking in the context of the browser process.

Potential Reproduction Steps

Note: These steps are suggested based on code analysis, as our setup cannot run exploit code.

  1. Compromise a renderer process (e.g., on Android).
  2. Wait for or induce tab backgrounding/loading states to trigger a Paint Preview capture.
  3. Respond to the CapturePaintPreview IPC with a PaintPreviewCaptureResponse containing exactly 1,771,562 LinkData entries.
  4. Spray the browser process heap with forged Node<GURL> structures using other available IPCs.
  5. Wait for the user to open the Paint Preview and tap the screen.
  6. HitTester::HitTest will traverse the R-Tree, dereference the dangling subtree pointers, and return a forged GURL from the sprayed memory.
  7. Java native code reads GURL::spec(), leaking arbitrary memory or triggering further exploits.

Suggested Fix

Fix the math in cc::RTree::Build to correctly bound the maximum number of nodes. The worst-case node count for the BuildRecursive STR algorithm requires up to kMinChildren additional nodes per tree level, not just a flat kMinChildren addition at the end. Alternatively, use an index-based referencing system (like wtf_size_t indices) instead of raw Node<U>* subtree pointers to avoid pointer invalidation entirely.

Evaluated with Chrome root at commit: 0eb4855bda702feaaa8b899336664f97e3df88b8


Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. Please feel free to reach out to me if you have concerns or feedback.

The original report as published on the Chromium issue tracker. 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 node count calculation in cc::RTree::Build underestimates the actual number of nodes required by the STR algorithm, causing a vector reallocation that invalidates raw subtree pointers.

Impact

A compromised renderer can trigger this UAF to achieve arbitrary code execution or memory leaking in the context of the browser process.

What the attacker needed

Compromised renderer process; user opens Paint Preview and taps

The fix

The math in cc::RTree::Build should be fixed to correctly bound the maximum number of nodes, or an index-based referencing system should be used instead of raw pointers.

How it was found

  1. Compromise a renderer process (e.g., on Android).
  2. Wait for or induce tab backgrounding/loading states to trigger a Paint Preview capture.
  3. Respond to the CapturePaintPreview IPC with a PaintPreviewCaptureResponse containing exactly 1,771,562 LinkData entries.
  4. Spray the browser process heap with forged Node<GURL> structures using other available IPCs.
  5. Wait for the user to open the Paint Preview and tap the screen.
  6. HitTester::HitTest will traverse the R-Tree, dereference the dangling subtree pointers, and return a forged GURL from the sprayed memory.

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.

This report describes a memory safety bug in Chrome's Paint Preview feature. A compromised renderer (a sandboxed part of the browser that handles web content) can send a message with a very specific number of links that tricks the browser into reserving too little memory for a data structure. Later, when the user taps the preview, the browser accesses memory that has already been freed, which can lead to code execution or data leakage.

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