Use after free in Viz (CVE-2026-10918)
A use-after-free in the GPU process occurs when property trees are resized and RenderSurfaceImpl objects are freed, but an early validation failure leaves dangling pointers in LayerTreeImpl's render surface list. An attacker with a compromised renderer could trigger a draw that dereferences these pointers, potentially leading to remote code execution in the GPU process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: A Use-After-Free (UAF) vulnerability exists in the GPU process when kTreesInViz is enabled. LayerContextImpl resizes property trees, freeing RenderSurfaceImpl objects, but can abort early on validation errors without updating needs_update_draw_properties_, leaving dangling pointers in LayerTreeImpl's render surface list.
Affected files:
components/viz/service/layers/layer_context_impl.cccc/trees/damage_tracker.cccc/trees/layer_tree_impl.cccc/trees/property_tree.cc
Estimated timestamp from git blame: 2025-06-04
Summary
A potential Use-After-Free (UAF) vulnerability has been identified in the GPU process within the LayerContextImpl component, affecting the kTreesInViz code path. The root cause is that DoUpdateDisplayTree performs irreversible state mutations—specifically shrinking property trees and freeing RenderSurfaceImpl objects—before completing the validation of the display tree update.
If validation fails subsequently (e.g., due to an invalid page_scale_factor), the update is aborted early. This early return bypasses the logic that sets needs_update_draw_properties_ = true. Consequently, LayerTreeImpl is left in a "torn" state where its render_surface_list_ (which uses RAW_PTR_EXCLUSION) contains raw pointers to the now-freed RenderSurfaceImpl heap allocations. A subsequent draw operation will dereference these dangling pointers.
Potential Exploitation Steps
Note: These are suggested steps based on static analysis. Our tooling agent does not yet have the ability to run code to provide a working proof of concept.
- Initial Setup: A compromised Renderer process establishes a valid
mojom::LayerContextconnection to the GPU process. - Clear Draw Flag: The Renderer sends a valid
mojom::LayerTreeUpdatewithframe_has_damage = true. This forces a successful draw cycle, which setsLayerTreeImpl::needs_update_draw_properties_tofalseand populatesrender_surface_list_with valid pointers. - Trigger the Free: The Renderer crafts a malicious
LayerTreeUpdatewhereupdate->num_effect_nodesis smaller than the current size.DoUpdateDisplayTreecallsResizePropertyTree, which physically removes effect nodes and frees their associatedRenderSurfaceImplobjects. - Heap Grooming: The attacker includes a large array in
update->surface_ranges. The allocation of thebase::flat_setbacking vector for these ranges lands in the recently freedRenderSurfaceImplheap slots. The attacker fills this array with crafted bytes representing a fakeRenderSurfaceImplobject (including a forgeddamage_tracker_pointer). - Trigger the Abort: The attacker sets
update->page_scale_factortoNaN. Validation fails atlayer_context_impl.cc:1976, causing an early return.needs_update_draw_properties_remainsfalse. - Trigger the Draw: The early return calls
ReportBadMessage, which queues an asynchronous Mojo teardown task. Before it runs, the attacker sendsSetNeedsBeginFrame(true)via theCompositorFrameSinkinterface on the same pipe. This schedules a localBeginFrametask on the Viz thread. - The UAF: The
BeginFrametask executes first, callingLayerTreeHostImpl::PrepareToDraw. Becauseneeds_update_draw_properties_isfalse, it skips recalculating the draw properties and keeps the stalerender_surface_list_. - RCE Primitives:
PrepareToDrawcallsDamageTracker::UpdateDamageTracking, which iterates the stale list and executesrender_surface->damage_tracker()->PrepareForUpdate(). Using the attacker's forgeddamage_tracker_pointer,PrepareForUpdate()executes with a controlledthiscontext. This provides the attacker with an arbitrary 32-bit increment primitive (mailbox_id_++) and an arbitrary vector clear primitive (contributing_surfaces_.clear()), which can be chained to achieve Remote Code Execution (RCE) in the GPU process.
Suggested Fix
Ensure that the needs_update_draw_properties_ flag is set to true (or the render_surface_list_ is explicitly cleared) whenever property trees are physically mutated, regardless of whether the overall DoUpdateDisplayTree function succeeds or fails.
For example, ResizePropertyTree could accept the LayerTreeImpl reference and call set_needs_update_draw_properties() internally if it returns true. Alternatively, DoUpdateDisplayTree could use a base::ScopedClosureRunner to ensure state cleanup on early returns.
Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33
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.
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
DoUpdateDisplayTree mutates property trees and frees RenderSurfaceImpl objects before validation completes, and an early return on validation failure skips setting needs_update_draw_properties_, leaving stale raw pointers in render_surface_list_.
Impact
An attacker with a compromised renderer could achieve remote code execution in the GPU process via arbitrary increment and vector clear primitives, though the report notes these are suggested steps from static analysis without a working proof of concept.
What the attacker needed
Compromised renderer process; kTreesInViz enabled
The fix
The fix should ensure that needs_update_draw_properties_ is set to true (or the render surface list is cleared) whenever property trees are mutated, regardless of whether DoUpdateDisplayTree succeeds or fails.
How it was found
- A compromised renderer establishes a valid LayerContext connection to the GPU process.
- The renderer sends a valid LayerTreeUpdate with frame_has_damage set, forcing a successful draw that clears the update flag and populates the render surface list.
- The renderer sends a LayerTreeUpdate with fewer effect nodes, causing ResizePropertyTree to free RenderSurfaceImpl objects.
- The renderer includes a large surface_ranges array to heap-groom the freed slots with a fake RenderSurfaceImpl.
- The renderer sets page_scale_factor to NaN, so validation fails and the function returns early without setting the update flag.
- Before the asynchronous Mojo teardown runs, the renderer requests a BeginFrame, which triggers a draw that dereferences the stale pointers.
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, then later uses that pointer as if the memory still belonged to it. Here, the GPU process frees some objects but forgets to mark that its list of surfaces is out of date, so a later draw reads the freed memory. An attacker who already controls the renderer process could shape that freed memory and potentially run code in the more privileged GPU process.
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.