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

Heap buffer overflow in Media (CVE-2026-10946)

A heap out-of-bounds read and write exists in the libvpx VP9 encoder when frame dimensions change, because an internal buffer is not resized when the macroblock grid expands. An attacker can trigger this via Cast Mirroring by manipulating the capture aspect ratio to bypass Chromium's area-based frame size checks, potentially leading to remote code execution in the sandboxed Mirroring utility process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 44 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 potential heap out-of-bounds read and write exists in the libvpx VP9 encoder when frame dimensions change. This occurs because an internal state buffer is not resized when the macroblock grid expands, but is subsequently accessed using offsets from the new dimensions. An attacker can trigger this via Cast Mirroring by manipulating the capture aspect ratio to bypass Chromium's area-based frame size checks.

Affected files:

  • third_party/libvpx/source/libvpx/vp9/encoder/vp9_speed_features.c
  • third_party/libvpx/source/libvpx/vp9/encoder/vp9_encoder.c
  • third_party/libvpx/source/libvpx/vp9/encoder/vp9_encodeframe.c
  • media/cast/encoding/vpx_encoder.cc

Estimated timestamp from git blame: 2024-12-23

Description

A potential heap out-of-bounds (OOB) memory corruption vulnerability exists in the libvpx VP9 encoder. The issue is reachable from web content via Chromium's Cast Mirroring feature, leading to potential Remote Code Execution (RCE) in the sandboxed Mirroring utility process.

The vulnerability is the result of two interacting flaws:

  1. Chromium Cast Guard Bypass: In media/cast/encoding/vpx_encoder.cc, the VpxEncoder::ConfigureForNewFrameSize function attempts to reuse an existing encoder instance if the new frame size is smaller or equal in total area to the current frame size: if (frame_size.GetArea() <= gfx::Size(config_.g_w, config_.g_h).GetArea()) This allows an attacker to radically increase the frame's width (e.g., from 640x480 to 3840x80) without triggering an encoder restart, as long as the total pixel area does not increase.

  2. libvpx Reallocation Flaw: When libvpx receives a configuration update (vp9_change_config in vp9_encoder.c) where the new macroblock grid size is larger than the allocated grid (cm->mi_alloc_size < new_mi_size), it partially reallocates context buffers. However, it fails to free cpi->content_state_sb_fd. At the end of this reallocation block, cpi->external_resize is erroneously reset to 0.

On the next frame, vp9_set_speed_features_framesize_dependent sees external_resize == 0 and re-enables use_source_sad = 1. It checks if cpi->content_state_sb_fd == NULL to determine if allocation is needed. Because the buffer was never freed, the pointer is non-null, and reallocation is skipped. The buffer remains sized for the original dimensions (e.g., 640x480).

During frame encoding, avg_source_sad (in vp9_encodeframe.c) processes 64x64 superblocks and calculates a buffer index (sb_offset) based on the new wider dimensions. This results in an index that exceeds the bounds of the stale content_state_sb_fd buffer, triggering a precise 1-byte increment (cpi->content_state_sb_fd[sb_offset]++) or zeroing operation out of bounds. A corresponding OOB read occurs in choose_partitioning.

Suggested Attacker Steps

(Note: These are potential steps based on code analysis; our tooling has not executed a working proof of concept.)

  1. An attacker hosts a malicious web page that prompts the user to initiate a Tab or Desktop Cast Mirroring session.
  2. The attacker initializes a video stream with a standard resolution (e.g., 640x480). Chromium allocates an 88-byte content_state_sb_fd buffer in libvpx.
  3. The attacker uses JavaScript (window.resizeTo(3840, 80)) or similar video-element manipulation to rapidly change the aspect ratio.
  4. The Cast pipeline detects the size change. Since the area of 3840x80 is equal to 640x480, Chromium bypasses the encoder restart and forwards the new configuration to libvpx.
  5. libvpx expands its macroblock grid but leaves content_state_sb_fd at its original 88-byte size.
  6. By feeding carefully crafted video frames, the attacker controls the Sum of Absolute Differences (tmp_sad) calculations during encoding. This dictates exactly which out-of-bounds bytes are incremented or zeroed by the encoder.
  7. The attacker repeatedly exploits this primitive to manipulate adjacent heap metadata or object pointers (e.g., vtables), eventually achieving arbitrary code execution in the Mirroring utility process.

Suggested Fix

This vulnerability requires fixes in both Chromium and libvpx for defense-in-depth.

libvpx: In third_party/libvpx/source/libvpx/vp9/encoder/vp9_encoder.c, within the if (cm->mi_alloc_size < new_mi_size) reallocation block (around line 2159), explicitly free the content_state_sb_fd buffer so it can be safely reallocated during the speed features check:

C
if (cm->mi_alloc_size < new_mi_size) {
    vp9_free_context_buffers(cm);
    // ...
    vpx_free(cpi->content_state_sb_fd);
    cpi->content_state_sb_fd = NULL;
    // ...
}

Chromium: In media/cast/encoding/vpx_encoder.cc, update VpxEncoder::ConfigureForNewFrameSize to ensure that neither dimension grows larger than the currently allocated configuration. Using GetArea() alone is unsafe when underlying memory structures rely on grid width/height independently.

C++
if (frame_size.width() <= config_.g_w && 
    frame_size.height() <= config_.g_h &&
    frame_size.GetArea() <= gfx::Size(config_.g_w, config_.g_h).GetArea()) {
    // Continue using existing encoder
}

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 libvpx encoder fails to free and reallocate the content_state_sb_fd buffer when the macroblock grid size increases, and Chromium's Cast encoder reuses an existing encoder instance based only on total pixel area, allowing a dimension change that triggers the stale buffer access.

Impact

The attacker could potentially achieve remote code execution in the sandboxed Mirroring utility process, though the report notes that no working proof of concept has been executed.

What the attacker needed

Victim initiates Cast Mirroring; attacker hosts malicious web page; attacker can manipulate video dimensions

The fix

The vulnerability should be fixed by explicitly freeing the content_state_sb_fd buffer in libvpx when the macroblock grid is reallocated, and by updating Chromium's Cast encoder to check that neither dimension grows larger than the currently allocated configuration.

How it was found

  1. An attacker hosts a malicious web page that prompts the user to initiate a Tab or Desktop Cast Mirroring session.
  2. The attacker initializes a video stream with a standard resolution (e.g., 640x480). Chromium allocates an 88-byte content_state_sb_fd buffer in libvpx.
  3. The attacker uses JavaScript (window.resizeTo(3840, 80)) or similar video-element manipulation to rapidly change the aspect ratio.
  4. The Cast pipeline detects the size change. Since the area of 3840x80 is equal to 640x480, Chromium bypasses the encoder restart and forwards the new configuration to libvpx.
  5. libvpx expands its macroblock grid but leaves content_state_sb_fd at its original 88-byte size.
  6. By feeding carefully crafted video frames, the attacker controls the Sum of Absolute Differences (tmp_sad) calculations during encoding. This dictates exactly which out-of-bounds bytes are incremented or zeroed by the encoder.

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 corruption bug in a video encoding library used by Chromium. When the video size changes in a certain way, a buffer that should be resized is left too small, and later the program writes past its end. An attacker could use this to run malicious code on the victim's computer, though the report notes it is a potential issue and no working exploit was demonstrated.

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.