Heap buffer overflow in WebRTC (CVE-2026-12466)
A heap out-of-bounds write or underflow can occur in the Windows browser process during rotated WebRTC screen capture when a display resolution change causes a mismatch between cached and live texture sizes. An attacker could potentially write screen-pixel data outside the allocated heap buffer via libyuv::ARGBRotate.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 12 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 release-build bounds-enforcement gap in RotateDesktopFrame can allow a heap out-of-bounds write or underflow in the browser process on Windows. When a display-mode or resolution change occurs concurrent with rotated screen capture via the DXGI path, a size divergence between cached and live textures can cause coordinate calculations to bypass debug-only checks. This results in writing screen-pixel bytes to out-of-bounds heap memory via libyuv::ARGBRotate.
Affected files:
third_party/webrtc/modules/desktop_capture/desktop_frame_rotation.ccthird_party/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.ccthird_party/webrtc/modules/desktop_capture/win/dxgi_texture.cc
Estimated timestamp from git blame: 2016-11-30
Description
There is a potential heap out-of-bounds write (or heap underflow write) in the Windows browser process during WebRTC screen capture. The vulnerability stems from an asymmetry in how bounds are enforced in the capture pipeline. While the standard non-rotated copy path at third_party/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc:247 utilizes DesktopFrame::CopyPixelsFrom(), which performs release-active bounds validation using RTC_CHECK (fatal in release), the rotated copy path relies on RotateDesktopFrame() which uses debug-only RTC_DCHECK statements.
In release builds (NDEBUG), these RTC_DCHECK statements are compiled out. If a mismatch occurs between the cached capture dimensions and the live frame texture dimensions, coordinate calculations can produce out-of-bounds offsets which are then passed directly to libyuv::ARGBRotate() as raw pointers with no runtime safety boundaries.
Root Cause Analysis
-
Debug-Only Bounds Check: At
third_party/webrtc/modules/desktop_capture/desktop_frame_rotation.cc:102,108:C++ RTC_DCHECK(DesktopRect::MakeSize(source.size()).ContainsRect(source_rect)); ... RTC_DCHECK(DesktopRect::MakeSize(target->size()).ContainsRect(target_rect));In production builds, these checks are omitted.
-
Stale vs. Live Size Divergence:
DxgiOutputDuplicatorcaches the unrotated display size (unrotated_size_) at initialization time based onDXGI_OUTPUT_DESC.DesktopCoordinates(atdxgi_output_duplicator.cc:79,147). However,DxgiTexture::CopyFrom()dynamically reads the live texture dimensions per-frame:C++ D3D11_TEXTURE2D_DESC desc = {0}; texture->GetDesc(&desc); desktop_size_.set(desc.Width, desc.Height);(at
third_party/webrtc/modules/desktop_capture/win/dxgi_texture.cc:61-63). -
Integer Underflow and Pointer Arithmetic: During a resolution transition, if a smaller frame is captured before the duplication object is invalidated,
DxgiOutputDuplicator::Duplicate()computessource_rectbased on the old, larger cached size but executesRotateDesktopFrame()with the smaller live size. Under CLOCK_WISE_90 rotation,RotateAndOffsetRectcomputestarget_rect.left = size.height() - rect.bottom() + offset.x(). When the live heightsize.height()is smaller thanrect.bottom(), this subtraction underflows to a negative value. Pointer arithmetic inGetFrameDataAtPos()then calculates a pointer pointing prior to the heap-allocated destination buffer (atdesktop_frame.cc:140), resulting in a heap underflow write vialibyuv::ARGBRotate.
Potential Steps to Trigger
Note: These steps are theoretical/potential as our analysis toolchain does not have the capability to execute code.
- Web content requests screen capture via
getDisplayMedia(), and the user permits capture of a monitor rotated by 90 degrees. - Screen capture runs in the browser process via
ScreenCapturerWinDirectx. - Concurrently, a display-mode or resolution change is triggered on the system.
- If
IDXGIOutputDuplication::AcquireNextFrame()returnsS_OKwith a resized frame texture before signalingDXGI_ERROR_ACCESS_LOST,DxgiOutputDuplicatorprocesses the frame with divergent live vs. cached dimensions. - The rotation path calculates a negative target offset, leading
libyuv::ARGBRotateto perform a heap out-of-bounds write.
Suggested Fix
-
Harden Bounds Check: Upgrade the
RTC_DCHECKstatements insideRotateDesktopFrame()inthird_party/webrtc/modules/desktop_capture/desktop_frame_rotation.ccto release-activeRTC_CHECKassertions, matching the validation behavior inCopyPixelsFrom():C++ RTC_CHECK(DesktopRect::MakeSize(source.size()).ContainsRect(source_rect)); RTC_CHECK(DesktopRect::MakeSize(target->size()).ContainsRect(target_rect)); -
Validate Input Dimensions: Inside
DxgiOutputDuplicator::Duplicate(), explicitly verify that the live source frame size matchesunrotated_size_prior to entering the rotation loop. If a mismatch is detected, abort capture or re-initialize the pipeline.
Evaluated with Chrome root at commit: d8b226a3be7c9c1ac9240c09e14698866c82e4ac
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 rotated copy path uses debug-only bounds checks that are removed in release builds, so a mismatch between cached and live texture dimensions leads to negative offsets and out-of-bounds pointer arithmetic.
Impact
A heap out-of-bounds write or underflow in the browser process could potentially lead to memory corruption, though the report notes the steps are theoretical and not executed.
What the attacker needed
User permits screen capture; monitor rotated 90 degrees; resolution change during capture; Windows browser process
The fix
The fix should upgrade the debug-only checks in RotateDesktopFrame to release-active assertions and validate that live frame dimensions match the cached size before rotation.
How it was found
- Web content requests screen capture via getDisplayMedia() and the user permits capture of a monitor rotated by 90 degrees.
- Screen capture runs in the browser process via ScreenCapturerWinDirectx.
- Concurrently, a display-mode or resolution change is triggered on the system.
- If AcquireNextFrame() returns S_OK with a resized frame texture before signalling DXGI_ERROR_ACCESS_LOST, the duplicator processes the frame with divergent live vs. cached dimensions.
- The rotation path calculates a negative target offset, leading libyuv::ARGBRotate to perform a heap out-of-bounds write.
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 share your screen, the browser copies pixels from your display into a memory buffer. If the screen resolution changes at the same moment, the code can calculate the wrong position and write pixels past the end of that buffer, corrupting memory. This could crash the browser or, in theory, 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.