Use after free in Chromecast (CVE-2026-13804)
A use-after-free exists in the Chromecast media pipeline because the StartPlayingFrom IPC handler lacks state validation, allowing a compromised renderer to send consecutive StartPlayingFrom calls without a Flush. This can free a media buffer still referenced by the vendor hardware decoder, potentially leading to a sandbox escape and remote code execution in the browser process.
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 Chrome Security team.
Overview: A potential Use-After-Free vulnerability exists in the Chromecast media pipeline due to missing state guards in the StartPlayingFrom IPC handler. A compromised renderer can bypass the expected state machine by issuing consecutive StartPlayingFrom calls without flushing, prematurely freeing media buffers still in use by the vendor backend.
Affected files:
chromecast/media/cma/pipeline/av_pipeline_impl.ccmedia/mojo/services/mojo_renderer_service.ccchromecast/media/common/video_decoder_wrapper.ccchromecast/media/common/audio_decoder_wrapper.ccchromecast/media/cma/pipeline/media_pipeline_impl.ccchromecast/media/service/cast_renderer.ccchromecast/media/common/media_pipeline_backend_wrapper.cc
Estimated timestamp from git blame: 2020-07-23
Summary
A potential Use-After-Free (UAF) vulnerability exists in the browser process for Cast-enabled devices (built with ENABLE_CAST_RENDERER). The CastRenderer implementation lacks state validation when handling the StartPlayingFrom IPC. This allows a compromised renderer process to confuse the state machine and trigger a UAF of a CastDecoderBuffer inside the vendor-specific media backend.
Technical Details
In the standard Chromium media::RendererImpl, StartPlayingFrom strictly enforces that the pipeline is in a STATE_FLUSHED state. However, chromecast::media::CastRenderer and its underlying MediaPipelineImpl lack these state guards in release builds.
When an active media buffer (Buffer A) is pushed to the pipeline, AvPipelineImpl and VideoDecoderWrapper both retain scoped_refptr references to it in their respective pushed_buffer_ members. VideoDecoderWrapper then passes a raw CastDecoderBuffer* pointer to the vendor hardware decoder. The decoder queues it asynchronously and returns kBufferPending.
If a compromised renderer sends a second StartPlayingFrom IPC without a prior Flush IPC, the state machine breaks down:
AvPipelineImpl::StartPlayingFromclears its reference viapushed_buffer_ = nullptr.- The pipeline resumes the feed loop and fetches a new buffer (Buffer B) from the attacker.
VideoDecoderWrapper::PushBufferreceives Buffer B and overwrites its reference:pushed_buffer_ = std::move(Buffer B).- Buffer A's reference count drops to zero, and it is deallocated.
- The vendor hardware decoder still holds the raw pointer to Buffer A, leading to a UAF when it eventually accesses the memory.
Note: This bypasses MiraclePtr (BackupRefPtr) protections because the dangling raw pointer is held within an unmanaged, third-party vendor library.
Potential Reproduction Steps
Note: These are suggested steps based on static analysis; our tooling agent does not yet have the ability to run code and provide a working proof of concept.
- A compromised renderer process provisions a
CastRendererin the browser process via Mojo. - The renderer sets up the pipeline with an attacker-controlled Mojo demuxer stream.
- The renderer sends a
StartPlayingFrom(t0)IPC and feeds Buffer A to the pipeline. - The vendor decoder receives the raw pointer to Buffer A and begins asynchronous processing (
kBufferPending). - Before Buffer A completes, the renderer maliciously sends a second
StartPlayingFrom(t1)IPC without sending aFlushIPC first. - The renderer immediately feeds Buffer B.
- The browser process drops all
scoped_refptrreferences to Buffer A, freeing the memory. - The renderer performs a heap spray (e.g., sending many small
media::DecoderBuffers over Mojo) to reclaim Buffer A's memory with controlled data. - The vendor backend dereferences the raw pointer to Buffer A, hitting the attacker's payload and resulting in a control-flow hijack (Sandbox Escape / RCE in the Browser Process).
Suggested Fix
Introduce strict state validation in CastRenderer::StartPlayingFrom to enforce that the pipeline must be in a Flushed or Uninitialized state before starting playback. If a StartPlayingFrom IPC is received while the pipeline is already playing or has pending buffers, it should be treated as a bad message (e.g., using mojo::ReportBadMessage) and the renderer process should be terminated.
Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b
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 CastRenderer's StartPlayingFrom IPC handler does not enforce that the pipeline is in a flushed state before starting playback, unlike the standard RendererImpl.
Impact
A compromised renderer could potentially escape the sandbox and achieve remote code execution in the browser process, though the report notes this is a potential issue based on static analysis and no working exploit was demonstrated.
What the attacker needed
Compromised renderer process; Cast-enabled device with ENABLE_CAST_RENDERER
The fix
The fix should add strict state validation in CastRenderer::StartPlayingFrom to require a flushed or uninitialized state and treat invalid calls as bad messages, terminating the renderer.
How it was found
- A compromised renderer provisions a CastRenderer in the browser process via Mojo.
- The renderer sets up the pipeline with an attacker-controlled Mojo demuxer stream.
- The renderer sends a StartPlayingFrom(t0) IPC and feeds Buffer A to the pipeline.
- The vendor decoder receives the raw pointer to Buffer A and begins asynchronous processing.
- Before Buffer A completes, the renderer sends a second StartPlayingFrom(t1) IPC without sending a Flush IPC first.
- The renderer immediately feeds Buffer B, causing Buffer A to be freed while the vendor decoder still holds a raw pointer to it.
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 use-after-free happens when a program frees memory but keeps using it, like deleting a file while another program still reads it. Here, a malicious web page (running in a restricted part of the browser) can trick the media player into freeing a video buffer too early, while the hardware decoder still holds a pointer to it. The attacker could then fill that freed memory with their own data and hijack the browser process.
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.