Race in WebCodecs (CVE-2026-5890)
A race condition in Chrome's WebCodecs VideoEncoder allows reconfiguring dimensions while an encode is in progress, causing use-after-free and out-of-bounds reads in the VP9 and AV1 encoders. An attacker could trigger a crash or potentially read adjacent heap memory from any webpage without user interaction.
Originally disclosed on Chrome VRP
- Fix shipped in 43 days
Report description
Out-of-bounds heap read in VP9 encoder via WebCodecs VideoEncoder dimension reconfiguration
Bug location
Where do you want to report your vulnerability?
Chrome VRP – Report security issues affecting the Chrome browser. See program rules
Which URL (or repository) have you found the vulnerability in?
https://chromium.googlesource.com/chromium/src/+/main/third_party/libvpx/source/libvpx/vp9/encoder/
The problem
Please describe the technical details of the vulnerability
Calling configure() with changing dimensions on a WebCodecs VideoEncoder (VP9 or AV1), followed by encode() without waiting for the previous encode to complete, causes memory corruption in both the VP9 and AV1 encode pipelines. The crash is stochastic and typically fires within 30 to 80 rounds of rapid dimension changes.
Tested on Windows 10 x64, reproduced on both ASAN Chrome 147.0.7696.0 and latest stable Chrome 145.0.7632.110.
The core issue is in Chrome's OffloadingVideoEncoder, which dispatches Encode and ChangeOptions (the internal path for JS configure()) onto the encoder's task queue without properly serializing them. When configure() arrives while codec-internal row-MT worker threads are still mid-encode, the reconfigure tears down internal state (reference frame buffers, context structures) while those threads still hold live pointers into the old allocations.
The ASAN task traces for both crashes confirm this interleaving:
OffloadingVideoEncoder::Encode
OffloadingVideoEncoder::WrapCallback
OffloadingVideoEncoder::ChangeOptions <- reconfigure while encode in flight
OffloadingVideoEncoder::WrapCallback
When the encoder gets reconfigured to different dimensions, internal reference frame buffers from earlier configurations remain in the encoder's buffer pool while the encoder begins operating at the new dimensions. Motion estimation then computes offsets into these undersized reference buffers using the new dimensions, reading past the end of the allocation.
The row-MT worker thread (enc_row_mt_worker_hook) continues executing vp9_pick_inter_mode, which calls into SAD (sum of absolute differences) functions against a reference frame buffer that's already been freed and reallocated for the new dimensions. The SAD function reads a 64x64 block at a stride (rdx=0x360, 864 bytes) calibrated to the old frame width, walking off the end of the new allocation. ASAN catches this as an access-violation READ at a heap address, confirming genuine use-after-free with heap-relative addressing.
By toying with the timing and dimension configurations, we've been able to hit multiple crash sites in the VP9 path. The primary crash is in vpx_sad64x64_avx2 (sad_avx2.c:113), but we've also triggered vpx_sad16x16_sse2 with smaller dimension transitions. The crash site depends on which block partition size the encoder selects for the current superblock, which varies with the dimension mismatch and content. By carefully selecting the dimensions we have some control over the length of the read (64x64, 32x32, 16x16, 8x, 4x), making it a controlled read.
The VP9 path requires latencyMode: 'realtime' to force threaded tile encoding (vp9_encode_tiles_row_mt), which widens the race window. Rapid dimension changes across superblock/MI allocation boundaries (e.g. 120x120 to 128x128, crossing mi_cols 15 to 16) maximize the likelihood that the internal reallocation changes buffer sizes and strides. The race is reachable from any origin via the WebCodecs VideoEncoder API with no user interaction, permissions, or flags required. Both crashes occur in the renderer process on a thread pool worker thread (T5/T6).
AV1 (libaom): The same root cause also affects the AV1 encoder, which is expected given that libaom's buffer pool design and encoder architecture originate from its fork of libvpx. The AV1 variant manifests differently: av1_encode_tiles_row_mt calls memset on a buffer pointer that the reconfigure has already nulled out, resulting in a WRITE to 0x000000000000 (rax=0 at crash). Unlike VP9 where libvpx leaves the pointer dangling, libaom's teardown zeroes it, so it surfaces as a null dereference rather than a UAF. AV1 triggers under default encoder settings without needing latencyMode: 'realtime'.
Reproducer: open the attached HTML, click VP9 or AV1, wait. It calls configure() with random dimensions (1x1 through 800x600) followed by encode() in a loop. On the systems I've tested this on the VP9 crash happens roughly after 30 seconds, the AV1 crash is close to instant.
Impact analysis
At minimum this is an controlled out-of-bounds heap read in the renderer process, triggerable from any webpage via the WebCodecs API without user interaction. On most heap layouts the read hits unmapped pages and crashes the tab. When adjacent pages happen to be committed, the read crosses into neighboring allocations, which could theoretically be an information disclosure or ASLR bypass vector, with the right heap massaging and finding an read length that ends up in between the padding of the frame and end of mapped heap pages, though we haven't been able to demonstrate that from JavaScript.
Since the underlying issue is the encoder operating in an invalid state (mismatched dimensions between active config and retained reference buffers), it's hard to fully determine the impact. The bug surfaces as an OOB read in VP9 motion estimation, but the same invalid state is present throughout the encode pipeline. We've confirmed multiple crash sites in the VP9 path (vpx_sad64x64_avx2, vpx_sad16x16_sse2) depending on timing and dimension configuration, which supports this: the stale reference buffers are reachable from various points in the encoder, and which one faults first depends on the specific encode parameters. The AV1 variant crashing as a write to a low constant address rather than a heap read further supports the idea that the consequences depend on which code path encounters the stale buffers first. Other code paths in the encoder that touch reference frames (reconstruction, loop filtering, etc.) could potentially be reached with different exploitation strategies.
The cause
What version of Chrome have you found the security issue in?
[147.0.7696.0] + [ASAN], [145.0.7632.110] + [stable]
Is the security issue related to a crash?
Yes, it is related to a crash.
Choose the type of vulnerability
Memory Corruption (in a sandboxed process)
How would you like to be publicly acknowledged for your report?
Casper Woudenberg
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 encoder's task queue does not properly serialize encode and reconfigure operations, so a reconfigure can tear down internal state while worker threads still hold pointers into the old allocations.
Impact
At minimum this is a controlled out-of-bounds heap read in the renderer process, triggerable from any webpage without user interaction; on most heap layouts it crashes the tab, and while information disclosure or ASLR bypass is theoretically possible, the reporter has not demonstrated that from JavaScript.
What the attacker needed
Victim visits a malicious webpage; no user interaction required
How it was found
- Open the attached HTML page.
- Click the VP9 or AV1 button.
- The page calls configure() with random dimensions followed by encode() in a loop.
- Wait for the crash, which occurs after roughly 30 seconds for VP9 and almost instantly for AV1.
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 you change the size of a video while it is still being encoded, the encoder can keep using old memory that has already been freed. This can make the browser read memory it should not, which may crash the tab or leak data. Any website can do this without asking the user for permission.
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.