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

Heap buffer overflow in WebRTC (CVE-2026-7339)

A compromised renderer could send crafted audio parameters through a Mojo interface to the audio service, causing a heap buffer overflow because the required relationship between sample rate and frames per buffer was only checked by a debug assertion. An attacker could overflow the heap by about 1916 bytes, potentially leading to code execution or a crash.

c6eed09fc8b174b0f3eebedcceb1e792 Follow

Originally disclosed on Chrome VRP

Bounty$4,000 Medium View original
  • Fix shipped in 41 days

DCHECK-only validation of WebRTC APM output buffer size leads to heap buffer overflow from compromised renderer

Summary

A compromised renderer can cause a heap buffer overflow in the audio service process by sending crafted AudioParameters through the blink.mojom.RendererAudioInputStreamFactory.CreateStream Mojo interface. The constraint that the output buffer's frames_per_buffer must equal sample_rate / 100 when WebRTC audio processing is enabled is enforced only by a DCHECK_EQ, which is compiled out in release builds. A renderer that supplies frames_per_buffer=1 with sample_rate=48000 causes the audio service to allocate a 1-frame output buffer while the WebRTC Audio Processing Module writes 480 frames into it, overflowing the heap allocation by approximately 1916 bytes. All desktop platforms are affected.

Bisect

Introducing Commit: d33edbcc63a9f12be07f68e392a6126d1a3b370c

Root Cause

When a renderer requests an audio input stream with WebRTC audio processing enabled, it supplies media::AudioParameters that specify the desired output format. These parameters travel from the renderer through RenderFrameAudioInputStreamFactory, ForwardingAudioStreamFactory, audio::StreamFactory, audio::InputStream, and audio::InputController into media::AudioProcessor without any CHECK-level validation of the relationship between sample_rate and frames_per_buffer.

The AudioProcessor constructor contains the following assertion:

C++
// media/webrtc/audio_processor.cc:287-293
CHECK(input_format_.IsValid());
CHECK(output_format_.IsValid());
if (webrtc_audio_processing_) {
  DCHECK_EQ(
      webrtc::AudioProcessing::GetFrameSize(output_format_.sample_rate()),
      output_format_.frames_per_buffer());
}

The two CHECK calls validate IsValid(), which only requires frames_per_buffer > 0 and frames_per_buffer <= 768000. A parameter set of {sample_rate=48000, frames_per_buffer=1} passes this validation. The subsequent DCHECK_EQ verifies the 10ms alignment requirement, but this is stripped from release builds.

The constructor then allocates the output buffer using the unchecked frames_per_buffer:

C++
// media/webrtc/audio_processor.cc:323-326
if (webrtc_audio_processing_) {
  output_bus_ = std::make_unique<AudioProcessorCaptureBus>(
      output_format_.channels(), output_format.frames_per_buffer());
}

With frames_per_buffer=1, this allocates a single-frame buffer. When audio data arrives, ProcessData constructs the APM output configuration from the sample rate, which determines a 480-frame write size:

C++
// media/webrtc/audio_processor.cc:552-557
const webrtc::StreamConfig apm_output_config = webrtc::StreamConfig(
    output_format_.sample_rate(), num_apm_output_channels);

int err =
    ap->ProcessStream(process_ptrs.data(), CreateStreamConfig(input_format_),
                      apm_output_config, output_bus->channel_ptrs().data());

webrtc::AudioProcessing::GetFrameSize(48000) returns 480. The ProcessStream call writes 480 float samples through the raw float* channel pointers, which point into the 1-frame buffer. This produces a heap buffer overflow of 479 floats, or 1916 bytes.

The write target is a raw float* array inside an AudioBus allocation. No libc++ hardening, PartitionAlloc bucket isolation, or MiraclePtr protection applies to this access path.

Reproduce

Tested at commit d0f83d769eeed0b61ffc7d3c15172b2c257acf4e on macOS (arm64).

Build configuration (out/asan-release/args.gn):

is_asan = true
is_debug = false
dcheck_always_on = false
is_component_build = true
target_cpu = "arm64"

Apply the renderer-side patch and build:

git apply issue_mojo034/patch.diff
autoninja -C ~/chromium/src/out/asan-release chrome

Launch:

ASAN_OPTIONS=detect_odr_violation=0 ~/chromium/src/out/asan-release/Chromium.app/Contents/MacOS/Chromium \
  --user-data-dir=/tmp/poc-audio \
  --use-fake-device-for-media-stream \
  --use-fake-ui-for-media-stream \
  issue_mojo034/poc.html

The audio service thread crashes within one second of the page loading.

==62908==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300008f750 at pc 0x0001170fa3d0 bp 0x00030a04e2a0 sp 0x00030a04e298
WRITE of size 16 at 0x60300008f750 thread T13
    #0 webrtc::FloatS16ToFloat(float const*, unsigned long, float*)
    #1 webrtc::AudioBuffer::CopyTo(webrtc::StreamConfig const&, float* const*)
    #2 webrtc::AudioProcessingImpl::ProcessStream(float const* const*, webrtc::StreamConfig const&, webrtc::StreamConfig const&, float* const*)
    #3 media::AudioProcessor::ProcessData(...)
    #4 media::AudioProcessor::ProcessCapturedAudio(media::AudioBus const&, base::TimeTicks, int, double)
    #5 audio::AudioProcessorHandler (via callback)
    #6 audio::ProcessingAudioFifo::ProcessAudioLoop(base::WaitableEvent*)

0x60300008f750 is located 0 bytes after 16-byte region [0x60300008f740,0x60300008f750)
allocated by thread T0 here:
    #0 __asan_memmove
    #1 base::AlignedAlloc(unsigned long, unsigned long)
    #2 base::AlignedUninit<float>(unsigned long, unsigned long)
    #3 media::AudioBus::AudioBus(int, int)
    #4 media::AudioProcessor::AudioProcessor(...)
    #5 media::AudioProcessor::Create(...)
    #6 audio::AudioProcessorHandler::AudioProcessorHandler(...)
    #7 audio::InputController::MaybeSetUpAudioProcessing(...)
    #8 audio::InputController::InputController(...)
    #9 audio::InputController::Create(...)
    #10 audio::InputStream::InputStream(...)
    #11 audio::StreamFactory::CreateInputStream(...)
    #12 media::mojom::AudioStreamFactoryStubDispatch::AcceptWithResponder(...)

Thread T13 created by T0 here:
    #5 audio::InputController::Record()
    #6 audio::InputStream::Record()
    #7 media::mojom::AudioInputStreamStubDispatch::Accept(...)

SUMMARY: AddressSanitizer: heap-buffer-overflow in webrtc::FloatS16ToFloat(float const*, unsigned long, float*)

Credit

Please use c6eed09fc8b174b0f3eebedcceb1e792 as the credit for this vulnerability. Thank you.

The original report as published on the Chromium issue tracker, by c6eed09fc8b174b0f3eebedcceb1e792. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

Chrome's audio capture path lets a renderer ask the browser's audio service for an input stream with WebRTC audio processing enabled. The renderer describes the format it wants with media::AudioParameters, and those parameters are carried over Mojo into the audio service, where media::AudioProcessor sets up the WebRTC Audio Processing Module (APM) and allocates the output bus that the APM writes into.

When WebRTC audio processing is on, the APM works in 10 ms frames. At a 48 kHz sample rate that means 480 frames per buffer, so the output buffer's frames_per_buffer must equal sample_rate / 100. The report shows that this relationship is enforced only by a DCHECK_EQ, which is compiled out in release builds, and that a compromised renderer can therefore make the audio service allocate a buffer far smaller than the APM writes into. The result is a heap buffer overflow in the audio service process. All desktop platforms are affected.

Setup

The proof of concept was tested at commit [redacted] on macOS (arm64), with an AddressSanitizer build. The build configuration in out/asan-release/args.gn was:

Text
is_asan = true
is_debug = false
dcheck_always_on = false
is_component_build = true
target_cpu = "arm64"

The important setting is dcheck_always_on = false: this is a release-style build in which DCHECK assertions are not compiled in, which is the condition the bug depends on. The PoC also needs a renderer-side patch, issue_mojo034/patch.diff, and a page, issue_mojo034/poc.html, which drives the crafted parameters through the Mojo interface. The bug is triggered by a compromised renderer sending crafted parameters to the audio service.

Finding it

The researcher traced the path by which renderer-supplied audio parameters reach the APM. The parameters travel from the renderer through RenderFrameAudioInputStreamFactory, ForwardingAudioStreamFactory, audio::StreamFactory, audio::InputStream, and audio::InputController into media::AudioProcessor, and at no point on that path is the relationship between sample_rate and frames_per_buffer checked at CHECK level.

The AudioProcessor constructor does contain an assertion for exactly this relationship:

C++
// media/webrtc/audio_processor.cc:287-293
CHECK(input_format_.IsValid());
CHECK(output_format_.IsValid());
if (webrtc_audio_processing_) {
  DCHECK_EQ(
      webrtc::AudioProcessing::GetFrameSize(output_format_.sample_rate()),
      output_format_.frames_per_buffer());
}

The two CHECK calls only validate IsValid(), which requires frames_per_buffer > 0 and frames_per_buffer <= 768000. A parameter set of {sample_rate=48000, frames_per_buffer=1} passes that validation. The DCHECK_EQ that would catch the 10 ms alignment violation is stripped from release builds, so in production nothing rejects the pair.

Exploitation

Step 1: Send crafted AudioParameters from the renderer

A compromised renderer sends crafted AudioParameters through the blink.mojom.RendererAudioInputStreamFactory.CreateStream Mojo interface, with WebRTC audio processing enabled and frames_per_buffer=1 alongside sample_rate=48000. The report does not include the raw Mojo message; the renderer-side change is contained in issue_mojo034/patch.diff.

Step 2: Build the instrumented browser and apply the renderer patch

Bash
git apply issue_mojo034/patch.diff
autoninja -C ~/chromium/src/out/asan-release chrome

The first command applies the renderer-side patch that sends the crafted parameters. The second builds Chrome with the ASan release configuration above.

Step 3: Launch Chrome against the PoC page

Bash
ASAN_OPTIONS=detect_odr_violation=0 ~/chromium/src/out/asan-release/Chromium.app/Contents/MacOS/Chromium \
  --user-data-dir=/tmp/poc-audio \
  --use-fake-device-for-media-stream \
  --use-fake-ui-for-media-stream \
  issue_mojo034/poc.html

The audio service thread crashes within one second of the page loading.

Step 4: Observe the crash

Text
==62908==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300008f750 at pc 0x0001170fa3d0 bp 0x00030a04e2a0 sp 0x00030a04e298
WRITE of size 16 at 0x60300008f750 thread T13
    #0 webrtc::FloatS16ToFloat(float const*, unsigned long, float*)
    #1 webrtc::AudioBuffer::CopyTo(webrtc::StreamConfig const&, float* const*)
    #2 webrtc::AudioProcessingImpl::ProcessStream(float const* const*, webrtc::StreamConfig const&, webrtc::StreamConfig const&, float* const*)
    #3 media::AudioProcessor::ProcessData(...)
    #4 media::AudioProcessor::ProcessCapturedAudio(media::AudioBus const&, base::TimeTicks, int, double)
    #5 audio::AudioProcessorHandler (via callback)
    #6 audio::ProcessingAudioFifo::ProcessAudioLoop(base::WaitableEvent*)

0x60300008f750 is located 0 bytes after 16-byte region [0x60300008f740,0x60300008f750)
allocated by thread T0 here:
    #0 __asan_memmove
    #1 base::AlignedAlloc(unsigned long, unsigned long)
    #2 base::AlignedUninit<float>(unsigned long, unsigned long)
    #3 media::AudioBus::AudioBus(int, int)
    #4 media::AudioProcessor::AudioProcessor(...)
    #5 media::AudioProcessor::Create(...)
    #6 audio::AudioProcessorHandler::AudioProcessorHandler(...)
    #7 audio::InputController::MaybeSetUpAudioProcessing(...)
    #8 audio::InputController::InputController(...)
    #9 audio::InputController::Create(...)
    #10 audio::InputStream::InputStream(...)
    #11 audio::StreamFactory::CreateInputStream(...)
    #12 media::mojom::AudioStreamFactoryStubDispatch::AcceptWithResponder(...)

Thread T13 created by T0 here:
    #5 audio::InputController::Record()
    #6 audio::InputStream::Record()
    #7 media::mojom::AudioInputStreamStubDispatch::Accept(...)

SUMMARY: AddressSanitizer: heap-buffer-overflow in webrtc::FloatS16ToFloat(float const*, unsigned long, float*)

The write happens in the audio service thread T13, inside the WebRTC APM's ProcessStream path, and the allocation it overruns was made by media::AudioBus::AudioBus during AudioProcessor construction, reached from the Mojo dispatch of AudioStreamFactory. The 16-byte region is the allocation the write overruns.

Root cause

The constructor allocates the output buffer using the unchecked frames_per_buffer:

C++
// media/webrtc/audio_processor.cc:323-326
if (webrtc_audio_processing_) {
  output_bus_ = std::make_unique<AudioProcessorCaptureBus>(
      output_format_.channels(), output_format.frames_per_buffer());
}

With frames_per_buffer=1, this allocates a single-frame buffer. When audio data arrives, ProcessData builds the APM output configuration from the sample rate, which determines the write size:

C++
// media/webrtc/audio_processor.cc:552-557
const webrtc::StreamConfig apm_output_config = webrtc::StreamConfig(
    output_format_.sample_rate(), num_apm_output_channels);

int err =
    ap->ProcessStream(process_ptrs.data(), CreateStreamConfig(input_format_),
                      apm_output_config, output_bus->channel_ptrs().data());

webrtc::AudioProcessing::GetFrameSize(48000) returns 480. ProcessStream writes 480 float samples through the raw float* channel pointers, which point into the 1-frame buffer. That is a heap buffer overflow of 479 floats, or 1916 bytes.

The write target is a raw float* array inside an AudioBus allocation. No libc++ hardening, PartitionAlloc bucket isolation, or MiraclePtr protection applies to this access path, so the usual mitigations do not constrain the overrun.

The bug was introduced by commit [redacted] (2021-12-09, author Sam Zackrisson), reviewed at https://chromium-review.googlesource.com/c/chromium/src/+/3309225.

Impact

A compromised renderer can trigger a heap buffer overflow in the audio service process on all desktop platforms. The overflow is a write of 479 floats (1916 bytes) past a heap allocation, performed by the APM through raw pointers, in a process that is meant to be isolated from the renderer. The report does not describe a specific exploitation outcome beyond the memory corruption itself.

Fix

The report does not describe the fix that was applied. A fix would need to enforce the sample_rate / 100 relationship at CHECK level, or otherwise validate the parameters before the output bus is allocated.

Variants to test

  1. Other Mojo interfaces that accept AudioParameters from the renderer. Send frames_per_buffer values that pass IsValid() but violate the 10 ms alignment (for example 1, 2, or values just under 768000) and watch for ASan reports in the audio service. A positive result is a heap-buffer-overflow in an APM or AudioBus frame.
  2. Other sample rates. The APM frame size depends on the rate, so try rates where GetFrameSize(rate) is large relative to a small frames_per_buffer. A positive result is an overrun whose size matches the difference between the two.
  3. Channel counts. Vary output_format_.channels() together with a small frames_per_buffer to see whether the per-channel allocation and the APM's channel pointers diverge. A positive result is a write past the allocation in AudioBus::AudioBus.
  4. Any other DCHECK-only invariant on a renderer-controlled value that feeds an allocation size. Grep for DCHECK_EQ near make_unique or AlignedAlloc calls on the audio path; a positive result is a release build where the assertion is absent and the allocation is smaller than the later write.
  5. The same parameter path with WebRTC audio processing disabled, to confirm the overflow is gated on webrtc_audio_processing_. A positive result would show the bug is reachable without the APM, which the report does not claim.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 16 min read.

What happened, in plain words

Chrome is split into several processes. One of them, the renderer, turns web pages into something you can see and click. Another, the audio service, handles sound: it talks to your microphone and runs audio processing on what comes in. The whole point of splitting them is that if a web page manages to take over its renderer, it should still be stuck there and unable to reach the rest of the browser.

This report shows a way to break that separation. A renderer that is already under an attacker's control can send a request to the audio service asking for a microphone stream, and it can describe the stream's format with numbers of its own choosing. One of those numbers says how many audio samples fit in one buffer. The audio service checks that the number is positive and not absurdly large, but it does not check the one rule that actually matters: when WebRTC audio processing is switched on, the buffer must hold exactly 10 milliseconds of audio. At a sample rate of 48,000 samples per second, that is 480 samples.

The rule is written in the code, but only as a DCHECK. A DCHECK is a debugging assertion: it is active in builds made for developers and silently removed from the builds that ship to users. So in a real Chrome, nothing stops a renderer from asking for a buffer of 1 sample while the audio processing module still writes 480 samples into it. The extra 479 samples land past the end of the allocated memory. That is a heap buffer overflow: writing data beyond the area the program reserved, into memory that belongs to something else.

The overflow is about 1916 bytes. It happens inside the audio service process, on all desktop platforms.

Background you need

A few ideas come up again and again below, so here they are from zero.

Process. A running program. Browsers run several at once so that a failure or takeover in one does not automatically give access to the others. Chrome's renderer draws pages; the audio service handles sound.

Renderer. The process that runs a web page's code. It is treated as untrusted, because it runs content from the internet.

Mojo. Chrome's internal messaging system. Processes talk to each other by sending structured messages over named interfaces, rather than by sharing memory directly. Think of it as an internal postal service with strict forms: each message must match a defined shape.

API and interface. An API is the set of requests one piece of software offers to another. A Mojo interface is the same idea inside Chrome: a named list of calls, each with defined inputs and outputs. blink.mojom.RendererAudioInputStreamFactory.CreateStream is one such call: the renderer uses it to ask for an audio input stream.

Audio parameters. A description of an audio format. Two fields matter here: sample_rate, how many samples are captured per second, and frames_per_buffer, how many samples go into one buffer. A buffer is a fixed-size block of memory used to hold a chunk of audio.

WebRTC and the APM. WebRTC is the technology browsers use for real-time audio and video calls. Its Audio Processing Module (APM) cleans up microphone audio: it removes echo, suppresses noise and adjusts gain. The APM works in fixed 10 millisecond chunks. At 48,000 samples per second, 10 ms is 480 samples.

Heap and heap buffer overflow. The heap is the pool of memory a program uses for data whose size is decided while it runs. When a program reserves a block there and then writes past its end, that is a heap buffer overflow. The bytes written land in memory that may belong to something else, which can corrupt data or, in the wrong hands, be steered into running attacker code.

Assertion, CHECK and DCHECK. An assertion is a statement in code that something must be true. CHECK stays in every build: if it fails, the program stops. DCHECK is debug-only: it is compiled out of release builds, so in the version users run it does nothing at all.

AddressSanitizer (ASan). A tool built into a special build of a program that watches memory accesses and reports any that go out of bounds, with a stack trace showing where.

Commit. A single recorded change to a codebase, with an identifier, a date and an author.

Context

Chrome's audio capture path lets a renderer ask the browser's audio service for an input stream with WebRTC audio processing enabled. The renderer describes the format it wants with media::AudioParameters, and those parameters are carried over Mojo into the audio service, where media::AudioProcessor sets up the APM and allocates the output bus that the APM writes into. The output bus is the buffer that receives the processed audio.

When WebRTC audio processing is on, the APM works in 10 ms frames. At a 48 kHz sample rate that means 480 frames per buffer, so the output buffer's frames_per_buffer must equal sample_rate / 100. The report shows that this relationship is enforced only by a DCHECK_EQ, which is compiled out in release builds, and that a compromised renderer can therefore make the audio service allocate a buffer far smaller than the APM writes into. The result is a heap buffer overflow in the audio service process. All desktop platforms are affected.

Setup

The proof of concept was tested at commit [redacted] on macOS (arm64), with an AddressSanitizer build. The build configuration in out/asan-release/args.gn was:

Text
is_asan = true
is_debug = false
dcheck_always_on = false
is_component_build = true
target_cpu = "arm64"

Line by line:

  • is_asan = true turns on AddressSanitizer, the memory-watching tool, so an out-of-bounds write is caught and reported instead of quietly corrupting memory.
  • is_debug = false builds without the usual developer debugging extras, closer to what users run.
  • dcheck_always_on = false is the key line. It means DCHECK assertions are not compiled in. It means DCHECK assertions are not compiled in, matching release builds where the check is absent.
  • is_component_build = true builds Chrome as many separate shared pieces, which makes rebuilds faster.
  • target_cpu = "arm64" targets Apple Silicon Macs.

The PoC also needs a renderer-side patch, issue_mojo034/patch.diff, and a page, issue_mojo034/poc.html, which drives the crafted parameters through the Mojo interface. The threat model is a compromised renderer: the attacker already controls renderer code and is trying to cross the process boundary into the audio service. In other words, the question is not how to break into a renderer, but what a renderer can do once it is already lost.

Finding it

The researcher traced the path by which renderer-supplied audio parameters reach the APM. The parameters travel from the renderer through RenderFrameAudioInputStreamFactory, ForwardingAudioStreamFactory, audio::StreamFactory, audio::InputStream, and audio::InputController into media::AudioProcessor, and at no point on that path is the relationship between sample_rate and frames_per_buffer checked at CHECK level. Each of those names is a stage in a relay: the request is passed from one component to the next, and none of them stops to verify the two numbers against each other.

The AudioProcessor constructor does contain an assertion for exactly this relationship:

C++
// media/webrtc/audio_processor.cc:287-293
CHECK(input_format_.IsValid());
CHECK(output_format_.IsValid());
if (webrtc_audio_processing_) {
  DCHECK_EQ(
      webrtc::AudioProcessing::GetFrameSize(output_format_.sample_rate()),
      output_format_.frames_per_buffer());
}

What each line does:

  • The comment gives the file and line numbers, so anyone can find the code in the source tree.
  • CHECK(input_format_.IsValid()); stops the program if the incoming audio format is not valid. This check survives in release builds.
  • CHECK(output_format_.IsValid()); does the same for the outgoing format.
  • if (webrtc_audio_processing_) { runs the following block only when WebRTC audio processing is enabled.
  • DCHECK_EQ(...) compares two values and complains if they differ, but only in debug builds. The first value is the frame size the APM uses for the given sample rate; the second is the buffer size the renderer asked for.
  • The closing brace ends the conditional block.

The two CHECK calls only validate IsValid(), which requires frames_per_buffer > 0 and frames_per_buffer <= 768000. A parameter set of {sample_rate=48000, frames_per_buffer=1} passes that validation: 1 is greater than 0 and far below 768000. The DCHECK_EQ that would catch the 10 ms alignment violation is stripped from release builds, so in production nothing rejects the pair. The comparison that would have caught the mismatch is exactly the one that is not there when it matters.

Exploitation

Step 1: Send crafted AudioParameters from the renderer

A compromised renderer sends crafted AudioParameters through the blink.mojom.RendererAudioInputStreamFactory.CreateStream Mojo interface, with WebRTC audio processing enabled and frames_per_buffer=1 alongside sample_rate=48000. The report does not include the raw Mojo message; the renderer-side change is contained in issue_mojo034/patch.diff. The idea is simple: the renderer asks for a microphone stream and, in the same request, states that one buffer holds a single sample, while the sample rate says 48,000 samples arrive every second.

Step 2: Build the instrumented browser and apply the renderer patch

Bash
git apply issue_mojo034/patch.diff
autoninja -C ~/chromium/src/out/asan-release chrome
  • git apply issue_mojo034/patch.diff applies the prepared change to the Chrome source tree. git apply issue_mojo034/patch.diff applies the renderer-side patch.
  • autoninja -C ~/chromium/src/out/asan-release chrome builds Chrome using the configuration in the out/asan-release directory, which is the ASan release setup shown above. autoninja is Chrome's build tool; it reads the configuration and compiles only what is needed.

Step 3: Launch Chrome against the PoC page

Bash
ASAN_OPTIONS=detect_odr_violation=0 ~/chromium/src/out/asan-release/Chromium.app/Contents/MacOS/Chromium \
  --user-data-dir=/tmp/poc-audio \
  --use-fake-device-for-media-stream \
  --use-fake-ui-for-media-stream \
  issue_mojo034/poc.html
  • ASAN_OPTIONS=detect_odr_violation=0 sets an option for AddressSanitizer. It turns off one of its checks, which would otherwise report an unrelated problem and get in the way.
  • The long path is the Chrome program inside the build output directory.
  • --user-data-dir=/tmp/poc-audio gives this test run its own profile folder, so it does not touch your normal Chrome data.
  • --use-fake-device-for-media-stream makes Chrome pretend a microphone exists, so no real capture device is needed.
  • --use-fake-ui-for-media-stream automatically accepts the permission prompt that a page normally gets before using the microphone.
  • issue_mojo034/poc.html is the test page to open.

The fake device and fake UI flags let the page obtain a media stream without a real capture device or a permission prompt, so the audio input path is exercised immediately. The audio service thread crashes within one second of the page loading.

Step 4: Observe the crash

Text
==62908==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300008f750 at pc 0x0001170fa3d0 bp 0x00030a04e2a0 sp 0x00030a04e298
WRITE of size 16 at 0x60300008f750 thread T13
    #0 webrtc::FloatS16ToFloat(float const*, unsigned long, float*)
    #1 webrtc::AudioBuffer::CopyTo(webrtc::StreamConfig const&, float* const*)
    #2 webrtc::AudioProcessingImpl::ProcessStream(float const* const*, webrtc::StreamConfig const&, webrtc::StreamConfig const&, float* const*)
    #3 media::AudioProcessor::ProcessData(...)
    #4 media::AudioProcessor::ProcessCapturedAudio(media::AudioBus const&, base::TimeTicks, int, double)
    #5 audio::AudioProcessorHandler (via callback)
    #6 audio::ProcessingAudioFifo::ProcessAudioLoop(base::WaitableEvent*)

0x60300008f750 is located 0 bytes after 16-byte region [0x60300008f740,0x60300008f750)
allocated by thread T0 here:
    #0 __asan_memmove
    #1 base::AlignedAlloc(unsigned long, unsigned long)
    #2 base::AlignedUninit<float>(unsigned long, unsigned long)
    #3 media::AudioBus::AudioBus(int, int)
    #4 media::AudioProcessor::AudioProcessor(...)
    #5 media::AudioProcessor::Create(...)
    #6 audio::AudioProcessorHandler::AudioProcessorHandler(...)
    #7 audio::InputController::MaybeSetUpAudioProcessing(...)
    #8 audio::InputController::InputController(...)
    #9 audio::InputController::Create(...)
    #10 audio::InputStream::InputStream(...)
    #11 audio::StreamFactory::CreateInputStream(...)
    #12 media::mojom::AudioStreamFactoryStubDispatch::AcceptWithResponder(...)

Thread T13 created by T0 here:
    #5 audio::InputController::Record()
    #6 audio::InputStream::Record()
    #7 media::mojom::AudioInputStreamStubDispatch::Accept(...)

SUMMARY: AddressSanitizer: heap-buffer-overflow in webrtc::FloatS16ToFloat(float const*, unsigned long, float*)

How to read this report:

  • The first line says AddressSanitizer found a heap buffer overflow at a particular memory address, with the program counter and stack pointers at the moment of the fault.
  • WRITE of size 16 at ... thread T13 says a 16-byte write happened in thread T13. A thread is one line of execution inside a process; the audio service does its work on its own threads.
  • The numbered #0 to #6 lines are the call stack: the chain of function calls that led to the write. #0 is where it happened, webrtc::FloatS16ToFloat, a function that converts audio samples from one number format to another. #1 and #2 are the WebRTC audio buffer copy and the APM's ProcessStream. #3 and #4 are Chrome's AudioProcessor handling captured audio. #5 and #6 are the audio processing loop.
  • The next paragraph says the address is 0 bytes after a 16-byte region. In other words, the write started exactly where the reserved block ended. Sixteen bytes is one sample in the format used here, which matches a one-frame buffer.
  • The second stack, allocated by thread T0 here, shows who reserved that 16-byte block: media::AudioBus::AudioBus, called from the AudioProcessor constructor, reached from the Mojo dispatch of AudioStreamFactory. Thread T0 is the thread that set things up.
  • The third stack shows which thread created T13, through the audio input recording path.
  • The SUMMARY line names the fault: a heap buffer overflow inside webrtc::FloatS16ToFloat.

The write happens in the audio service thread T13, inside the WebRTC APM's ProcessStream path, and the allocation it overruns was made by media::AudioBus::AudioBus during AudioProcessor construction, reached from the Mojo dispatch of AudioStreamFactory. The 16-byte region is the allocation the write overruns.

Root cause

The constructor allocates the output buffer using the unchecked frames_per_buffer:

C++
// media/webrtc/audio_processor.cc:323-326
if (webrtc_audio_processing_) {
  output_bus_ = std::make_unique<AudioProcessorCaptureBus>(
      output_format_.channels(), output_format.frames_per_buffer());
}
  • The comment again gives the file and line numbers.
  • if (webrtc_audio_processing_) { runs the block only when WebRTC audio processing is enabled, which is the case the attacker sets up.
  • output_bus_ = std::make_unique<AudioProcessorCaptureBus>(...) creates the output buffer and stores it. std::make_unique is a C++ helper that reserves memory for a new object and hands back a pointer to it.
  • The two arguments are the number of channels and output_format.frames_per_buffer(), the buffer size taken straight from the renderer's request. Nothing compares it with the sample rate first.
  • The closing brace ends the block.

With frames_per_buffer=1, this allocates a single-frame buffer. When audio data arrives, ProcessData builds the APM output configuration from the sample rate, which determines the write size:

C++
// media/webrtc/audio_processor.cc:552-557
const webrtc::StreamConfig apm_output_config = webrtc::StreamConfig(
    output_format_.sample_rate(), num_apm_output_channels);

int err =
    ap->ProcessStream(process_ptrs.data(), CreateStreamConfig(input_format_),
                      apm_output_config, output_bus->channel_ptrs().data());
  • The comment gives the location.
  • const webrtc::StreamConfig apm_output_config = webrtc::StreamConfig(...) builds a description of the output format for the APM. It is made from the sample rate and the number of output channels, not from the buffer size the renderer supplied.
  • int err = prepares to store the return code of the processing call.
  • ap->ProcessStream(...) runs the APM on the incoming audio. The arguments are the input samples, the input format, the output format just built, and the output pointers taken from the buffer.
  • output_bus->channel_ptrs().data() hands the APM raw pointers into the buffer that was allocated with the renderer's small size.

webrtc::AudioProcessing::GetFrameSize(48000) returns 480. ProcessStream writes 480 float samples through the raw float* channel pointers, which point into the 1-frame buffer. That is a heap buffer overflow of 479 floats, or 1916 bytes. The buffer was sized from one number and written using another, and the two were never reconciled.

The write target is a raw float* array inside an AudioBus allocation. No libc++ hardening, PartitionAlloc bucket isolation, or MiraclePtr protection applies to this access path, so the usual mitigations do not constrain the overrun. In plain terms: several of Chrome's general defences against memory bugs do not cover this particular kind of write, because it goes through a plain pointer rather than through the checked containers those defences watch.

The bug was introduced by commit [redacted] (2021-12-09, author Sam Zackrisson), reviewed at https://chromium-review.googlesource.com/c/chromium/src/+/3309225. The report lists this commit as the introducing commit.

Impact

A compromised renderer can trigger a heap buffer overflow in the audio service process on all desktop platforms. The overflow is a write of 479 floats (1916 bytes) past a heap allocation, performed by the APM through raw pointers, in a process that is meant to be isolated from the renderer. The report does not describe a specific exploitation outcome beyond the memory corruption itself. The severity recorded for the issue is medium, and the bounty was 4000.00 USD.

Fix

The report does not describe the fix that was applied. A fix would need to enforce the sample_rate / 100 relationship at CHECK level, or otherwise validate the parameters before the output bus is allocated. The lesson generalises: a check that only exists in debug builds is not a security check.

Variants to test

These are follow-up ideas for anyone hunting similar bugs. Each one changes one input and watches for the same kind of crash.

  1. Other Mojo interfaces that accept AudioParameters from the renderer. Send frames_per_buffer values that pass IsValid() but violate the 10 ms alignment (for example 1, 2, or values just under 768000) and watch for ASan reports in the audio service. A positive result is a heap-buffer-overflow in an APM or AudioBus frame.
  2. Other sample rates. The APM frame size depends on the rate, so try rates where GetFrameSize(rate) is large relative to a small frames_per_buffer. A positive result is an overrun whose size matches the difference between the two.
  3. Channel counts. Vary output_format_.channels() together with a small frames_per_buffer to see whether the per-channel allocation and the APM's channel pointers diverge. A positive result is a write past the allocation in AudioBus::AudioBus.
  4. Any other DCHECK-only invariant on a renderer-controlled value that feeds an allocation size. Grep for DCHECK_EQ near make_unique or AlignedAlloc calls on the audio path; a positive result is a release build where the assertion is absent and the allocation is smaller than the later write.
  5. The same parameter path with WebRTC audio processing disabled, to confirm the overflow is gated on webrtc_audio_processing_. A positive result would show the bug is reachable without the APM, which the report does not claim.

Glossary

  • AddressSanitizer (ASan): a tool built into a special build of a program that detects out-of-bounds and other invalid memory accesses and prints a report with a stack trace.
  • API: the set of requests one piece of software offers to another, each with defined inputs and outputs.
  • APM (Audio Processing Module): the WebRTC component that cleans up microphone audio, working in fixed 10 ms chunks.
  • Assertion: a statement in code that something must be true; if it is not, the program reacts.
  • Audio bus / buffer: a block of memory holding a chunk of audio samples.
  • AudioParameters: Chrome's description of an audio format, including sample rate and buffer size.
  • autoninja: Chrome's build tool, which compiles the source according to a configuration directory.
  • Bisect: finding the exact code change that introduced a bug by narrowing down commits.
  • CHECK: an assertion that stays in every build; if it fails, the program stops.
  • Commit: a single recorded change to a codebase, with an identifier, date and author.
  • Compromised renderer: a renderer process already under an attacker's control.
  • DCHECK / DCHECK_EQ: a debug-only assertion, compiled out of release builds; DCHECK_EQ compares two values.
  • Heap: the pool of memory a program uses for data whose size is decided while it runs.
  • Heap buffer overflow: writing past the end of a block of memory reserved on the heap, into memory that may belong to something else.
  • Interface (Mojo): a named list of calls one process offers to another, each with defined inputs and outputs.
  • libc++ hardening: safety checks built into the standard C++ library that catch some kinds of misuse of its containers.
  • MiraclePtr: a Chrome mechanism that makes certain classes of pointer misuse detectable or harmless.
  • Mojo: Chrome's internal messaging system used for communication between processes.
  • PartitionAlloc bucket isolation: a Chrome memory allocator design that keeps allocations of different sizes apart so one overflow is less likely to reach another object.
  • Process: a running program; browsers use several so a failure in one does not automatically affect the others.
  • Proof of concept (PoC): a small test that demonstrates a bug actually happens.
  • Raw pointer: a plain memory address held in a variable, with no automatic bounds or lifetime checking.
  • Release build: the version of a program compiled for users, without debug-only checks.
  • Renderer: the browser process that runs a web page's code and is treated as untrusted.
  • Sample rate: how many audio samples are captured per second, for example 48,000.
  • frames_per_buffer: how many audio samples fit in one buffer.
  • Stack trace: the chain of function calls that led to a particular point in a program.
  • Thread: one line of execution inside a process.
  • Threat model: a description of what the attacker can already do and what they are trying to reach.
  • WebRTC: the technology browsers use for real-time audio and video communication.

More by c6eed09fc8b174b0f3eebedcceb1e792

View all

52 more disclosed reports, best first.

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.