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

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

A use-after-free vulnerability exists in the MediaFoundationVideoEncodeAccelerator due to a race condition between object destruction and callbacks from the Windows Media Foundation thread pool. An attacker could potentially trigger the destruction while a callback is pending, leading to remote code execution in the GPU process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 46 days

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

Overview: A potential use-after-free (UAF) vulnerability exists in the MediaFoundationVideoEncodeAccelerator due to a race condition between object destruction and callbacks from the Windows Media Foundation thread pool. The class registers a raw pointer with the OS but uses fake COM reference counting, meaning explicit destruction does not wait for pending callbacks to drain. If an attacker triggers destruction while an OS callback is pending, the OS thread will invoke a virtual method on the freed object, potentially leading to Remote Code Execution (RCE) in the GPU process.

Affected files:

  • media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
  • media/gpu/windows/media_foundation_video_encode_accelerator_win.h

Estimated timestamp from git blame: 2023-07-10

Background

The MediaFoundationVideoEncodeAccelerator (MFVEA) class in the Windows GPU process implements the IMFAsyncCallback interface to receive events from the Windows Media Foundation (MF) framework. It uses an asynchronous processing model where events are handled via callbacks on a system-managed thread pool (MFASYNC_CALLBACK_QUEUE_TIMER).

The Vulnerability

The vulnerability is a potential use-after-free (UAF) that occurs because MFVEA objects can be deleted while a callback is still pending or actively executing on a Media Foundation thread.

  1. Insecure Callback Registration: During initialization and whenever an event is received, MFVEA arms a callback by passing its this pointer to the MF framework:

    C++
    event_generator_->BeginGetEvent(this, nullptr);
    

    The MF framework stores this raw pointer and invokes the Invoke() method on an OS thread Chromium does not control.

  2. Fake Reference Counting: Although MFVEA implements AddRef and Release, it uses "fake" COM refcounting. The Release() method decrements an atomic counter but never deletes the object:

    C++
    ULONG MediaFoundationVideoEncodeAccelerator::Release() {
      DCHECK(!async_callback_ref_.IsOne());
      return async_callback_ref_.Decrement() ? 1 : 0;
    }
    

    Consequently, the internal AddRef performed by the Media Foundation framework does not extend the lifetime of the C++ object.

  3. Unsafe Destruction: The object's lifetime is managed by the Destroy() method, which is reachable from a renderer process via Mojo (e.g., videoEncoder.close()). Destroy() calls activate_->ShutdownObject() and then immediately deletes this:

    C++
    void MediaFoundationVideoEncodeAccelerator::Destroy() {
      if (activate_) {
        activate_->ShutdownObject();
      }
      delete this;
    }
    

    However, ShutdownObject() does not synchronously drain the Media Foundation work queue or guarantee that no Invoke() callbacks will run after it returns.

  4. Race Condition and Use-After-Free: A race condition occurs when Destroy() is called while an MF thread is entering or executing Invoke(). The Invoke() method is a virtual function call. If the object is deleted before the MF thread makes this call, the OS thread will execute a virtual method call on a freed object pointer.

MiraclePtr Bypass

Because the dangling pointer is held internally by the Windows Media Foundation framework (as a raw C/C++ pointer) rather than by a Chromium data structure using base::raw_ptr<T>, PartitionAlloc's MiraclePtr (BackupRefPtr) does not track this reference. The memory is fully freed and not quarantined, making it immediately available for reallocation and exploitation.

Potential Attacker Steps (Unverified)

  1. An attacker compromises a renderer process or uses the WebCodecs API (VideoEncoder).
  2. The attacker configures the VideoEncoder for a Windows Media Foundation codec (e.g., H.264).
  3. The GPU process creates and initializes a MediaFoundationVideoEncodeAccelerator (MFVEA), registering this with the MF thread pool.
  4. The attacker abruptly closes the encoder (videoEncoder.close()), destroying the Mojo pipe.
  5. The GPU process executes MFVEA::Destroy(), calling delete this;.
  6. The attacker rapidly allocates memory in the GPU process (e.g., via WebGL or creating other media objects) to reclaim the freed MFVEA memory block, placing a fake vtable at the start.
  7. A pending MF callback executes on an OS worker thread, calling pCallback->Invoke(pAsyncResult).
  8. The OS thread dereferences the attacker's fake vtable, hijacking control flow and achieving RCE in the sandboxed GPU process (a Sandbox Escape from the renderer).

Recommended Fix

Synchronization must be re-introduced to ensure destruction does not proceed while a callback is active. This can be achieved in two ways:

  1. Implement Real COM Reference Counting: Use Microsoft::WRL::RuntimeClass or similar mechanisms so that the object is only deleted when all OS-level references are released. This ensures the object outlives the MF thread pool callbacks.
  2. Restore the Shutdown Lock Pattern: Similar to other Chromium Media Foundation implementations (e.g., MediaEngineNotifyImpl), introduce a lock (destroy_lock_) and a shutdown flag (in_shutdown_). In Destroy(), set in_shutdown_ = true under the lock. At the beginning of Invoke(), acquire the lock and return early if in_shutdown_ is true. Note: this alone does not prevent the UAF if Destroy() still immediately calls delete this;. The object must be kept alive, or Invoke() must not be allowed to execute after delete this;. Therefore, proper COM refcounting is the most robust solution.

Evaluated with Chrome root at commit: 876d480da1f794d87813cfa2e6ff4fcf9771e939


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

The object uses fake COM reference counting and its Destroy method deletes the object without ensuring that pending callbacks from the Media Foundation thread pool have completed.

Impact

An attacker could potentially achieve remote code execution in the GPU process, leading to a sandbox escape from the renderer.

What the attacker needed

Attacker compromises renderer or uses WebCodecs; Windows Media Foundation codec available; ability to rapidly allocate memory in GPU process

The fix

The fix should implement real COM reference counting or restore a shutdown lock pattern to ensure the object outlives pending callbacks.

How it was found

  1. An attacker compromises a renderer process or uses the WebCodecs API (VideoEncoder).
  2. The attacker configures the VideoEncoder for a Windows Media Foundation codec (e.g., H.264).
  3. The GPU process creates and initializes a MediaFoundationVideoEncodeAccelerator (MFVEA), registering this with the MF thread pool.
  4. The attacker abruptly closes the encoder (videoEncoder.close()), destroying the Mojo pipe.
  5. The GPU process executes MFVEA::Destroy(), calling delete this;.
  6. The attacker rapidly allocates memory in the GPU process (e.g., via WebGL or creating other media objects) to reclaim the freed MFVEA memory block, placing a fake vtable at the start.

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 where an object can be deleted while another part of the program is still using it. If an attacker can control what gets written into the freed memory, they might be able to run their own code. The bug is in a Windows-specific component that handles video encoding.

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.