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

Use after free in GPU (CVE-2026-7357)

A use-after-free occurs in the GPU process when a saved iterator into a flat_map is invalidated by a synchronous re-entrant callback that reallocates the map. An attacker with a compromised renderer could trigger a crash or potentially heap corruption.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 33 days

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

Overview: A Use-After-Free vulnerability exists in CompositorFrameSinkSupport::OnSaveTransitionDirectiveProcessed when a base::flat_map iterator is invalidated during a synchronous re-entrant callback. An attacker-controlled renderer can trigger frame activation that reallocates the map's underlying vector, leaving a dangling iterator.

Affected files:

  • components/viz/service/frame_sinks/compositor_frame_sink_support.cc
  • components/viz/service/frame_sinks/compositor_frame_sink_support.h
  • components/viz/service/surfaces/surface.cc
  • components/viz/service/frame_sinks/frame_sink_manager_impl.cc
  • components/viz/service/surfaces/surface_saved_frame.cc

Estimated timestamp from git blame: 2024-04-30

Summary

A potential Use-After-Free (UAF) and heap corruption vulnerability exists in CompositorFrameSinkSupport::OnSaveTransitionDirectiveProcessed. The issue is caused by the invalidation of a base::flat_map iterator during a synchronous, re-entrant frame activation sequence.

Vulnerability Details

The view_transition_token_to_animation_manager_ field is a base::flat_map, which is backed by a contiguous std::vector. In OnSaveTransitionDirectiveProcessed, an iterator it is acquired for a given token. If maybe_cross_frame_sink is true, the code calls frame_sink_manager_->CacheSurfaceAnimationManager(), passing the token.

This call can synchronously trigger a complex re-entrant chain:

  1. CacheSurfaceAnimationManager synchronously notifies observers via OnViewTransitionSaved.
  2. An observing Surface may have its view transition dependencies resolved by this notification, prompting it to immediately call ActivatePendingFrame().
  3. ActivatePendingFrame() synchronously calls back into CompositorFrameSinkSupport::OnSurfaceActivated(this).
  4. OnSurfaceActivated processes the newly activated frame's directives.

If an attacker in a compromised renderer carefully queues a pending frame (Frame 2) containing numerous kSave directives, this re-entrant processing will insert many new elements into view_transition_token_to_animation_manager_. This exceeds the underlying std::vector's capacity, forcing a reallocation. The old backing buffer—which it points to—is freed.

When the call stack unwinds back to OnSaveTransitionDirectiveProcessed, the code executes view_transition_token_to_animation_manager_.erase(it) using the dangling iterator.

Under libc++, std::vector::erase(position) calculates the element index via position - cbegin(). Because position points to the old freed buffer and cbegin() points to the new buffer, this pointer arithmetic ((old_ptr - new_ptr) / sizeof(element)) yields a wildly out-of-bounds index. The subsequent std::move operation will perform a massive out-of-bounds memory read/write across the GPU process heap.

Potential Impact

This will reliably cause a severe crash (Denial of Service) in the GPU process when the out-of-bounds std::move hits unmapped guard pages. If an attacker can perfectly groom the heap to control the distance between the old and new allocations, it could theoretically be leveraged for GPU process memory corruption and sandbox escape, though this is practically difficult.

Suggested Reproduction Steps

Note: Our tooling agent cannot run code yet, so these are theoretical steps.

  1. From a compromised renderer, submit Frame 1 with a kSave directive for TokenX (delay_layer_tree_view_deletion=true, maybe_cross_frame_sink=true). This schedules OnSaveTransitionDirectiveProcessed to run via a posted task.
  2. Immediately submit Frame 2 with a kAnimateRenderer directive for TokenX and a large number of kSave directives. Frame 2 will pend waiting for TokenX to be cached.
  3. Allow the posted task to run. It acquires the iterator and calls CacheSurfaceAnimationManager.
  4. Frame 2 is synchronously unblocked and activated. Its directives are processed, reallocating the map and freeing the old buffer.
  5. The task resumes and calls erase(it), triggering the wild pointer arithmetic and crash.

Suggested Fix

Do not use the saved iterator it after calling CacheSurfaceAnimationManager. Instead, use the token key to erase the element, which avoids iterator invalidation issues:

C++
frame_sink_manager_->CacheSurfaceAnimationManager(
    directive.transition_token(), std::move(it->second));
view_transition_token_to_animation_manager_.erase(directive.transition_token());

Evaluated with Chrome root at commit: a9cbf6e8b275fe4147435aa905f3b7f5a656f5f0


Results from 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. And please feel free to reach out to me directly if you have concerns or feedback on the project.

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 code holds an iterator into a flat_map across a call that can synchronously re-enter and reallocate the map, invalidating the iterator.

Impact

This will reliably cause a severe crash (Denial of Service) in the GPU process; if an attacker can perfectly groom the heap, it could theoretically be leveraged for GPU process memory corruption and sandbox escape, though this is practically difficult.

What the attacker needed

Compromised renderer

The fix

The code should not use the saved iterator after calling CacheSurfaceAnimationManager; instead, erase the element by its token key.

How it was found

  1. From a compromised renderer, submit Frame 1 with a kSave directive for TokenX, scheduling OnSaveTransitionDirectiveProcessed.
  2. Immediately submit Frame 2 with a kAnimateRenderer directive for TokenX and many kSave directives, causing it to pend.
  3. Allow the posted task to run; it acquires the iterator and calls CacheSurfaceAnimationManager.
  4. Frame 2 is synchronously unblocked and activated, reallocating the map and freeing the old buffer.
  5. The task resumes and calls erase(it), triggering wild pointer arithmetic and a 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 is a bug where a program keeps using a pointer to memory after that memory has been freed. Here, a callback during the processing of a frame causes a data structure to grow and move to a new memory location, but the old pointer is still used, leading to a crash or worse.

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.