Out of bounds read in WebRTC (CVE-2026-12461)
A size-tracking variable in the WebRTC window capture code is not updated when a resize step fails partway through, leaving a smaller staging texture paired with a stale larger size. A later frame at the original size then copies more data than the texture holds, causing an out-of-bounds read in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 19 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential state desynchronization issue in WgcCaptureSession::ProcessFrame can lead to an out-of-bounds read of mapped Direct3D 11 staging memory. If a resize occurs and recreating the frame pool fails, the staging texture is left resized to a smaller dimension while the tracking state retains the old larger size. Subsequent frame processing at the original size bypasses reallocation and reads past the boundaries of the mapped texture.
Affected files:
third_party/webrtc/modules/desktop_capture/win/wgc_capture_session.cc
Estimated timestamp from git blame: 2022-03-09
Summary of Root Cause
In WgcCaptureSession::ProcessFrame (located in third_party/webrtc/modules/desktop_capture/win/wgc_capture_session.cc), the capture session's size-tracking member size_ is synchronized non-atomically when a captured window size changes.
When a resize to a smaller size is detected in ProcessFrame:
CreateMappedTextureis invoked (line 592), which successfully reallocatesmapped_texture_to the new smaller size (e.g., $A imes A$).frame_pool_->Recreateis then called (line 598). If this allocation fails (for example, due to transient GPU memory pressure), the function returns early on line 602.- Because of the early return, the session's overall size-tracking variable
size_is not updated to the new size and remains at the old larger size (e.g., $S imes S$).
If the captured window is then resized back to the larger size $S$:
SizeHasChanged(S, S)evaluates tofalsebecause both the incoming frame size and the stale tracking membersize_are $S$. The resize block is completely bypassed.- The copy dimensions
image_heightandimage_widthare computed asmin(size_, new_size) = S(lines 615-616). - The code maps
mapped_texture_(which is still sized $A imes A$) and enters a loop copying $S$ rows of $S imes 4$ bytes usingmemcpy(lines 719-730). - In production builds,
RTC_DCHECK_GEchecks are disabled. This results in an out-of-bounds memory read from the mapped staging texture buffer.
Potential Steps to Trigger
Note: These are suggested/potential steps modeled from static analysis; our tooling agent does not currently have the capability to run code or compile a working proof-of-concept.
- A web page requests screen or window capture using
getDisplayMedia, and the user selects a window of size $S$ (e.g., $1000 \times 1000$). - The attacker triggers transient GPU memory pressure (e.g., by spawning multiple heavy WebGL/WebGPU contexts or massive resource allocations) to prepare for an allocation failure.
- The captured window is resized to a smaller dimension $A$ (e.g., $500 \times 500$).
ProcessFrameenters the resize block, reallocatesmapped_texture_to $A$, but fails to recreate the frame pool due to GPU memory pressure, returning early.- The captured window is resized back to the larger size $S$.
- On the next frame capture, the code bypasses resizing because
size_was never updated from $S$. It attempts to copy a larger frame region out of the smaller staging texture, resulting in an out-of-bounds read of adjacent mapped memory in the browser process.
Suggested Fix
Ensure that if any part of the resizing sequence fails, the session either rolls back the staging texture, marks the session as permanently failed, or updates size_ defensively. For instance, in wgc_capture_session.cc:
hr = frame_pool_->Recreate(direct3d_device_.Get(), kPixelFormat,
num_buffers(), new_size);
if (FAILED(hr)) {
RecordGetFrameResult(GetFrameResult::kRecreateFramePoolFailed);
// Ensure the session size is synchronized or invalidated on failure
size_ = new_size;
return hr;
}
Evaluated with Chrome root at commit: 5133b93d189b383c37805b1cf3a9d2dbfe8d7379
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
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.
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 size-tracking member is only updated after the frame pool recreation succeeds, so an early return on failure leaves it stale while the mapped texture has already been shrunk.
Impact
An out-of-bounds read of adjacent mapped memory in the browser process could occur, though the report is based on static analysis and no working proof-of-concept was produced.
What the attacker needed
User grants screen capture; attacker can cause GPU memory pressure; window resized smaller then larger
The fix
The resizing sequence should roll back the staging texture, mark the session as failed, or update the size defensively when any step fails.
How it was found
- A page requests screen or window capture and the user picks a window of the larger size.
- The attacker creates GPU memory pressure to make an allocation fail.
- The captured window is resized to a smaller size.
- The texture is reallocated to the smaller size but the frame pool recreation fails and the function returns early.
- The window is resized back to the larger size.
- The next frame bypasses resizing and copies a larger region from the smaller texture.
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 window being screen-shared changes size, the code resizes a buffer that holds the picture. If one part of that resize fails, the code forgets to record the new, smaller size, so it still believes the buffer is big. The next frame then copies too much data out of the small buffer, reading memory it should not touch.
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.