Skip to content
Race condition Advisory Advanced CVE-2026-10940

Race in Codecs (CVE-2026-10940)

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 47 days

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

Overview: D3D12VideoEncodeAccelerator and MediaFoundationVideoEncodeAccelerator prematurely release ScopedReadAccess on SharedImages. This allows a compromised renderer to acquire a write lock and modify textures concurrently while they are being encoded by the hardware. This API violation can lead to memory corruption in the GPU driver.

Affected files:

  • media/gpu/windows/d3d12_video_encode_accelerator.cc
  • media/base/win/mf_helpers.cc

Estimated timestamp from git blame: 2026-01-28

Summary

A potential race condition exists in the Windows hardware video encoder implementations (D3D12VideoEncodeAccelerator and MediaFoundationVideoEncodeAccelerator) due to the premature destruction of gpu::VideoImageRepresentation::ScopedReadAccess objects. This allows a compromised renderer process to gain write access to a texture while it is simultaneously being processed by the hardware encoder in the GPU process.

Technical Details

In both media/gpu/windows/d3d12_video_encode_accelerator.cc and media/base/win/mf_helpers.cc, video frames backed by SharedImages are accessed by creating a gpu::VideoImageRepresentation and calling BeginScopedReadAccess() on the GPU main thread. This call is critical for synchronizing access to the underlying D3D11 texture, acquiring the DXGI Keyed Mutex or inserting D3D Shared Fences to prevent concurrent modifications.

However, the resulting ScopedReadAccess object is stored as a local variable within the following helper functions:

  • media/gpu/windows/d3d12_video_encode_accelerator.cc: GenerateResourceOnSynTokenReleased (and indirectly GenerateResourceFromSharedImageVideoFrame)
  • media/base/win/mf_helpers.cc: GenerateResourceOnSyncTokenReleased

Because these objects are local variables, they are destroyed when the function returns. The destruction of ScopedReadAccess invokes EndReadAccess(), which releases the Keyed Mutex or signals the fence, indicating to the driver that the GPU process is finished reading the resource.

The functions then pass a shared handle or an IMFSample to a callback, which is executed asynchronously on the encoder's background thread. By the time the hardware encoder actually starts reading from the texture on the background thread, the ScopedReadAccess has already been destroyed and the read lock released on the main thread.

Potential Exploitation Steps (Theoretical)

  1. A compromised renderer creates a SharedImage to be used as a video frame.
  2. The renderer submits this frame to a hardware video encoder via WebCodecs.
  3. The GPU main thread executes GenerateResourceOnSynTokenReleased(), briefly acquiring and then releasing the read lock on the SharedImage.
  4. The compromised renderer monitors the Mailbox and, immediately after the read lock is released, issues a WebGL/Canvas write command targeting the SharedImage.
  5. The GPU main thread processes the write command, acquires a write lock, and begins mutating the texture via D3D11.
  6. Concurrently, the encoder's background thread submits the frame to the hardware encoder.
  7. The hardware encoder reads the texture while D3D11 is actively writing to it. This concurrent access without synchronization violates D3D API constraints, triggering undefined behavior in the graphics driver that could lead to memory corruption and a sandbox escape to the GPU process.

Affected Locations

  1. media/gpu/windows/d3d12_video_encode_accelerator.cc: GenerateResourceOnSynTokenReleased (around line 166)
  2. media/base/win/mf_helpers.cc: GenerateResourceOnSyncTokenReleased (around line 1085)

Proposed Fix

The lifetime of the VideoImageRepresentation and its ScopedReadAccess must be extended to cover the entire duration of the hardware encoding process. These objects should be captured and passed into the callback (e.g., moved into a wrapper structure) so they are held alive by the background thread until the hardware encoder completes processing the resource.

Evaluated with Chrome root at commit: c0eb5541aebfa4ea08806eaf6e94bcc69f87ab2f


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.

What is known

A high-severity race condition bug in Codecs (Google Chrome). Chrome VRP made it public on 2 June 2026 as CVE-2026-10940. Fixed in version 149.0.7827.53.

About Race condition

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.