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

Use after free in Skia (CVE-2026-14419)

A use-after-free or wild write can occur in Skia's Graphite DrawBufferManager when a buffer allocation fails mid-recording, leaving stale raw pointers in stack-local allocators that are later reused. An attacker could potentially trigger this by forcing a transient allocation failure, leading to memory corruption in the GPU process.

Google Chrome

Originally disclosed on Chrome VRP

Critical View original
  • Fix shipped in 35 days

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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential vulnerability in Skia's Graphite DrawBufferManager can lead to a Use-After-Free or wild write in the GPU process. When a buffer allocation fails mid-recording, stack-local allocators are destructed and can stash stale raw pointers that are subsequently reused. In release builds, failure-handling paths fail to clear these stale allocators, allowing subsequent invalid memory operations.

Affected files:

  • third_party/skia/src/gpu/graphite/BufferManager.cpp
  • third_party/skia/src/gpu/graphite/BufferManager.h

Estimated timestamp from git blame: 2025-10-13

Root Cause Analysis

In Skia's Graphite implementation, BufferSubAllocator::reset() (defined in third_party/skia/src/gpu/graphite/BufferManager.cpp) handles returning or stashing a GPU buffer when a sub-allocator goes out of scope. However, it does not properly handle the state where the owning DrawBufferManager has encountered an allocation or mapping failure (fMappingFailed is true).

When an allocation failure occurs, DrawBufferManager::onFailedBuffer() is called. It marks fMappingFailed = true and clears state.fAvailableBuffer (lines 370-375). However, active stack-local BufferSubAllocator instances (held by utilities like UniformTracker or DrawWriter) are unaffected at this stage.

When the failed recording is aborted and the stack unwinds, the destructors of these stack-local allocators are called, invoking BufferSubAllocator::reset(). Inside reset() (lines 282-284), the following condition is evaluated to determine whether to stash the buffer or move it to fUsedBuffers:

C++
else if (state.fAvailableBuffer.fBuffer.get() == fBuffer.get() ||
           this->remainingBytes() < state.fAvailableBuffer.remainingBytes() ||
           this->remainingBytes() < state.fMinAlignment)

Because onFailedBuffer() recently cleared state.fAvailableBuffer, its underlying fBuffer is null, meaning state.fAvailableBuffer.remainingBytes() is 0. Consequently, this->remainingBytes() < state.fAvailableBuffer.remainingBytes() evaluates to false. Execution falls into the else block (line 295):

C++
state.fAvailableBuffer = std::move(*this);

This move assignment copies the raw CPU mapped pointer (fMappedPtr) and the raw transfer buffer pointer (fTransferBuffer) completely unchanged into state.fAvailableBuffer.

In release builds, the safety assert in DrawBufferManager::transferToRecording() is compiled out, allowing transferToRecording() to return false and reset fMappingFailed to false while silently leaving the stale allocator inside fAvailableBuffer (lines 391-403). On a subsequent successful recording session, getBuffer() retrieves this stale allocator and returns it to the caller, leading to a wild write via the dangling fMappedPtr and a potential heap Use-After-Free (UAF) read/downcast on the deleted srcBuffer inside DawnCommandBuffer::onCopyBufferToBuffer (line 1232).

Additionally, any stack-local allocators that execute the else if branch of reset() will push their stale references to fUsedBuffers (line 291). Because transferToRecording() returns early on fMappingFailed without clearing fUsedBuffers, these stale buffers contaminate the manager's state into the next recording session.


Suggested/Potential Trigger Path

Note: These steps are suggested and potential; our automated analysis tools do not currently have the capability to run code or execute a live proof-of-concept.

  1. Trigger Transient Failure: An attacker forces a transient allocation/mapping failure in the GPU process (for instance, by scheduling extremely large canvas or WebGPU operations to hit memory limits).
  2. OnFailedBuffer Invocation: The allocation failure invokes onFailedBuffer(), which marks fMappingFailed = true and clears fAvailableBuffer.
  3. Destructor Stashing: The failed recording aborts, and stack unwinding invokes the destructor of stack-local allocators (e.g., UniformTracker). The destructor executes the else block of BufferSubAllocator::reset(), moving raw, stale pointers (fMappedPtr, fTransferBuffer) into state.fAvailableBuffer.
  4. Recording Discard: transferToRecording() returns early, resetting fMappingFailed but leaving the stale allocator in fAvailableBuffer untouched.
  5. Re-use and Corruption: A subsequent successful recording begins. The allocator retrieves the stale cache from fAvailableBuffer. Writing to fMappedPtr results in a wild write. When the allocator goes out of scope, the stale transfer buffer is pushed to fUsedBuffers, causing a heap Use-After-Free inside DawnCommandBuffer::onCopyBufferToBuffer when the command copy is executed.

Suggested Fix

To prevent both stashing and contamination of fUsedBuffers during an active allocation failure, BufferSubAllocator::reset() should check if fOwner->fMappingFailed is true and immediately discard its resources:

C++
void BufferSubAllocator::reset() {
    if (fBuffer) {
        SkASSERT(fOwner);
        if (fOwner->fMappingFailed) {
            fBuffer.reset();
            fRemaining = 0;
            return;
        }
        // ... existing reset logic ...

Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8


Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:

  • If you are familiar with the severity guidelines, you may adjust the severity.
  • If this is a false positive, and there's no work to be done, please close as WAI.
  • If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.

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 reset() method of BufferSubAllocator does not check whether the owning DrawBufferManager has failed, so it stashes stale pointers into fAvailableBuffer and fUsedBuffers that are later reused.

Impact

This could lead to a wild write and a heap use-after-free in the GPU process, potentially allowing memory corruption or a crash, though the report notes these steps are suggested and not yet proven.

What the attacker needed

Ability to trigger GPU memory allocation failure; subsequent successful recording session

The fix

The reset() method should check if the owner's fMappingFailed flag is true and immediately discard resources instead of stashing them.

How it was found

  1. Force a transient allocation or mapping failure in the GPU process, for example by scheduling very large canvas or WebGPU operations.
  2. The failure calls onFailedBuffer(), which sets fMappingFailed to true and clears fAvailableBuffer.
  3. When the failed recording aborts, stack unwinding calls the destructor of stack-local allocators, which moves stale raw pointers into fAvailableBuffer.
  4. transferToRecording() returns early, resetting fMappingFailed but leaving the stale allocator in fAvailableBuffer.
  5. A subsequent successful recording retrieves the stale allocator, and writing to its mapped pointer causes a wild write; later, the stale transfer buffer is pushed to fUsedBuffers, causing a use-after-free in…

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 a graphics library. When the GPU runs out of memory during a drawing operation, some internal pointers are not cleaned up properly, and later they are used again even though the memory they point to may have been freed. This can cause the program to write to or read from memory it should not, which could crash the browser or potentially be exploited.

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.