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

Use after free in MediaRecording (CVE-2026-7929)

A logic error in libwebm's frame queue compaction leaves dangling pointers when disk writes fail, leading to use-after-free and double-free in ChromeOS's unsandboxed RecordingService. An attacker could fill the disk and convince a user to start a screen recording, potentially achieving arbitrary free and remote code execution.

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 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: A logic error in libwebm's Segment::WriteFramesLessThan fails to correctly compact a frame queue when disk writes fail, leaving dangling pointers. In ChromeOS, an attacker can trigger this by filling the disk and waiting for the user to initiate a screen recording. This results in a Use-After-Free and Double-Free in the unsandboxed RecordingService utility process.

Affected files:

  • third_party/libwebm/source/mkvmuxer/mkvmuxer.cc
  • chromeos/ash/services/recording/webm_encoder_muxer.cc
  • media/muxers/file_webm_muxer_delegate.cc
  • media/muxers/muxer_timestamp_adapter.cc

Estimated timestamp from git blame: 2020-11-24

Summary

A potential Use-After-Free (UAF) and Double-Free vulnerability exists in libwebm, specifically within the mkvmuxer::Segment::WriteFramesLessThan function. When the muxer attempts to write queued frames to a cluster and the write fails (e.g., due to an I/O error like ENOSPC), the code deletes the frame object but fails to properly update the queue state. This leaves dangling pointers in the array, which are subsequently accessed and freed again.

Root Cause Analysis

In third_party/libwebm/source/mkvmuxer/mkvmuxer.cc, the function Segment::WriteFramesLessThan iterates through a queue of audio frames (frames_). If writing the frame to the cluster fails, the frame is deleted. However, the shift_left variable, which tracks how many frames have been removed from the queue for subsequent array compaction, is not incremented:

C++
// third_party/libwebm/source/mkvmuxer/mkvmuxer.cc:4153-4156
if (!cluster->AddFrame(frame_prev)) {
  delete frame_prev;      // The object is deleted.
  continue;               // BUG: shift_left is NOT incremented.
}

Because shift_left remains 0 (if all queued frames fail to write), the array compaction logic at the end of the function is bypassed:

C++
// mkvmuxer.cc:4175
if (shift_left > 0) { // Evaluates to false
  // ... array compaction logic ...
  frames_size_ = new_frames_size;
}

Consequently, frames_size_ remains unchanged, and the frames_ array contains dangling pointers to the already-deleted Frame objects. The function then incorrectly returns true (success).

Suggested Exploitation Path

Note: These are potential steps based on static code analysis; a working proof-of-concept has not been executed.

  1. Disk Exhaustion: An attacker on a malicious webpage aggressively consumes the ChromeOS device's local disk space (e.g., via the Cache API) until the device is entirely out of space.
  2. User Interaction: The attacker convinces the user to start a ChromeOS Capture Mode screen recording (capturing screen and audio).
  3. Muxer Failure: The browser launches the RecordingService, which runs as an unsandboxed utility process (kNoSandbox). As recording progresses, audio frames are queued. When a video key-frame triggers the creation of a new cluster, Segment::MakeNewCluster calls WriteFramesLessThan to flush the queued audio frames.
  4. Dangling Pointers: Because the disk is full, FileWebmMuxerDelegate::DoWrite returns -1, causing cluster->AddFrame to fail. The Frame objects are deleted, but left in the frames_ array.
  5. UAF Read: WriteFramesLessThan returns control to MakeNewCluster, which immediately executes a Use-After-Free read by accessing the timestamp of the dangling pointer (frames_[0]->timestamp()).
  6. Double-Free: MakeNewCluster returns to DoNewClusterProcessing, which then calls WriteFramesAll(). This function iterates over the corrupted frames_ array and again calls cluster->AddFrame on the dangling pointers. The write fails again (disk still full), and the error handler in WriteFramesAll executes delete frame; on the already-freed pointer.
  7. Arbitrary Free / RCE: The Frame destructor executes delete[] frame_; and delete[] additional_;. If the attacker can groom the heap to reallocate the Frame object between the two frees, they can control these raw pointers to execute an arbitrary free primitive, leading to potential RCE in the unsandboxed RecordingService.

Suggested Fix

Ensure shift_left is incremented when a frame write fails so the array is correctly compacted:

C++
if (!cluster->AddFrame(frame_prev)) {
  delete frame_prev;
  ++shift_left; // FIX: Increment counter to ensure compaction
  continue;
}

The same fix should be applied to the !AddCuePoint(...) failure case immediately below it.

Evaluated with Chrome root at commit: 7353d249d9cacf9c7218e1d7b8a39cf39c72d646


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.

How it worked

Root cause

Likely, the `shift_left` counter is not incremented when a frame write fails, so the array compaction logic is skipped and the queue retains dangling pointers.

Impact

An attacker could potentially achieve arbitrary free and remote code execution in the unsandboxed RecordingService, though no working proof-of-concept has been executed.

What the attacker needed

ChromeOS device; Attacker can fill disk via webpage; Victim starts screen recording

The fix

The fix should increment `shift_left` when a frame write fails so the array is correctly compacted, and apply the same fix to the `!AddCuePoint(...)` failure case.

How it was found

  1. An attacker on a malicious webpage fills the ChromeOS device's disk using the Cache API.
  2. The attacker convinces the user to start a screen recording in Capture Mode.
  3. The RecordingService queues audio frames; when a video key-frame triggers a new cluster, WriteFramesLessThan is called to flush them.
  4. Because the disk is full, cluster->AddFrame fails, the Frame objects are deleted, but they remain in the frames_ array.
  5. MakeNewCluster performs a use-after-free read by accessing the timestamp of the dangling pointer.
  6. WriteFramesAll later calls delete on the already-freed pointer, causing a double-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.

When a program frees memory but keeps a pointer to it, that's a dangling pointer; using it later is a use-after-free. Here, a bug in a video recording library means that if the disk is full, the program deletes some frame data but forgets to remove it from a list, so it later reads and frees the same memory again. Because the recording service runs without Chrome's usual sandbox protection, this 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.