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

Use after free in Media (CVE-2026-19171)

A use-after-free exists in the Windows GPU process when using the MediaFoundationVideoEncodeAccelerator, because a SharedImageReadLock holds a raw pointer to a CommandBufferHelperImpl member without keeping the helper alive. An attacker could potentially trigger a virtual call on freed memory by destroying the encoder while an asynchronous hardware encoder still holds a sample referencing the lock.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 16 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 Use-After-Free (UAF) vulnerability exists in the Windows GPU process when using MediaFoundationVideoEncodeAccelerator (MFVEA). SharedImageReadLock wraps a VideoImageRepresentation holding a raw pointer to a CommandBufferHelperImpl member but does not maintain a reference to keep the helper alive. If an asynchronous hardware encoder releases an IMFSample holding the lock after the encoder and its helper are destroyed, the lock's destruction accesses freed memory on the GPU main thread.

Affected files:

  • media/base/win/mf_helpers.h
  • media/base/win/mf_helpers.cc
  • media/gpu/windows/media_foundation_video_encode_accelerator_win.cc

Estimated timestamp from git blame: 2026-04-24

Root Cause Analysis

In media/base/win/mf_helpers.cc, a SharedImageReadLock is constructed to manage the lifetime of a VideoImageRepresentation and its ScopedReadAccess. The VideoImageRepresentation holds a raw pointer (tracker_) to an inline MemoryTypeTracker member of a CommandBufferHelperImpl instance:

C++
// media/base/win/mf_helpers.cc
std::unique_ptr<gpu::VideoImageRepresentation> image_representation =
    shared_image_manager->ProduceVideo(
        shared_d3d11_device, frame->shared_image()->mailbox(),
        command_buffer_helper->GetMemoryTypeTracker());

However, SharedImageReadLock does not hold a scoped_refptr<CommandBufferHelper> to guarantee the lifetime of the tracker.

When MFVEA populates input samples for the asynchronous Media Foundation Transform (HMFT), it attaches the SharedImageReadLock directly to the IMFSample COM attributes using SetUnknown with SharedImageReadLock::kSampleExtensionGUID and drops its local queue references. This hands ownership of the lock's lifetime over to the Media Foundation driver and the OS-managed COM runtime graph.

Upon encoder destruction (MediaFoundationVideoEncodeAccelerator::Destroy()), MFVEA is deleted. No flush command is processed beforehand, which leaves active sample references inside the driver's queued pipeline. The destruction of MFVEA's command_buffer_helper_ member drops the last Chrome-side reference to CommandBufferHelperImpl, posting its deletion (~CommandBufferHelperImpl) to the GPU main thread.

Subsequently, when the HMFT completes and releases the IMFSample on an OS background thread, the COM reference count of the SharedImageReadLock drops to 0. Its destructor (~SharedImageReadLock()) runs on the background thread and posts DestroySharedImageResourcesOnGpuThread to the GPU main thread.

Because both deletion tasks are executed sequentially on the GPU main thread, the CommandBufferHelperImpl is deallocated first. The subsequent cleanup task then executes TrackMemFree on the dangling MemoryTypeTracker pointer, causing a Use-After-Free with a virtual call to TrackMemoryAllocatedChange on the freed memory space.

Potential Trigger Path

Note: These are potential steps that an attacker might follow; our analysis is based on static code tracing as we do not have a running PoC.

  1. From a sandboxed renderer on Windows, initiate hardware encoding via the mojom::VideoEncodeAcceleratorProvider interface.
  2. Submit a GPU-backed VideoFrame whose SharedImage is non-mappable, triggering the creation of a SharedImageReadLock wrapping the VideoImageRepresentation and its read-access token.
  3. The lock is attached to the input IMFSample via SetUnknown and handed off to the async HMFT via ProcessInput().
  4. Drop the local queue references in MFVEA via pending_input_queue_.pop_front() so that the lock is kept alive only by the OS-owned driver sample.
  5. Release the source VideoFrame mailbox reference in the renderer so that the representation wrapped by the lock becomes the owning reference (refs_[0]) in the SharedImageBacking.
  6. Close/destroy the encoder from the renderer. MFVEA's Destroy() runs, deleting the object and posting ~CommandBufferHelperImpl to the GPU main thread.
  7. The async HMFT releases the IMFSample on a background thread after the helper deletion task has been queued, posting DestroySharedImageResourcesOnGpuThread to the GPU main thread.
  8. The GPU main thread executes the tasks: it deallocates CommandBufferHelperImpl (freeing its inline MemoryTypeTracker member) and then executes TrackMemFree on the dangling tracker pointer during representation cleanup, resulting in a virtual call on freed memory.

Suggested Fix

Modify SharedImageReadLock (media/base/win/mf_helpers.h and media/base/win/mf_helpers.cc) to capture and hold a scoped_refptr<CommandBufferHelper> member. Passing the helper into the lock's constructor guarantees that the CommandBufferHelperImpl (and its inline MemoryTypeTracker) remains alive until all outstanding SharedImageReadLock instances are fully destroyed, preventing the raw tracker pointer from dangling.

Evaluated with Chrome root at commit: 5a99d0c5d2ec6c066f5131e7868ff637440cc3dc


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 SharedImageReadLock stores a raw pointer to a CommandBufferHelperImpl's inline MemoryTypeTracker without holding a reference to the helper, so the helper can be destroyed while the lock still exists.

Impact

An attacker could potentially cause a use-after-free with a virtual call on freed memory in the GPU process, which may lead to a crash or possibly code execution, though the report notes this is based on static analysis without a running proof of concept.

What the attacker needed

Windows platform; Sandboxed renderer access; Hardware encoding via VideoEncodeAcceleratorProvider; Non-mappable GPU-backed VideoFrame

The fix

SharedImageReadLock should be modified to capture and hold a scoped_refptr<CommandBufferHelper> member, passing the helper into the lock's constructor to guarantee the helper remains alive until all outstanding locks are destroyed.

How it was found

  1. From a sandboxed renderer on Windows, initiate hardware encoding via the mojom::VideoEncodeAcceleratorProvider interface.
  2. Submit a GPU-backed VideoFrame whose SharedImage is non-mappable, triggering creation of a SharedImageReadLock.
  3. The lock is attached to the input IMFSample and handed off to the async HMFT via ProcessInput().
  4. Drop the local queue references in MFVEA so the lock is kept alive only by the OS-owned driver sample.
  5. Release the source VideoFrame mailbox reference in the renderer so the representation becomes the owning reference.
  6. Close/destroy the encoder from the renderer, causing MFVEA's Destroy() to run and post helper deletion to the GPU main thread.

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 keeps a pointer to memory it has already released, then later uses that pointer as if the memory were still valid. Here, a lock object refers to a helper object but does not keep it alive, so when the helper is deleted first, the lock's cleanup touches freed memory. This could let an attacker who can trigger the right sequence cause a crash or possibly run code in the 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.

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.