Insufficient validation of untrusted input in Media (CVE-2026-11041)
A compromised renderer can send a DecoderBuffer with subsample metadata that describes more bytes than the actual data size. This unvalidated metadata is passed to the Media Foundation utility process, potentially causing an out-of-bounds memory access in a decryptor and allowing a sandbox escape.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: A compromised renderer can provide malicious subsample metadata in a DecoderBuffer that exceeds the buffer's data size. This unvalidated metadata is passed to the Media Foundation (MF) utility process and converted into an IMFSample, potentially triggering an out-of-bounds memory access in an MF decryptor. This can lead to a sandbox escape from the renderer into the higher-privilege MF CDM utility process on Windows.
Affected files:
media/base/win/mf_helpers.ccmedia/mojo/services/mojo_demuxer_stream_adapter.ccmedia/renderers/win/media_foundation_stream_wrapper.ccmedia/mojo/common/media_type_converters.cc
Estimated timestamp from git blame: 2024-01-30
Vulnerability Summary
A potential security vulnerability exists in the MediaFoundation-based decryption path on Windows where subsample geometry provided by a renderer process is not validated before being passed to the Media Foundation (MF) utility process. A compromised renderer can supply a DecoderBuffer over the mojom::DemuxerStream Mojo pipe with a DecryptConfig whose subsamples describe more bytes than are actually present in the buffer's data. This unvalidated metadata is subsequently used to create an IMFSample attribute in the MF CDM utility process, leading to a potential out-of-bounds (OOB) read or write.
Technical Details
In the MediaFoundationRenderer implementation, media data flows from the MojoDemuxerStreamImpl in the renderer process to the MojoDemuxerStreamAdapter in the MF utility process. The vulnerability arises from a lack of validation during this data flow:
- Missing Validation on Reception: When a
DecoderBufferis received via Mojo in the MF utility process,MojoDemuxerStreamAdapter::OnBufferRead(media/mojo/services/mojo_demuxer_stream_adapter.cc:127) processes the buffer but fails to callmedia::DecoderBuffer::DoSubsamplesMatch(). This helper function is used in other decryption paths (likeDecryptingVideoDecoder) to ensure that the sum of clear and encrypted bytes in the subsamples matches the buffer's data size. - Unvalidated Type Conversion: The
media::TypeConverterforDecoderBufferinmedia/mojo/common/media_type_converters.ccdeserializes the Mojo struct and populates theDecryptConfigand its subsamples without any integrity checks against the buffer's overall size. - Insecure IMFSample Creation: The unvalidated buffer is passed to
GenerateSampleFromDecoderBufferinmedia/base/win/mf_helpers.cc:673(called bymedia/renderers/win/media_foundation_stream_wrapper.cc). This function translates theDecoderBufferinto a Windows Media FoundationIMFSample. It allocates an OS-levelIMFMediaBufferof sizeN(the actual data size) and copies the data into it. - Malicious Metadata Attachment: Because the buffer is encrypted,
AddEncryptAttributes(media/base/win/mf_helpers.cc:150) is called. This helper iterates through the unvalidateddecrypt_config.subsamples()and attaches them as anMFSampleExtension_Encryption_SubSample_Mappingblob to theIMFSamplewithout any bounds checking against theNbyte data length. - OOB Memory Access: The resulting
IMFSamplecontains a memory buffer of sizeN, but the subsample mapping attribute describes a sizeM(whereM > N). When this sample is processed by a decrypting Media Foundation Transform (MFT), such as the PlayReady MFT in the MF CDM utility process, the MFT may rely on the provided subsample mapping. If the MFT iterates through this mapping without re-validating it against the buffer's actual length, it results in an OOB read. For in-place decryption (such as AES-CTR or AES-CBC), this also results in an OOB write.
Impact
An attacker who has compromised the renderer process can potentially achieve memory corruption (OOB read/write) in the Media Foundation CDM utility process. As defined in sandbox/policy/win/sandbox_win.cc:581, this process runs in a less restrictive sandbox with JobLevel::kInteractive to allow it to launch the protected media pipeline process (mfpmp.exe). Furthermore, it runs with the LPAC USER_UNPROTECTED token, granting more privileges than the renderer. Exploiting this OOB write allows the attacker to execute arbitrary code within this less-restricted context, achieving a sandbox escape and privilege escalation on Windows systems using hardware-secure EME playback.
Suggested Attack Steps
(Note: These are potential steps; our tooling agent does not have the ability to run code to provide a working PoC.)
- Compromise a renderer process and initiate encrypted media playback (e.g., via Encrypted Media Extensions) to establish a connection to the Media Foundation CDM utility process.
- Construct a malicious
media::mojom::DecoderBuffermessage to send to the utility process over themojom::DemuxerStreaminterface. - Set the
data_sizeof the MojoDecoderBufferto a valid valueN(e.g., 100 bytes). - Populate the
decrypt_configfield of the MojoDecoderBufferwith an array ofsubsampleswhere the sum ofclear_bytesandcipher_bytesequalsM, whereMis significantly larger thanN(e.g., 1000 bytes). - Send the metadata over the Mojo message pipe, and the
Nbytes of actual media data over the associated Mojo DataPipe. - The MF CDM utility process will deserialize the buffer, create an
IMFSamplewith anN-byte buffer and theM-byte subsample mapping, and pass it to a decrypting MFT, potentially triggering the OOB memory access.
Recommended Fix
The media::DecoderBuffer::DoSubsamplesMatch() check must be enforced when receiving DecoderBuffer objects from a Mojo stream in the Media Foundation renderer path. This validation should occur as soon as the data is received and reassembled from the untrusted renderer process.
Specifically, a check like if (buffer->is_encrypted() && !media::DecoderBuffer::DoSubsamplesMatch(*buffer)) should be added to MojoDemuxerStreamAdapter::OnBufferRead in media/mojo/services/mojo_demuxer_stream_adapter.cc:127. If the subsamples do not match the buffer size, the stream adapter should abort the read or fail gracefully.
Evaluated with Chrome root at commit: 4859e669de60239572397b559c17dfab074511e9
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 Media Foundation utility process fails to validate that the sum of clear and encrypted bytes in the subsample metadata matches the actual buffer data size before creating an IMFSample.
Impact
An attacker who has compromised the renderer process could achieve memory corruption in the Media Foundation CDM utility process, which runs with fewer sandbox restrictions, potentially leading to a sandbox escape and privilege escalation on Windows systems using hardware-secure EME playback.
What the attacker needed
Compromised renderer process; encrypted media playback (EME) on Windows
The fix
The fix should enforce the DoSubsamplesMatch check when receiving DecoderBuffer objects from a Mojo stream in the Media Foundation renderer path, aborting the read if the subsamples do not match the buffer size.
How it was found
- Compromise a renderer process and start encrypted media playback to connect to the Media Foundation CDM utility process.
- Construct a malicious DecoderBuffer message with a data_size of N and subsample metadata summing to M, where M is larger than N.
- Send the metadata over the Mojo message pipe and the actual N bytes of media data over the associated Mojo DataPipe.
- The utility process deserialises the buffer, creates an IMFSample with an N-byte buffer and M-byte subsample mapping, and passes it to a decrypting MFT, potentially triggering an out-of-bounds memory access.
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 process is the part of a browser that displays web pages and is kept in a sandbox for safety. If an attacker takes over the renderer, they can send crafted messages to a more privileged helper process that handles encrypted media. This report shows that the helper process trusts the message's description of how many bytes are encrypted, without checking it against the actual data size, which can lead to memory corruption and escape from 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.