Heap buffer overflow in Chromecast (CVE-2026-13798)
The Chromecast CMA media pipeline in the browser process did not check that the subsample sizes in a DecryptConfig matched the actual size of the DecoderBuffer data. A compromised renderer could send a small buffer with much larger subsample sizes, causing the vendor decryption backend to read and write far beyond the heap allocation, which the report claims could lead to a sandbox escape and remote code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 3 months
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 security team.
Overview: The Chromecast CMA media pipeline fails to validate that DecryptConfig subsamples match the size of the associated DecoderBuffer. A compromised renderer can exploit this to trigger massive out-of-bounds heap reads and writes in the browser process when the buffer is passed to vendor decryption backends. This can be leveraged for a sandbox escape.
Affected files:
chromecast/media/cma/base/decoder_buffer_adapter.ccchromecast/media/cma/pipeline/av_pipeline_impl.ccchromecast/media/cma/backend/backend_decryptor.ccchromecast/media/cma/base/decrypt_util.cc
Estimated timestamp from git blame: 2024-10-10
Summary
A potential vulnerability exists in the Chromecast Cast Media Architecture (CMA) pipeline that allows a compromised renderer process to trigger an out-of-bounds (OOB) heap read and write in the browser process. The issue stems from a failure to validate media::DecryptConfig subsamples against the actual allocated size of the media::DecoderBuffer data. Because the Chromecast CMA pipeline (running in the browser process) implicitly trusts these unvalidated sizes, vendor-implemented decryption backends are tricked into performing OOB memory accesses.
Technical Details
When a renderer responds to a mojom::DemuxerStream::Read request, it provides a mojom::DecoderBuffer.
- Deserialization & Allocation: In the browser process,
MojoDecoderBufferReaderdeserializes this buffer usingmojo::TypeConverter(media/mojo/common/media_type_converters.cc). The backingbase::HeapArrayis allocated based on the attacker-controlledmojo_buffer->data_size. However, theTypeConverterforDecryptConfigblindly accepts the providedsubsamplesarray without verifying if the total subsample size exceedsdata_size. - CMA Pipeline Ingestion: The
media::DecoderBufferenters the CMA pipeline atDemuxerStreamAdapter::OnNewBuffer. It is wrapped in achromecast::media::DecoderBufferAdapter. The adapter's constructor (chromecast/media/cma/base/decoder_buffer_adapter.cc) blindly copies the malicious subsamples into aCastDecryptConfigImpl. - Missing Validation: Crucially, Chromium provides
media::VerifySubsamplesMatchSize()andmedia::DecoderBuffer::DoSubsamplesMatch()to catch this exact mismatch, but neither is called during Mojo deserialization or within the Chromecast CMA pipeline. - Vendor Backend Execution: The buffer is passed to
BackendDecryptor::Decrypt()(chromecast/media/cma/pipeline/backend_decryptor.cc), which calls the vendor backend viadecryptor_->PushBufferForDecrypt(buffer.get(), buffer->writable_data()). - Contract Violation: The interface contract (
chromecast/public/media/media_pipeline_backend.h) mandates that the output buffermust be long enough to hold clear data. Because Chromium skipped validation, this contract is violated. The vendor backend iterates over the malicious subsamples and performs decryption starting at thebuffer->writable_data()pointer, reading and writing far past the bounds of the small heap allocation.
Impact
An attacker can use AES-CTR (Counter mode) decryption as a highly controlled XOR bit-flipping primitive. By controlling the AES key (e.g., via EME), the IV, and the subsample offsets, the attacker can XOR arbitrary chosen patterns against adjacent heap memory. Overwriting security-critical objects (such as vtable pointers or Mojo receiver state) on the browser process heap leads directly to a sandbox escape and arbitrary Remote Code Execution (RCE).
Potential Reproduction Steps
Note: These are suggested steps based on code analysis; our tooling agent does not run code.
- Compromise a renderer process on a Chromecast device.
- Establish an encrypted media session, controlling the AES decryption key and IV.
- Hook the renderer's
mojom::DemuxerStreamimplementation. - Send a crafted
mojom::DecoderBufferto the browser process with:- A small
data_size(e.g., 16 bytes). - A
DecryptConfigcontaining a singleSubsampleEntrywithclear_bytes= 0 andcypher_bytes= 65536 (64KB).
- A small
- The browser process allocates a 16-byte heap buffer but instructs the vendor backend to decrypt 64KB of data, resulting in a massive OOB heap write.
Suggested Fix
Add robust validation during Mojo deserialization to ensure subsample sizes match the buffer size. In media/mojo/common/media_type_converters.cc, the TypeConverter for DecoderBufferPtr (or the callers of MojoDecoderBufferReader) should explicitly call media::VerifySubsamplesMatchSize() and discard the buffer if the validation fails. Alternatively, use the newer ValidateAndConvertMojoDecoderBuffer utility which may include stricter checks, or enforce DecoderBuffer::DoSubsamplesMatch() upon entry to the CMA pipeline in DemuxerStreamAdapter.
Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33
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 Mojo type converter and the Chromecast CMA pipeline accepted DecryptConfig subsample sizes without calling the existing VerifySubsamplesMatchSize or DoSubsamplesMatch checks against the allocated buffer size.
Impact
By using AES-CTR decryption as a controlled XOR primitive, an attacker could overwrite adjacent heap objects such as vtable pointers and Mojo receiver state, which the report claims leads to a sandbox escape and arbitrary remote code execution.
What the attacker needed
Compromised renderer process; control of AES key and IV via EME; Chromecast device
The fix
Validation should be added during Mojo deserialization, or on entry to the CMA pipeline, so that subsample sizes are checked against the buffer size and mismatched buffers are discarded.
How it was found
- Compromise a renderer process on a Chromecast device.
- Establish an encrypted media session and control the AES key and IV.
- Hook the renderer's DemuxerStream implementation.
- Send a crafted DecoderBuffer with a small data size and a much larger subsample size.
- The browser allocates the small buffer but the vendor backend decrypts the larger size, causing an out-of-bounds heap 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.
A renderer is the part of the browser that draws web pages and is meant to be kept in a sandbox so it cannot harm the rest of the system. Here the browser process trusted a size value sent by the renderer without checking it against the real buffer size, so a decryption step wrote past the end of a small piece of memory. That kind of out-of-bounds write can corrupt other data and, in theory, let an attacker break out of the sandbox.
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.