Heap buffer overflow in WebRTC (CVE-2026-9119)
A heap buffer overflow in WebRTC's NetEq module occurs when transitioning from Comfort Noise to normal speech on multi-channel streams, due to a logical flaw in index wrapping and unhandled CNG errors. An attacker could potentially achieve remote code execution in the renderer process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 33 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 go/chrome-ai-generated-security-bugs-faq for more information.
Overview: A potential heap buffer overflow occurs in WebRTC's NetEq module during a transition from Comfort Noise (CNG) to normal speech on multi-channel streams. A logical flaw in index wrapping combined with unhandled CNG errors leads to out-of-bounds access, potentially allowing RCE in the renderer process.
Affected files:
third_party/webrtc/modules/audio_coding/neteq/normal.ccthird_party/webrtc/modules/audio_coding/neteq/neteq_impl.ccthird_party/webrtc/modules/audio_coding/neteq/audio_vector.h
Estimated timestamp from git blame: 2022-01-24
Technical Analysis
A potential heap-buffer-overflow (read-modify-write) exists in webrtc::Normal::Process due to a failure to correctly manage buffer sizes and index wrapping when handling multi-channel audio streams during a transition from Comfort Noise (CNG) back to normal speech.
The Vulnerability
The issue is triggered when a WebRTC session alternates between multi-channel L16 audio and CNG. The steps below outline a potential path an attacker could use to reach the vulnerability:
-
Initialization: An attacker establishes a WebRTC connection negotiating a multi-channel L16 audio stream (e.g., 48 kHz, 8 channels) and CNG. When the first packet arrives,
NetEqImpl::SetSampleRateAndChannelsallocates analgorithm_buffer_containing anAudioVectorfor each channel. EachAudioVectoris initialized with a default capacity of 11 elements (int16_t). -
State Desynchronization: The attacker sends a CNG SID packet.
NetEqImpl::DoRfc3389Cngcallscomfort_noise_->Generate, which logs an error and returnskMultiChannelNotSupportedbecause CNG is only supported for mono streams. However,DoRfc3389Cngunconditionally updates thelast_mode_tokRfc3389Cngand ignores thekMultiChannelNotSupportederror. The buffer remains empty with a capacity of 11. -
Transition to Normal Speech: The attacker sends a very small multi-channel L16 packet (e.g., 10 samples per channel).
NetEqImpl::DoNormalis called. The 10 samples are pushed into thealgorithm_buffer_, and since 10 fits within the default capacity of 11, no reallocation occurs. -
Out-of-Bounds Access:
Normal::Processexecutes a cross-fade loop to transition from CNG to the new speech frame becauselast_mode_ == kRfc3389Cng:C++ // third_party/webrtc/modules/audio_coding/neteq/normal.cc for (size_t i = 0; i < win_length; i++) { win_up_Q14 += win_slope_Q14; (*output)[0][i] = (win_up_Q14 * (*output)[0][i] + ... ) >> 14; }At 48 kHz,
win_lengthis 48. The code accesses the array up toi = 47. -
Insufficient Wrapping: The
AudioVectorindexing logic uses an inlineWrapIndexmethod which performs a single subtraction instead of a modulo operation:C++ // third_party/webrtc/modules/audio_coding/neteq/audio_vector.h inline size_t WrapIndex(size_t index, size_t begin_index, size_t capacity) { size_t ix = index + begin_index; if (ix >= capacity) { ix -= capacity; } return ix; }For
i = 47andcapacity = 11,ixbecomes36, which is significantly out-of-bounds for the 11-element array. In release builds whereRTC_DCHECK_EQ(output->Channels(), 1)is compiled out, this leads to an out-of-bounds read-modify-write.
Impact
The overflow occurs in small PartitionAlloc buckets (e.g., 32-byte bucket). Due to how AudioMultiVector allocates its channels, the overflow is likely to corrupt adjacent AudioVector structures or their array_ pointers. By overwriting an AudioVector pointer, an attacker could achieve an arbitrary read/write primitive during subsequent audio processing, potentially leading to arbitrary remote code execution within the sandboxed renderer process.
(Note: These are potential exploit steps based on static analysis; our tooling agent does not yet have the ability to run code to produce a working proof of concept.)
Suggested Fix
- State Consistency: In
NetEqImpl::DoRfc3389Cng, handleComfortNoise::kMultiChannelNotSupportedproperly and prevent updatinglast_mode_tokRfc3389Cngif CNG generation fails. - Index Wrapping: Update
AudioVector::WrapIndexto use modulo (ix %= capacity) instead of a single subtraction, or enforce tighter checks if indices are never expected to exceed2 * capacity.
Evaluated with Chrome root at commit: c0eb5541aebfa4ea08806eaf6e94bcc69f87ab2f
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; 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 combination of an unchecked error when generating comfort noise for multi-channel streams and an index-wrapping function that uses a single subtraction instead of a modulo, allowing out-of-bounds access.
Impact
The overflow could corrupt adjacent AudioVector structures, potentially leading to an arbitrary read/write primitive and remote code execution within the sandboxed renderer process.
What the attacker needed
WebRTC connection with multi-channel L16 and CNG; Ability to send crafted RTP packets
The fix
The fix should handle the kMultiChannelNotSupported error properly and prevent updating last_mode_ to kRfc3389Cng if CNG generation fails, and update AudioVector::WrapIndex to use modulo instead of a single subtraction.
How it was found
- Establish a WebRTC connection negotiating a multi-channel L16 audio stream and CNG.
- Send a CNG SID packet, which causes comfort noise generation to fail but still updates the last mode.
- Send a very small multi-channel L16 packet that fits in the default buffer capacity without reallocation.
- Trigger the cross-fade loop in Normal::Process, which accesses the buffer out of bounds due to insufficient index wrapping.
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.
This report describes a memory safety bug in WebRTC, the technology that handles real-time audio and video in browsers. When a call switches from background noise to speech, the code that manages audio buffers can write past the end of an array, which could let an attacker run their own code on your computer. The bug is in a part called NetEq that smooths out audio playback.
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.