Insufficient validation of untrusted input in Chromecast (CVE-2026-13797)
The Chromecast Starboard media backend fails to validate DRM subsample sizes, allowing a compromised renderer to send a large clear_bytes value that is converted to a negative integer. This negative value is passed to the vendor's decryption API, potentially causing out-of-bounds pointer arithmetic and heap corruption in the browser process, which could lead to sandbox escape.
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: A potential integer signedness flip vulnerability exists in the Chromecast Starboard media backend. A compromised renderer can send maliciously large DRM subsample counts that bypass validation and are converted to negative integers before being passed to the vendor's Starboard API. This negative offset may cause out-of-bounds pointer arithmetic during decryption, potentially allowing an attacker to write arbitrary data to the browser process heap and escape the sandbox.
Affected files:
chromecast/starboard/media/media/drm_util.ccchromecast/starboard/media/media/starboard_api_wrapper.hchromecast/starboard/media/media/starboard_video_decoder.ccchromecast/starboard/media/media/starboard_audio_decoder.ccchromecast/starboard/media/media/starboard_decoder.cc
Estimated timestamp from git blame: 2025-06-05
Summary
There is a potential out-of-bounds (OOB) write vulnerability in the Chromecast Starboard media backend. The issue stems from a lack of subsample size validation coupled with an integer signedness flip when converting Chromium's DecryptConfig to the Starboard API's DRM structures. This allows a compromised renderer to pass negative byte counts to the vendor's decryption API, likely resulting in backwards OOB pointer arithmetic and heap corruption in the browser process.
Root Cause Analysis
When a media::DecoderBuffer containing encrypted media is sent via IPC from the renderer to the browser process, MojoDecoderBufferReader deserializes its DecryptConfig. The deserialization logic (ValidateAndConvertMojoDecryptConfig) does not validate that the sum of the subsamples sizes matches the DecoderBuffer's total data_size. In Chromium, this validation is intentionally left to individual decoders via DecoderBuffer::DoSubsamplesMatch().
However, the Starboard media backend (StarboardVideoDecoder::PushBuffer and StarboardAudioDecoder::PushBuffer) fails to call DecoderBuffer::DoSubsamplesMatch() or VerifySubsamplesMatchSize().
Instead, it proceeds to convert the configuration using DrmInfoWrapper::Create(). During this conversion, uint32_t values from Chromium's SubsampleEntry are implicitly narrowed into int32_t fields in StarboardDrmSubSampleMapping:
// chromecast/starboard/media/media/drm_util.cc
for (const ::media::SubsampleEntry& subsample : decrypt_config.subsamples()) {
StarboardDrmSubSampleMapping mapping;
mapping.clear_byte_count = subsample.clear_bytes; // Implicit uint32_t -> int32_t cast
mapping.encrypted_byte_count = subsample.cypher_bytes;
subsample_mappings->push_back(std::move(mapping));
}
If an attacker provides a clear_bytes value like 0x80000000, it is reinterpreted as -2147483648. This negative value is passed directly to the vendor's Starboard API (SbPlayerWriteSample2) along with a pointer to a base::HeapArray allocated in the browser process.
Potential Exploit Steps
Note: These are suggested steps based on static analysis, as our tooling does not yet have the ability to run live exploit code.
- Compromise Renderer: An attacker achieves code execution in a sandboxed renderer process.
- Establish DRM Session: The attacker initiates a valid EME session (e.g., Widevine) to register a valid decryption key in the browser's
StarboardDrmKeyTracker. - Send Malicious Buffer: The attacker hooks
mojom::DemuxerStream::Readto return aDecoderBufferwith aDecryptConfigcontaining aclear_bytesvalue of0x80000000and a smallcypher_bytespayload. - Trigger OOB Decryption: The browser receives the buffer. The Starboard adapter converts the
0x80000000to-2147483648and passes it to the vendor's Starboard implementation. - Memory Corruption: Following standard Common Encryption (CENC) semantics, the vendor implementation will likely advance an internal buffer pointer to skip the unencrypted data (
ptr += clear_byte_count). The negative value shifts the pointer backwards by 2GB, well outside the allocated heap buffer. The subsequent AES decryption operation uses the valid key to decrypt thecypher_bytesciphertext and writes the attacker-controlled plaintext to this out-of-bounds location, achieving a sandbox escape.
Suggested Fix
- Enforce Bounds Checking: Add a validation check at the beginning of
StarboardVideoDecoder::PushBufferandStarboardAudioDecoder::PushBuffer:C++ if (!DecoderBuffer::DoSubsamplesMatch(*buffer)) { // Drop buffer / report error return BufferStatus::kBufferFailed; } - Safe Casting: Update
DrmInfoWrapper::Create()to safely cast the byte counts usingbase::checked_cast<int32_t>to explicitly crash or fail safely if an overflow is attempted.
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
The Starboard media backend does not call DecoderBuffer::DoSubsamplesMatch() to validate that the sum of subsample sizes matches the buffer's data size, and it implicitly narrows uint32_t values to int32_t, causing a signedness flip.
Impact
A compromised renderer could potentially write arbitrary data to the browser process heap and escape the sandbox, though the report notes this is based on static analysis and may be a false positive.
What the attacker needed
Compromised renderer process; valid DRM session
The fix
The fix should add validation using DecoderBuffer::DoSubsamplesMatch() in the Starboard decoders and use base::checked_cast<int32_t> for safe casting.
How it was found
- Compromise the renderer process to achieve code execution.
- Establish a valid DRM session (e.g., Widevine) to register a decryption key.
- Hook the demuxer stream to return a buffer with a DecryptConfig containing a large clear_bytes value.
- The browser receives the buffer and converts the large value to a negative integer.
- The negative value is passed to the vendor's Starboard implementation, causing out-of-bounds pointer arithmetic.
- The decryption operation writes attacker-controlled plaintext to an out-of-bounds location, achieving sandbox escape.
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 encrypted video is played, the browser checks how much data is unencrypted and how much is encrypted. In this case, the browser did not check that the numbers added up correctly. An attacker who already controls a part of the browser could send a huge number that becomes negative, tricking the decryption code into writing data outside the intended memory area, which could let them break out of the security 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.