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

Out of bounds read in WebRTC (CVE-2026-9996)

A heap out-of-bounds read in the WebRTC desktop capture code on macOS fails to check the height of a cursor image before copying its pixels. An attacker could craft a CSS cursor whose scaled height exceeds the real bitmap height, causing browser-process heap memory to be read and mixed into an outgoing screen-share video stream.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 14 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 heap out-of-bounds read vulnerability in the WebRTC desktop capture module allows an attacker to leak browser-process memory into a video capture stream on macOS. The flaw is caused by insufficient validation of a cursor's image height before performing a pixel copy operation in the unsandboxed browser process. This can be potentially triggered by crafting a custom CSS cursor with specific dimensions and scale factors.

Affected files:

  • third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm
  • third_party/webrtc/modules/desktop_capture/desktop_frame.cc

Estimated timestamp from git blame: 2017-06-02

Summary

A potential heap out-of-bounds (OOB) read exists in the Chromium browser process on macOS within the WebRTC desktop capture module. The function MouseCursorMonitorMac::CaptureImage fails to validate that the height of a retrieved CGImageRef matches the expected capture dimensions before copying its pixel data. This can lead to the exfiltration of sensitive browser-process heap memory into a video capture stream (e.g., during a screen sharing session).

Root Cause Analysis

In third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm, the function CaptureImage calculates the target pixel size for the cursor in the capture frame based on its logical (DIP) size and the display scale:

OBJC
// lines 140-141
DesktopSize size(round(nssize.width * scale),
                 round(nssize.height * scale));  // Expected pixel size

The code then obtains a CGImageRef representing the cursor. It contains logic to rescale the image if its width does not match the expected width, but it neglects to check the height:

OBJC
// lines 157-163
if (CGImageGetWidth(cg_image) != static_cast<size_t>(size.width())) {
  scaled_cg_image = CreateScaledCGImage(cg_image, size.width(), size.height());
  if (scaled_cg_image != nil) {
    cg_image = scaled_cg_image;
  }
}

Furthermore, a subsequent validation block (lines 164-169) checks for bits per pixel, width, and bits per component, but completely omits a check for the image height.

Finally, the pixel data is copied into a DesktopFrame using image->CopyPixelsFrom:

OBJC
// line 187
image->CopyPixelsFrom(src_data, src_stride, DesktopRect::MakeSize(size));

CopyPixelsFrom (defined in third_party/webrtc/modules/desktop_capture/desktop_frame.cc) uses libyuv::CopyPlane to copy size.height() rows from the source buffer. If the actual CGImage height is smaller than size.height(), libyuv will read past the end of the heap-allocated buffer containing the cursor pixels.

Potential Attack Vector

An attacker could potentially trigger this by providing a custom CSS cursor with specifically crafted dimensions and scale factors. For example, if a custom cursor image is 121 pixels high and assigned a scale factor of 0.95 by the renderer, the browser process will calculate a logical (DIP) height of floor(121 / 0.95) = 127. When capturing on a 1.0x display, size.height() becomes 127, while the actual bitmap in the CGImage remains 121 pixels high, leading to a 6-row OOB read.

This vulnerability occurs in the browser process where the desktop capture logic resides. The leaked memory from the browser's heap is composited into the outgoing video stream, which can be observed by a remote peer or a compromised renderer process.

Suggested Fix

Ensure that the image height is validated and, if necessary, rescaled to match the target dimensions. The rescaling check should be updated:

OBJC
if (CGImageGetWidth(cg_image) != static_cast<size_t>(size.width()) || 
    CGImageGetHeight(cg_image) != static_cast<size_t>(size.height())) {
  // Rescale logic...
}

Additionally, include a height check in the validation block at line 164:

OBJC
if (CGImageGetHeight(cg_image) != static_cast<size_t>(size.height())) {
  return;
}

Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e


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.

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

The capture code validates the cursor image's width and pixel format but never checks its height against the expected capture size before copying rows of pixels.

Impact

Browser-process heap memory could be leaked into a video capture stream observable by a remote peer or a compromised renderer, though the report only describes this as potential and does not demonstrate it.

What the attacker needed

MacOS; screen sharing or desktop capture active; attacker-supplied CSS cursor

The fix

The height should be validated and the image rescaled when it does not match the target dimensions, with a height check added to the validation block.

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 program copies an image, it must know how many rows of pixels to read. Here the code worked out a target height from the cursor's size and display scale but never checked that the actual image was that tall, so it read past the end of the image data. That extra memory, which belongs to the browser, could then appear in a video stream the attacker can watch.

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.