Use after free in Chromecast (CVE-2026-79054)
A state-machine flaw in the Chromecast media pipeline lets a compromised renderer flush only one of the two streams, so the media backend is never stopped while the audio pipeline is treated as safely flushed. A later play request frees a buffer the backend still points at, giving a use-after-free in the unsandboxed 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential Use-After-Free (UAF) vulnerability exists in the Chromecast media pipeline due to an incorrect state-machine assumption during stream flushing. By selectively responding to flush requests, a compromised renderer can drive one stream pipeline to a flushed state while the other is still flushing, leaving the backend running. If a play request is subsequently issued, the flushed pipeline will release its references to the active buffers while the running backend continues to access them.
Affected files:
chromecast/media/cma/pipeline/media_pipeline_impl.ccchromecast/media/cma/pipeline/av_pipeline_impl.ccchromecast/media/cma/base/demuxer_stream_adapter.ccchromecast/media/common/audio_decoder_wrapper.ccchromecast/media/common/audio_decoder_software_wrapper.cc
Estimated timestamp from git blame: 2026-05-14
Description
An issue has been identified in the Chromecast media pipeline (MediaPipelineImpl and AvPipelineImpl) where a compromised renderer can cause a desynchronization of the stream flushing states, leading to a potential Use-After-Free (UAF) of reference-counted audio/video buffers in the browser process.
To prevent double-start scenarios, a state guard exists in AvPipelineImpl::StartPlayingFrom to ensure the stream is in the kFlushed state:
if (state_ != kFlushed) {
LOG(ERROR) << __FUNCTION__ << " called in unexpected state " << state_;
return false;
}
This assumes that if the stream is in the kFlushed state, the backend has been safely stopped and all currently pending buffers have been released. However, in MediaPipelineImpl::OnFlushDone, the media backend is only stopped when both the audio and video streams have finished flushing:
if (pending_flush_task_->audio_flushed &&
pending_flush_task_->video_flushed) {
media_pipeline_backend_->Stop();
backend_state_ = BACKEND_STATE_INITIALIZED;
...
}
Because per-stream flush completion is gated on the renderer answering an outstanding mojom::DemuxerStream::Read, a compromised renderer can selectively answer the audio read while stalling the video read. This drives the audio pipeline to the kFlushed state while the video pipeline remains in kFlushing. At this point, the backend is not stopped, and continues to hold a raw CastDecoderBuffer* pointer to the active audio buffer (Buffer A) under the kBufferPending contract.
In a release build, if the renderer subsequently sends a StartPlayingFrom IPC, the safety guard DCHECK(!pending_flush_task_) is stripped. The audio pipeline passes its state_ == kFlushed check, discards its reference to Buffer A (pushed_buffer_ = nullptr), and posts a FetchBuffer task. The video pipeline fails the state check and returns false, triggering OnError, but this does not stop the backend or cancel the posted audio FetchBuffer task.
When the new Buffer B is retrieved and pushed via ActiveAudioDecoderWrapper::PushBuffer (or AudioDecoderSoftwareWrapper::PushBuffer), pushed_buffer_ = std::move(buffer) overwrites the reference to Buffer A. Since this is the last scoped_refptr holding Buffer A, it is deallocated. The media backend, which was never stopped, still holds the raw pointer to Buffer A, resulting in a Use-After-Free when it next dereferences it.
Note: Our tooling currently lacks the capability to compile and execute a functional proof-of-concept exploit, so these steps are suggested based on static analysis of the source code.
Potential Trigger Path / Attack Scenario
- A compromised renderer initializes a
CastRendererwith both audio and video streams, and starts playing. - The renderer answers the first audio Read with Buffer A, returning
kBufferPendingand causing the backend to store a raw pointer to Buffer A. - The renderer stalls both the audio and video read-ahead requests.
- The renderer triggers a flush via
mojom::Renderer::Flush. Both pipelines enter thekFlushingstate. - The renderer answers only the audio read request. This transitions the audio pipeline to
kFlushed. However,MediaPipelineImpl::OnFlushDonedoes not stop the backend because the video pipeline is still flushing. - The renderer sends a
StartPlayingFromIPC request. The audio pipeline passes the state guard, drops its reference to Buffer A, and schedules aFetchBuffertask. The video pipeline fails the guard, which triggersOnErrorbut fails to stop the backend or the posted fetch task. - The audio pipeline receives a new Buffer B. When pushing Buffer B, the last reference to Buffer A is overwritten and Buffer A is freed.
- The backend eventually dereferences the raw pointer to the freed Buffer A, causing a Use-After-Free.
Impact
This leads to a Use-After-Free of a polymorphic reference-counted object (DecoderBufferBase / CastDecoderBuffer) in the unsandboxed Cast browser process (cast_shell on CastOS). An attacker who has compromised the renderer can potentially leverage this to execute arbitrary code with browser-process privileges, escaping the sandbox. On CastOS, the PartitionAllocBackupRefPtr (MiraclePtr) mitigation is disabled, leaving the vulnerability potentially fully exploitable.
Affected Files
chromecast/media/cma/pipeline/media_pipeline_impl.ccchromecast/media/cma/pipeline/av_pipeline_impl.ccchromecast/media/cma/base/demuxer_stream_adapter.ccchromecast/media/common/audio_decoder_wrapper.ccchromecast/media/common/audio_decoder_software_wrapper.cc
Suggested Fix
To prevent this state-machine bypass in production builds, enforce the flush task check in release builds by returning early or throwing an error in MediaPipelineImpl::StartPlayingFrom if a flush task is pending, rather than relying solely on a DCHECK:
if (pending_flush_task_) {
LOG(ERROR) << "StartPlayingFrom called during pending flush";
OnError(::media::PIPELINE_ERROR_ABORT);
return;
}
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
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.
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 flush-completion logic only stops the backend when both streams finish flushing, while the per-stream state guard assumes a flushed stream means the backend has stopped and released its buffers.
Impact
An attacker who has already compromised the renderer could potentially execute arbitrary code with browser-process privileges and escape the sandbox, since the MiraclePtr mitigation is disabled on CastOS; the report notes no working exploit was built.
What the attacker needed
Attacker already controls the renderer; CastOS build without MiraclePtr
The fix
The flush task check should be enforced in release builds by returning early or raising an error in StartPlayingFrom when a flush task is pending, rather than relying only on a debug assertion.
How it was found
- A compromised renderer sets up a CastRenderer with audio and video streams and starts playback.
- The renderer answers the first audio read with a buffer, so the backend keeps a raw pointer to it.
- The renderer stalls the read-ahead requests for both streams.
- The renderer triggers a flush, putting both pipelines into the flushing state.
- The renderer answers only the audio read, so audio becomes flushed while video is still flushing and the backend is not stopped.
- The renderer sends a play request; the audio pipeline drops its buffer reference and a new buffer overwrites it, freeing the old buffer the backend still points at.
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 player keeps a pointer to a chunk of audio data while it plays it. Normally, when playback is stopped, the player lets go of that data first. Here, a malicious page could make the player think it had stopped when it had not, so the data was thrown away while the player still pointed at it. Using memory that has already been freed like this can let an attacker run their own code.
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.