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

Use after free in Media (CVE-2026-12462)

In release builds, the decoder deinitialisation routine only checked for pending DataPipe reads with a debug-only assertion, so a compromised renderer could stall a read, deinitialise the decoder, then release the read to run decode calls on a freed decoder. This could cause a use-after-free in the sandboxed CDM utility process, potentially leading to code execution there.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 19 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential state machine bypass exists in MojoDecryptorService because DeinitializeDecoder fails to cancel or flush pending reads from its Mojo DataPipe in release builds. A compromised renderer can stall a decrypt-and-decode operation, deinitialize the CDM decoder, and then unblock the DataPipe to trigger decode operations on the deinitialized CDM instance. This violates the CDM API contract and could lead to a Use-After-Free (UAF) inside the sandboxed CDM utility process.

Affected files:

  • media/mojo/services/mojo_decryptor_service.cc

Estimated timestamp from git blame: 2017-12-14

Summary

A potential state machine bypass exists in MojoDecryptorService where DeinitializeDecoder fails to ensure that pending DataPipe read operations are flushed or cancelled in release builds. This allows a compromised renderer to potentially trigger decrypt-and-decode operations on a Content Decryption Module (CDM) decoder after it has already been deinitialized, violating the CDM API contract and potentially causing a Use-After-Free (UAF) in the sandboxed CDM utility process.

Vulnerability Analysis

In media/mojo/services/mojo_decryptor_service.cc, the method ResetDecoder correctly flushes pending reads before forwarding the request to the decryptor:

C++
void MojoDecryptorService::ResetDecoder(StreamType stream_type) {
  DVLOG(2) << __func__ << ": stream_type = " << stream_type;

  MojoDecoderBufferReader* reader = GetBufferReader(stream_type);
  if (!reader) {
    CHECK(mojo::IsInMessageDispatch());
    mojo::ReportBadMessage("Unexpected stream_type");
    return;
  }

  reader->Flush(base::BindOnce(&MojoDecryptorService::OnReaderFlushDone,
                               weak_this_, stream_type));
}

However, DeinitializeDecoder only asserts that no reads are pending via a debug-only DCHECK:

C++
void MojoDecryptorService::DeinitializeDecoder(StreamType stream_type) {
  DVLOG(2) << __func__;
  auto* reader = GetBufferReader(stream_type);
  if (!reader) {
    CHECK(mojo::IsInMessageDispatch());
    mojo::ReportBadMessage("Unexpected stream_type");
    return;
  }

  DCHECK(!reader->HasPendingReads())
      << "The decoder should be fully flushed before deinitialized.";

  decryptor_->DeinitializeDecoder(stream_type);
}

In official release builds, DCHECK(!reader->HasPendingReads()) is compiled out. Consequently, DeinitializeDecoder acts as a direct, unvalidated forward to the underlying CdmAdapter and library CDM without ensuring that pending read callbacks are flushed, completed, or cancelled.

Neither MojoDecryptorService nor CdmAdapter keeps track of the deinitialization state or blocks subsequent decoding attempts.

Potential Attack Path

A compromised renderer with control over the Mojo IPC could potentially exploit this behavior via the following sequence (note that these are potential/suggested steps, as our tooling does not currently support code execution or running functional proof of concepts):

  1. Initialization: The compromised renderer invokes InitializeAudioDecoder (or InitializeVideoDecoder) via the mojom::Decryptor Mojo interface to allocate and set up decoder state in the library CDM.
  2. Stall Decode: The renderer calls DecryptAndDecodeAudio (or DecryptAndDecodeVideo) with a non-zero buffer size but intentionally holds back writing any bytes to the Mojo DataPipe producer. On the service side, ProcessPendingReads receives MOJO_RESULT_SHOULD_WAIT and arms the watcher, leaving the read callback queued asynchronously in pending_read_cbs_ indefinitely.
  3. Deinitialize: The renderer sends a DeinitializeDecoder IPC request. Because the DCHECK is stripped in release builds, this proceeds immediately and calls cdm_->DeinitializeDecoder on the library CDM, causing it to deinitialize its decoder and free internal decoder contexts.
  4. Trigger Decode: The renderer finally writes the withheld bytes to the Mojo DataPipe. This triggers the readable watcher, completes the pending read, and executes the queued read callback. This callback then invokes DecryptAndDecodeAudio -> CdmAdapter::DecryptAndDecodeAudio -> cdm_->DecryptAndDecodeSamples() on the library CDM, which was already deinitialized.

Potential Impact

This sequence violates the CDM API contract (media/cdm/api/content_decryption_module.h), which requires a successful initialization prior to any decrypt-and-decode call.

  • ClearKey CDM (Testing): In the test CDM, this results in a null-pointer dereference of decoding_loop_ in FFmpegCdmAudioDecoder::DecodeBuffer (within ffmpeg_cdm_audio_decoder.cc).
  • Widevine CDM (Production - Closed-source): Deinitialization typically frees heap-allocated decoder contexts. Accessing DecryptAndDecodeSamples or DecryptAndDecodeFrame after deinitialization can result in a Use-After-Free (UAF) of these freed contexts on the CDM utility process heap. Since these library CDMs do not run with MiraclePtr protection, such UAFs can potentially be leveraged for Remote Code Execution (RCE) inside the sandboxed CDM utility process.

Suggested Fix

Modify MojoDecryptorService::DeinitializeDecoder to handle pending reads safely at runtime in release builds. It should either follow an asynchronous flush paradigm similar to ResetDecoder before invoking decryptor_->DeinitializeDecoder(stream_type), or apply a runtime check that rejects the operation or returns a bad message if reader->HasPendingReads() is true:

C++
void MojoDecryptorService::DeinitializeDecoder(StreamType stream_type) {
  DVLOG(2) << __func__;
  auto* reader = GetBufferReader(stream_type);
  if (!reader) {
    CHECK(mojo::IsInMessageDispatch());
    mojo::ReportBadMessage("Unexpected stream_type");
    return;
  }

  if (reader->HasPendingReads()) {
    CHECK(mojo::IsInMessageDispatch());
    mojo::ReportBadMessage("Decoder has pending reads during deinitialization");
    return;
  }

  decryptor_->DeinitializeDecoder(stream_type);
}

Evaluated with Chrome root at commit: 5133b93d189b383c37805b1cf3a9d2dbfe8d7379


Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:

  • If you are familiar with the severity guidelines, you may adjust the severity.
  • If this is a false positive, and there's no work to be done, please close as WAI.
  • If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.

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.

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

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 deinitialisation handler relied on a debug-only assertion instead of a runtime check or flush of pending DataPipe reads before forwarding the request to the CDM.

Impact

The text claims this could cause a null-pointer dereference in the test CDM and a use-after-free in the production CDM, which could potentially be leveraged for code execution inside the sandboxed CDM utility process; the report notes no working proof of concept was run.

What the attacker needed

Compromised renderer; control over Mojo IPC messages; release build without the debug check

The fix

The deinitialisation handler should either flush pending reads asynchronously like the reset path, or reject the request at runtime when reads are still pending; the text does not say a fix was applied.

How it was found

  1. The compromised renderer initialises an audio or video decoder through the Mojo decryptor interface.
  2. It requests a decrypt-and-decode with a non-zero buffer size but withholds the bytes, leaving the read callback queued.
  3. It sends a deinitialise request, which proceeds because the pending-read check is stripped in release builds.
  4. It then writes the withheld bytes, completing the read and running decode calls on the already deinitialised decoder.

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 media component lets the browser ask a separate helper process to decrypt and decode video or audio. The helper had a safety check that only ran in test builds, so in normal builds it could be told to shut down a decoder while a request was still waiting, then finish that request against the shut-down decoder. Using memory that has already been freed like this can crash the helper or, in theory, let an attacker run their own code inside it.

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.

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.