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

Use after free in Dawn (CVE-2026-11687)

A potential use-after-free exists in the Dawn Metal backend due to a race between a background command completion handler and Queue destruction. An attacker able to run WebGPU code could trigger the race by rapidly submitting command buffers and destroying the device, leading to memory corruption or a crash in the GPU process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 12 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 Dawn Metal backend due to a race condition between a background command completion handler and Queue destruction. The background handler captures a raw Queue pointer, and the synchronization primitive used (CondVarGuard) releases its lock before notifying the condition variable, allowing the Queue to be destroyed prematurely.

Affected files:

  • third_party/dawn/src/dawn/native/metal/QueueMTL.mm
  • third_party/dawn/src/dawn/native/ExecutionQueue.cpp
  • third_party/dawn/src/dawn/common/MutexProtected.h

Estimated timestamp from git blame: 2026-03-02

Summary

A potential race condition leading to a Use-After-Free (UAF) vulnerability exists in the Dawn Metal backend. The issue occurs when an asynchronous Metal command buffer completion handler executes on a background thread while the main thread is destroying the associated Queue object. The synchronization mechanism used (CondVarGuard in MutexProtected.h) releases its internal lock before notifying the condition variable, allowing the destruction process to proceed prematurely and free the Queue (and its internal synchronization primitives) before the background thread finishes executing its destructor sequence.

Technical Details

In third_party/dawn/src/dawn/native/metal/QueueMTL.mm, the SubmitPendingCommandBuffer method registers a completion handler using Metal's addCompletedHandler:

OBJC
[*pendingCommands addCompletedHandler:^(id<MTLCommandBuffer>) {
    ...
    this->UpdateCompletedSerialTo(QueuePriority::Lowest, pendingSerial);
}];

This block captures the this pointer of the Queue object as a raw pointer and runs on a background thread managed by the Metal framework.

The background thread eventually calls ExecutionQueueBase::UpdateCompletedSerialToInternal in third_party/dawn/src/dawn/native/ExecutionQueue.cpp to update the queue's completed serial:

C++
mCompletedSerial.Use([&](auto completedSerial) {
    *completedSerial = std::max(*completedSerial, static_cast<uint64_t>(newCompletedSerial));
});

The serial update uses mCompletedSerial.Use(), which returns a CondVarGuard from third_party/dawn/src/dawn/common/MutexProtected.h.

CondVarGuard is designed to release its lock before notifying waiting threads. This is achieved by declaring mGuard after mNotifyScope in the class definition, ensuring the lock (mGuard) is destroyed first in the destructor sequence:

C++
template <typename T, typename Traits, NotifyType NotifyT = NotifyType::All>
class CondVarGuard : public NonMovable, StackAllocated {
...
  private:
    NotifyScope<NotifyT> mNotifyScope;
    Guard<T, Traits> mGuard;
};

This creates an unlock-then-notify gap. The potential vulnerability manifests via the following race sequence:

  1. The background thread updates the serial value inside UpdateCompletedSerialToInternal and begins executing the destructor of CondVarGuard.
  2. First, mGuard is destroyed, releasing the mutex on mCompletedSerial.
  3. Simultaneously, the main thread is waiting for the queue to idle during destruction in Queue::WaitForIdleForDestructionImpl(), which blocks on mCompletedSerial via WaitForQueueSerialImpl().
  4. Because the background thread has released the lock and updated the serial, the main thread's wait predicate becomes true. The main thread can acquire the lock, observe the predicate as satisfied, and return from the wait immediately without waiting for the condition variable notification.
  5. The main thread proceeds to complete the destruction of the Queue object, freeing mCompletedSerial (and its internal std::condition_variable and std::mutex objects).
  6. The background thread, still executing the destructor of CondVarGuard, resumes and attempts to run ~NotifyScope(), which calls this->cv->notify_all(). However, cv is a bare std::condition_variable* pointing to the now-freed member inside the destroyed Queue object, causing a Use-After-Free (UAF).

Note: These are potential steps and findings as our tooling agent does not currently have the ability to execute code and run a live proof of concept.

Impact and Scope

If exploitable, an attacker with the ability to execute WebGPU code (e.g., from a compromised or malicious renderer process) could trigger this race by rapidly submitting command buffers and immediately destroying the device and queue. This would lead to memory corruption or a crash in the GPU process. Since Metal is the default backend on macOS and iOS, this represents a high-impact potential vulnerability.

MiraclePtr does not mitigate this because the stack-allocated NotifyScope holds a bare std::condition_variable* rather than raw_ptr<>, and the Objective-C block captures this as a raw pointer.

Suggested Fix

The vulnerability can be resolved by ensuring that the condition variable is notified before the mutex lock is released in CondVarGuard. This guarantees that the background thread has finished accessing the condition variable before the waiting thread can acquire the lock and destroy the parent Queue object.

This can be done by changing the declaration order of the member variables in CondVarGuard in third_party/dawn/src/dawn/common/MutexProtected.h:

C++
  private:
    Guard<T, Traits> mGuard;
    NotifyScope<NotifyT> mNotifyScope;

By declaring mGuard first, mNotifyScope will be destroyed first, calling notify_all() while the lock is still held.

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 CondVarGuard releases its mutex before notifying the condition variable, so a waiting thread can wake, observe the predicate, and destroy the parent object while the notifying thread still holds a pointer to the condition variable.

Impact

If exploitable, an attacker with the ability to execute WebGPU code could trigger this race to cause memory corruption or a crash in the GPU process; the report notes no live proof of concept was run.

What the attacker needed

Ability to execute WebGPU code; Metal backend on macOS or iOS; race timing

The fix

The fix should ensure the condition variable is notified before the mutex lock is released, by swapping the declaration order of the guard and notify scope members in CondVarGuard.

How it was found

  1. The background thread updates the serial value and begins destroying the CondVarGuard.
  2. The guard releases the mutex on the completed serial.
  3. The main thread waiting for the queue to idle acquires the lock, sees the predicate satisfied, and returns without waiting for notification.
  4. The main thread completes destruction of the Queue, freeing the condition variable and mutex.
  5. The background thread resumes and calls notify_all on the freed condition variable, causing a use-after-free.

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 memory but then keeps using it, which can corrupt data or crash. Here, a background thread and the main thread race: the main thread frees a queue object while the background thread still tries to signal a condition variable inside it. The report is theoretical and no live proof of concept was run.

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.