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

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

A missing validation check during Mojo deserialization of SkColor4f allows a compromised renderer to send NaN values to the GPU process. On macOS, this corrupts a std::map's internal tree, leading to a use-after-free that could potentially be exploited for remote code execution.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 4 months

Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the security team.

Overview: A missing validation check during Mojo deserialization of SkColor4f allows a compromised renderer to send NaN values to the GPU process. On macOS, this corrupts the internal Red-Black tree of a std::map used for caching solid colors, leading to a Use-After-Free condition. An attacker can potentially exploit this dangling pointer to achieve Remote Code Execution via a hijacked CFRelease call.

Affected files:

  • skia/public/mojom/skcolor4f_mojom_traits.h
  • services/viz/public/cpp/compositing/quads_mojom_traits.cc
  • ui/accelerated_widget_mac/ca_renderer_layer_tree.mm

Estimated timestamp from git blame: 2024-10-09

Summary

A validation gap in the Mojo deserialization of skia::mojom::SkColor4f allows a compromised renderer to send non-finite floating-point values (NaN) to the GPU process. On macOS, these values reach the CARendererLayerTree, where they are used as keys in a std::map. Because NaN comparisons violate the strict weak ordering required by std::map, the internal tree structure becomes corrupted. This corruption causes node removal to fail silently, resulting in a Use-After-Free (UAF) condition that can potentially be leveraged for arbitrary code execution (RCE) in the GPU process.

Root Cause Analysis

  1. Mojo Deserialization: In skia/public/mojom/skcolor4f_mojom_traits.h, the Read method copies RGBA components directly from the Mojo wire without verifying if the floats are finite using std::isfinite().
  2. Ineffective Clamping: In services/viz/public/cpp/compositing/quads_mojom_traits.cc, SolidColorQuadState deserialization attempts to clamp the alpha component using std::clamp(quad->color.fA, 0.0f, 1.0f). Because NaN < 0.0f and 1.0f < NaN both evaluate to false, std::clamp returns the NaN value unmodified.
  3. Strict Weak Ordering Violation: In ui/accelerated_widget_mac/ca_renderer_layer_tree.mm, SolidColorContents objects are cached in a std::map utilizing ComparatorSkColor4f. This comparator uses std::tie to perform a lexicographical comparison on the float components. When comparing NaN to any finite value, both < and > return false, causing std::tie to treat the component as "equivalent" and fall through to the next component. This creates non-transitive cycles (e.g., A < B < C < A), thoroughly corrupting the map's underlying Red-Black tree during insertions.

Potential Exploitation Steps

Note: These are suggested steps based on static analysis. A working proof of concept has not yet been developed to run this code.

  1. Tree Corruption: A compromised renderer sends a sequence of SolidColorDrawQuads with carefully chosen NaN and finite color values. This triggers insertions into the std::map in the GPU process, corrupting its internal tree structure.
  2. Creating the UAF: The attacker causes one of the generated layers to be discarded. This drops the reference count of the corresponding SolidColorContents to zero, triggering its destructor. The destructor attempts to call map->erase(color_). Because the tree is corrupted, the binary search takes the wrong path and fails to find the node. std::map::erase silently returns 0 in Release builds (where DCHECKs are stripped). The object's memory is freed, but a dangling raw pointer remains in the map.
  3. Heap Grooming: The attacker leverages other GPU process IPCs to allocate controlled data into the exact PartitionAlloc slot previously occupied by the freed SolidColorContents.
  4. Triggering the Payload: The attacker sends another SolidColorDrawQuad designed to navigate the corrupted tree and return the dangling pointer via SolidColorContents::Get.
  5. RCE via CFRelease: The GPU process wraps the dangling pointer in a new scoped_refptr, which increments a fake reference count in the attacker's payload. When this layer is eventually discarded, the destructor is called on the fake object. This automatically invokes the destructor of the io_surface_ member (base::apple::ScopedCFTypeRef<IOSurfaceRef>), which calls the system API CFRelease() on an attacker-controlled pointer. By forging an Objective-C object header (the isa pointer), the attacker can hijack the method dispatch during deallocation, resulting in arbitrary code execution in the GPU process.

MiraclePtr / BRP Status

This vulnerability is not protected by MiraclePtr (BackupRefPtr). The std::map stores raw C++ pointers (SolidColorContents*). The SolidColorContents objects inherit from base::RefCounted and are managed by scoped_refptr. Chromium's scoped_refptr implementation explicitly excludes its internal pointer from MiraclePtr (RAW_PTR_EXCLUSION) for performance reasons, meaning the dangling pointer access goes unprotected.

Suggested Fix

  1. Mojo Validation: Add std::isfinite checks in StructTraits<skia::mojom::SkColor4fDataView, ::SkColor4f>::Read inside skia/public/mojom/skcolor4f_mojom_traits.h. If any component is NaN or infinity, deserialization should fail (return false;).
  2. Defense in Depth: Consider updating ComparatorSkColor4f to use std::partial_ordering or a custom float comparison that explicitly and safely handles NaN values (e.g., treating NaN as always less than or always greater than finite values, or rejecting them), to ensure strict weak ordering is never violated.

Evaluated with Chrome root at commit: 137d451a126685dd5010e6609db9f6d4a78d8234


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. 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 root cause is that the Mojo deserialization of SkColor4f does not check for non-finite floating-point values, and the subsequent use of these values as keys in a std::map violates the strict weak ordering requirement, corrupting the map's internal tree.

Impact

An attacker could potentially achieve remote code execution in the GPU process, but a working proof of concept has not yet been developed.

What the attacker needed

Compromised renderer; macOS; no working PoC yet

The fix

The fix should add std::isfinite checks in the Mojo deserialization and consider updating the comparator to handle NaN values safely.

How it was found

  1. A compromised renderer sends a sequence of SolidColorDrawQuads with carefully chosen NaN and finite colour values.
  2. The attacker causes one of the generated layers to be discarded, triggering the destructor of SolidColorContents.
  3. The destructor attempts to erase the colour from the corrupted map, but the erase fails silently, leaving a dangling pointer.
  4. The attacker uses other GPU process IPCs to allocate controlled data into the freed memory slot.
  5. The attacker sends another SolidColorDrawQuad to retrieve the dangling pointer via SolidColorContents::Get.
  6. The GPU process wraps the dangling pointer in a scoped_refptr, and when the layer is discarded, CFRelease is called on an attacker-controlled pointer, potentially leading to code execution.

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 bug in a web browser's graphics system. A compromised part of the browser (the renderer) can send special 'not a number' values to another part (the GPU process). These values confuse a data structure that stores colours, causing it to free memory but keep a pointer to it. An attacker might then reuse that freed memory to run their own code.

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.