Insufficient validation of untrusted input in Media (CVE-2026-5884)
The VideoFrame Mojo deserialization code accepted a negative stride value from an untrusted renderer without validation, causing it to be stored as a huge unsigned integer. Downstream video encoders then truncated this to a negative integer and used it for pointer arithmetic, leading to out-of-bounds heap reads or a crash.
Originally disclosed on Chrome VRP
- Fix shipped in 52 days
Steps to reproduce the problem
== Environment == Tested on: Chromium trunk (Linux x64), ASAN build Affected platforms: All (Linux, macOS, Windows, ChromeOS, Android) The vulnerable code is platform-independent.
== Build Configuration (ASAN) == is_asan = true is_debug = false is_component_build = false target_cpu = "x64"
== Reproduction via ASAN Unit Test ==
The vulnerability is in the Mojo deserialization of SharedMemory-backed VideoFrames. A unit test that exercises the real deserialization code path with a crafted negative stride value triggers heap-buffer-overflow under ASAN.
Steps:
-
Build media_unittests with ASAN: autoninja -C out/ASAN media_unittests
-
Run the NegativeStride test: ASAN_OPTIONS="detect_odr_violation=0:halt_on_error=1"
out/ASAN/media_unittests
--gtest_filter="NegativeStride"
--single-process-tests -
Observe ASAN heap-buffer-overflow report.
== Reproduction via MojoJS PoC (requires --enable-blink-features=MojoJS) ==
-
Apply the attached poc_patch.diff to add a stride probe after deserialization (needed because headless Linux has no GPU encoder backend; the probe simulates the same memory access pattern as VpxVideoEncoder).
-
Serve poc_negative_stride.html on a local HTTP server: python3 -m http.server 8787
-
Run Chrome with ASAN: ./out/ASAN/chrome
--enable-blink-features=MojoJS,MojoJSTest
--no-sandbox --disable-gpu-sandbox
--headless=new --ozone-platform=headless --disable-gpu
--use-fake-device-for-media-stream
--enable-features=UseOutOfProcessVideoEncoding
--enable-logging=stderr
"http://127.0.0.1:8787/poc_negative_stride.html" -
Observe SEGV_MAPERR crash at the deserialization site.
== What the PoC does == The PoC uses MojoJS to call VideoEncodeAccelerator.Encode() with a VideoFrame whose strides[] are set to -1 (0xFFFFFFFF as int32_t). The frame is sent via Mojo IPC and deserialized in the browser/GPU process. The negative stride passes all existing validation checks and produces a VideoFrame with stride = SIZE_MAX, which causes backward out-of-bounds reads when any consumer (VPX encoder, AV1 encoder, libyuv, etc.) iterates over pixel rows.
Problem Description
== Summary == media/mojo/mojom/video_frame_mojom_traits.cc:301 assigns an int32_t stride value from Mojo IPC directly to a size_t field without checking for negative values. A compromised renderer can send stride = -1, which becomes SIZE_MAX (0xFFFFFFFFFFFFFFFF) after implicit sign extension. Downstream consumers (video encoders, libyuv) truncate this to int(-1) and use it for pointer arithmetic, causing backward out-of-bounds heap reads.
== Root Cause == In StructTraits<VideoFrameDataView>::Read(), SharedMemory path:
planes[i].stride = strides[i]; // int32_t → size_t, no negative check
The existing FitsInContiguousBufferOfSize() check does NOT validate stride. It only checks (plane.offset + plane.size <= data_size). The plane.size is computed as: Rows(i, format, height) * strides[i] When strides[i] = -1, this multiplies size_t * int32_t(-1), causing integer overflow that wraps to a small value. std::min() then clamps it further. So plane.size and plane.offset are both reasonable → the check passes. But planes[i].stride = SIZE_MAX is never validated.
Notably, the DMA-buf deserialization path in the SAME FILE (line ~196) correctly uses base::IsValueInRangeForNumericType<size_t>(data.stride()) to reject negative values. The SharedMemory path is missing this check — this is clearly an oversight.
== Affected Consumers == Any code that calls VideoFrame::stride() and uses it for pixel row traversal:
- VpxVideoEncoder (vpx_video_encoder.cc:306-308): stride[VPX_PLANE_Y] = frame.stride(kY) → vpx_image_t::stride is int[4], SIZE_MAX truncates to -1 → libvpx OOB
- Av1VideoEncoder (av1_video_encoder.cc): same pattern with aom_image_t
- OpenH264VideoEncoder: same pattern
- libyuv color conversion: stride passed as int parameter
- WebMediaPlayerMSCompositor: stride used for pixel copy
== Security Impact ==
- Type: Out-of-bounds read (heap-buffer-overflow / heap underflow)
- Attack surface: Compromised renderer → browser/GPU process via Mojo IPC
- Threat model: Standard Chrome "compromised renderer" model. A renderer exploit (e.g., V8 bug) can craft arbitrary Mojo messages including negative strides.
- Impact: Cross-process information disclosure (reading heap data before the VideoFrame buffer) or process crash (SEGV on unmapped page).
- No MojoJS required for real exploitation — MojoJS is used only for PoC convenience.
== ASAN Crash == heap-buffer-overflow on address 0x7dc7994ef1ff READ of size 1 at 0x7dc7994ef1ff thread T0 0x7dc7994ef1ff is located 1 bytes before 19072-byte region [0x7dc7994ef200,0x7dc7994f3c80)
== Suggested Fix == Add a negative stride check before the assignment: if (strides[i] < 0) { DLOG(ERROR) << "Negative stride at plane " << i; return false; } planes[i].stride = static_cast<size_t>(strides[i]);
This matches the existing DMA-buf path validation pattern.
Additional Comments
== Environment == Chromium commit: b3acbdcb7bbe7eb076ed9509d3c5f2e10587a5b7 (2026-02-12, trunk/main branch) Build configs: Linux x64, both Default (non-ASAN) and ASAN builds (see args.gn details in attached bug_report.md §8)
== Why a PoC patch is needed ==
The PoC patch (poc_patch.diff) adds a ~30-line read-only probe to video_frame_mojom_traits.cc, immediately after the deserialized VideoFrame is created. This patch is needed because:
-
Our test server is headless Linux with no GPU. The natural consumer of the poisoned VideoFrame is VpxVideoEncoder (or AV1/OpenH264/VideoToolbox encoders), but VideoEncodeAccelerator requires a hardware backend (VAAPI/V4L2/VideoToolbox) to initialize. On our server, VEA.Initialize() fails → Encode() is never called → the poisoned frame is never consumed.
-
The vulnerability itself (int32_t → size_t assignment at line 301) is fully exercised WITHOUT the patch. The deserialization succeeds, FitsInContiguousBufferOfSize() is bypassed (integer overflow), and the VideoFrame is created with stride = SIZE_MAX. The patch merely performs the same memory access that the encoder would perform, to trigger ASAN detection in our GPU-less environment.
-
On macOS or any machine with a GPU, the patch is unnecessary — the real VPX/AV1/VideoToolbox encoder will consume the frame and crash naturally.
== What the patch simulates and why it's a valid reproduction ==
The patch mirrors the exact code path in vpx_video_encoder.cc:
Patch code VpxVideoEncoder real code ────────────────────────────────── ────────────────────────────────── y_plane = frame->visible_data(kY) planes[Y] = frame.visible_data(kY) (line 301) y_stride = frame->stride(kY) stride[Y] = frame.stride(kY) (line 307) *(y_plane + y_stride) libvpx: planes[Y] + row * stride[Y] (vpx_codec_encode)
The type conversion chain is identical: frame->stride(kY) returns size_t = SIZE_MAX → assigned to int variable → truncated to -1 → pointer arithmetic: y_plane + (-1) → backward OOB read
== Why the OOB access is reachable without any security checks in between ==
From the deserialization point (line 301) to the consumer access, there are NO intervening security checks on the stride value:
- Line 301: planes[i].stride = strides[i] — int32(-1) → size_t(SIZE_MAX), no check
- Line 306: FitsInContiguousBufferOfSize() — checks (offset + size ≤ buffer_size) only. The "size" is computed as Rows * strides[i], which overflows (size_t * int32_t(-1) wraps), then std::min() clamps it to a small value. The stride field itself is NEVER validated.
- Line 334: frame->BackWithOwnedSharedMemory() — stores the mapping, no stride check
- VideoFrame::stride() — a simple getter, returns planes_[i].stride directly
- VpxVideoEncoder::SetupStandardYuvPlanes() — copies stride to vpx_image_t::stride (int), no range check
- vpx_codec_encode() — uses stride for row traversal, no bounds check
The DMA-buf deserialization path in the SAME file (line ~196) correctly validates: if (!base::IsValueInRangeForNumericType<size_t>(data.stride())) return false; The SharedMemory path is missing this check — clearly an oversight.
== Attached files ==
- poc_negative_stride.html — MojoJS PoC (sends negative stride via VEA Mojo)
- poc_patch.diff — Read-only probe patch for GPU-less reproduction
- poc_patch_report.md — Detailed analysis report
- bug_report_VideoFrame_NegativeStride.md — Full technical report with crash logs
- asan_unittest_crash.log — Complete ASAN unit test output
- fix_negative_stride.diff — Suggested fix (add negative stride check)
Summary
VideoFrame Mojo deserialization accepts negative stride → OOB read in video encoders
Custom Questions
Type of crash:
Browser/GPU process crash (the VideoFrame deserialization and video encoding happen in the browser or GPU process, not the renderer/tab process). When UseOutOfProcessVideoEncoding is enabled, the crash occurs in the dedicated video encoding utility process. Otherwise it occurs in the GPU process. The renderer (tab) process is the attacker — it sends the malicious Mojo IPC message. The crash is cross-process.
Crash state:
== ASAN Crash (media_unittests --gtest_filter=NegativeStride) ==
==========================================================//
// ==1484417==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7dc7994ef1ff at pc 0x561e67f6deee bp 0x7ffd6ed28f90 sp 0x7ffd6ed28f88 READ of size 1 at 0x7dc7994ef1ff thread T0 #0 0x561e67f6deed in media::VideoFrameStructTraitsTest_NegativeStride_Test::TestBody() media/mojo/mojom/video_frame_mojom_traits_unittest.cc:496:17 #1 0x561e6399763b in testing::Test::Run() #2 0x561e6399a7fa in testing::TestInfo::Run()
0x7dc7994ef1ff is located 1 bytes before 19072-byte region [0x7dc7994ef200,0x7dc7994f3c80) allocated by thread T0 here: #0 0x561e60decc5d in operator new[](unsigned long) #1 0x561e67f6db23 in media::VideoFrameStructTraitsTest_NegativeStride_Test::TestBody()
SUMMARY: AddressSanitizer: heap-buffer-overflow media/mojo/mojom/video_frame_mojom_traits_unittest.cc:496:17 in media::VideoFrameStructTraitsTest_NegativeStride_Test::TestBody()
== Non-ASAN Crash (MojoJS PoC in headless Chrome) ==
Received signal 11 SEGV_MAPERR 7f0d51061fff #4 0x7f0d64589e07 mojo::StructTraits<>::Read() [../../media/mojo/mojom/video_frame_mojom_traits.cc:357:36] #5 VideoEncodeAcceleratorStubDispatch::AcceptWithResponder()
Crash address: 0x7f0d51061fff (1 byte before shared memory mapping region) Signal: SIGSEGV (SEGV_MAPERR) — access to unmapped page
== Key type conversion trace == stride input: int32_t(-1) = 0xFFFFFFFF after assign: size_t = 0xFFFFFFFFFFFFFFFF (SIZE_MAX = 18446744073709551615) encoder cast: (int)SIZE_MAX = -1 pointer math: y_plane + (-1) → 1 byte before buffer start → heap underflow
Reporter credit:
xmzyshypnc
Additional Data
Category: Security
Chrome Channel: Stable
Regression: N/A \
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 SharedMemory deserialization path assigned a signed 32-bit stride directly to an unsigned size_t field without a negative-value check, unlike the DMA-buf path in the same file.
Impact
A compromised renderer could cause cross-process information disclosure by reading heap data before the VideoFrame buffer, or crash the browser/GPU process; the text notes that no MojoJS is required for real exploitation.
What the attacker needed
Compromised renderer; ability to send Mojo IPC messages
The fix
The text suggests adding a negative stride check before assignment, matching the existing DMA-buf path validation; it does not state that a fix was applied.
How it was found
- Build media_unittests with ASAN.
- Run the NegativeStride test with ASAN options.
- Observe the ASAN heap-buffer-overflow report.
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 stride is the number of bytes between the start of one row of pixels and the next. The browser received a stride value of minus one from a compromised renderer and did not check that it was positive. Later code treated this as a huge number, which when converted back to a signed integer became minus one, so reading a pixel row went one byte before the start of the buffer.
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.