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

Use after free in Modularization (CVE-2026-106315)

A use-after-free vulnerability exists in Breakout Box when a MediaStreamTrack is transferred to a Worker that is immediately terminated. An attacker could potentially achieve remote code execution in the renderer by exploiting a race condition between the IO thread and the Worker's heap termination.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 6 months

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

Overview: A potential Use-After-Free exists in Breakout Box when a MediaStreamTrack is transferred to a Worker that is immediately terminated. An ordering inversion allows a CrossThreadPersistent handle to be set after the Worker's teardown mitigation has run, leading to a data race between the IO thread and the Worker's Oilpan heap termination. This allows the IO thread to dereference a freed object, potentially leading to remote code execution in the renderer.

Affected files:

  • third_party/blink/renderer/modules/breakout_box/frame_queue_underlying_source.cc
  • third_party/blink/renderer/modules/breakout_box/frame_queue_transferring_optimizer.cc
  • third_party/blink/renderer/modules/breakout_box/transferred_frame_queue_underlying_source.cc
  • third_party/blink/renderer/modules/breakout_box/media_stream_video_track_underlying_source.cc

Estimated timestamp from git blame: 2022-08-31

Vulnerability Details

When a Breakout Box stream (like a MediaStreamTrackProcessor's readable stream) is transferred to a Web Worker, a race condition can occur during Worker termination that bypasses lifecycle mitigations and leads to a Use-After-Free (UAF).

  1. Transfer and Callback Serialization: When the stream is deserialized on the Worker thread, FrameQueueTransferringOptimizer::PerformInProcessOptimization allocates a TransferredFrameQueueUnderlyingSource on the Worker's Oilpan (cppgc) heap. It then uses PostCrossThreadTask to send a connect_host_callback back to the Main thread to link the host to this new source.
  2. Mitigation Bypass: If the Worker is terminated immediately and the Main thread is artificially blocked (e.g., via a busy loop), the connect_host_callback sits in the Main thread's task queue. The Worker thread begins shutdown, which synchronously fires ContextDestroyed(). This calls ClearTransferredSource() on the host object to safely detach the stream. However, because the connect_host_callback hasn't run yet, transferred_source_ is still null, rendering this teardown mitigation completely ineffective.
  3. Late Attachment: The Main thread unblocks, processes its task queue, and executes the delayed connect_host_callback (calling TransferSource()). This sets the host's transferred_source_ to a CrossThreadPersistent handle pointing to the Worker's Oilpan object—an object belonging to a heap that is currently in the process of being destroyed.
  4. Data Race on IO Thread: The Worker thread continues its termination sequence and calls cppgc::HeapBase::Terminate(). This function severs all cross-thread roots by non-atomically zeroing out the raw_ pointers inside CrossThreadPersistent handles. Crucially, this happens without acquiring the host's lock_.
  5. Use-After-Free: Concurrently, the underlying media track delivers a frame to the IO thread, triggering QueueFrame(). The IO thread acquires host->lock_ and reads transferred_source_. Due to the lack of synchronization with HeapBase::Terminate(), CrossThreadPersistent::Get() can load a non-null pointer just before the Worker zeroes it out. The IO thread then calls transferred_source_->QueueFrame(...). Because the Oilpan heap sweep has already freed the target object, this results in a UAF. Since the memory is managed by Oilpan, it is not protected by MiraclePtr (BackupRefPtr).

Potential Steps to Trigger

Note: These are suggested steps to theoretically trigger the vulnerability; our tooling agent does not currently have the capability to run and verify a live proof-of-concept.

  1. Create a video track (e.g., from a <canvas> capture) and wrap it in a MediaStreamTrackProcessor.
  2. Call postMessage to transfer the processor's readable stream to a Web Worker.
  3. Immediately call worker.terminate() from the Main thread.
  4. Execute a brief busy-loop (while (Date.now() < start + X) {}) on the Main thread to ensure the Worker's ContextDestroyed runs before the Main thread processes the connect_host_callback.
  5. Flood the video track with frames (e.g., via requestAnimationFrame drawing to the canvas) to force the IO thread to call QueueFrame() at the exact moment the Worker's cppgc heap is terminating.
  6. The IO thread dereferences the freed TransferredFrameQueueUnderlyingSource object, where an attacker who has groomed the Worker's heap could potentially control the vtable/mutex state for Remote Code Execution.

Suggested Fix

CrossThreadPersistent handles are documented as non-thread-safe against concurrent GC clearing, meaning host->lock_ alone cannot protect the handle if the target heap terminates.

The safest fix is to prevent TransferSource from attaching the handle if the target context is already tearing down.

  1. Add a boolean flag (e.g., is_transfer_aborted_) to FrameQueueUnderlyingSource, guarded by lock_.
  2. In ClearTransferredSource() (which runs during ContextDestroyed), set is_transfer_aborted_ = true; inside the lock.
  3. Modify TransferSource() to check this flag while holding the lock. If is_transfer_aborted_ is true, drop the incoming TransferredFrameQueueUnderlyingSource and do not assign it to transferred_source_.

This ensures that if the Worker dies before the connection is fully established, the delayed callback won't accidentally wire up a dangling pointer to a dying heap.

Evaluated with Chrome root at commit: a9cbf6e8b275fe4147435aa905f3b7f5a656f5f0


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

Likely a race condition where a cross-thread callback attaches a persistent handle to a worker's heap after the worker has begun termination, and the handle is cleared without proper synchronisation, leading to a use-after-free.

Impact

An attacker could potentially achieve remote code execution in the renderer, though the report notes this is theoretical and not verified with a live proof-of-concept.

What the attacker needed

Ability to run JavaScript in the browser; victim visits a malicious page; timing control to trigger race

The fix

The fix should add a flag to prevent TransferSource from attaching the handle if the target context is already tearing down.

How it was found

  1. Create a video track and wrap it in a MediaStreamTrackProcessor.
  2. Transfer the processor's readable stream to a Web Worker using postMessage.
  3. Immediately call worker.terminate() from the main thread.
  4. Execute a busy-loop on the main thread to delay processing of the connect_host_callback.
  5. Flood the video track with frames to trigger QueueFrame() on the IO thread during heap termination.
  6. The IO thread dereferences the freed object, potentially allowing control of the vtable/mutex for remote code execution.

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 web browser component. When a video stream is passed to a background worker and that worker is shut down at the same time, the browser can try to use memory that has already been freed, which could let an attacker run their own code.

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.