Use after free in Media (CVE-2026-11680)
MediaFoundationProtectionManager lacks a custom Release() override, so when the last COM reference is dropped on a Media Foundation threadpool thread, the object is destroyed off its bound sequence. This can race with pending tasks on the main task runner that hold weak pointers, potentially causing a use-after-free in the sandboxed utility process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 13 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: MediaFoundationProtectionManager lacks a custom Release() implementation, which allows it to be destructed on an asynchronous Media Foundation threadpool thread rather than its bound sequence. This leads to the potential cross-thread destruction of sequence-affine members such as base::CancelableOnceClosure and base::WeakPtrFactory. Consequently, a race condition occurs with pending tasks on the main task runner, potentially resulting in a Use-After-Free (UAF) vulnerability.
Affected files:
media/renderers/win/media_foundation_protection_manager.hmedia/renderers/win/media_foundation_protection_manager.cc
Estimated timestamp from git blame: 2020-03-11
Root Cause
MediaFoundationProtectionManager is a WRL RuntimeClass handed to the closed-source MFMediaEngine via IMFMediaEngineProtectedContent::SetContentProtectionManager(). MFMediaEngine retains references to it and invokes its methods asynchronously on Media Foundation (MF) threadpool threads.
Unlike its sibling COM wrappers (MediaFoundationSourceWrapper and MediaFoundationStreamWrapper), MediaFoundationProtectionManager does not override Release() to safeguard destruction on the correct sequence. When MFMediaEngine drops the last reference on an MF threadpool thread, the default WRL RuntimeClass::Release() is invoked, running the destructor off the bound sequence runner (task_runner_).
This leads to the potential cross-thread destruction of sequence-affine members:
scoped_refptr<base::SequencedTaskRunner> task_runner_;
WaitingCB waiting_cb_;
base::CancelableOnceClosure waiting_for_key_time_out_cb_; // must be destroyed on bound sequence
...
base::WeakPtrFactory<MediaFoundationProtectionManager> weak_factory_{this}; // Invalidate() must run on bound sequence
Because WeakReference::Flag::Invalidate() sequence assertions are restricted to DCHECK builds, in official/release builds the cross-thread destruction proceeds unchecked, causing a race condition with pending tasks on task_runner_ that hold live WeakPtrs.
Potential Vulnerability Mechanism
Based on static analysis, we have identified the following potential path to trigger the UAF:
- Playback of encrypted content (such as PlayReady HW-DRM) instantiates
MediaFoundationProtectionManagerand registers it withMFMediaEngineviaSetContentProtectionManager(). MFMediaEnginecallsBeginEnableContent()on an MF threadpool thread, which postsOnBeginEnableContenttotask_runner_via a weak pointer. This arms a 500 ms delayed taskOnWaitingForKeyTimeOutholding aWeakPtrinside the protection manager.- Upon player teardown (e.g. when the user navigates away or closes the media element),
~MediaFoundationRendererexecutes ontask_runner_and shuts down the media engine. However, the media engine may asynchronously retain and release itsIMFContentProtectionManagerreference on its threadpool after shutdown. - If the media engine drops its last COM reference on the MF thread pool while a delayed or queued task (e.g.,
OnWaitingForKeyTimeOut) is executing ontask_runner_, a race condition occurs. SinceWeakPtrsequence validation is disabled on release builds, the task ontask_runner_may proceed, invoking member functions onthisjust as the MF threadpool callsdelete thisvia the defaultRelease()implementation. - The active execution on
task_runner_then dereferences the freedMediaFoundationProtectionManageror its subobjects, potentially leading to a Use-After-Free (UAF) condition:
void MediaFoundationProtectionManager::OnWaitingForKeyTimeOut() {
...
waiting_for_key_time_out_cb_.Cancel(); // accesses freed CancelableCallbackImpl
waiting_cb_.Run(WaitingReason::kNoDecryptionKey); // indirect call through freed Callback bind state
}
Note: These steps are based on static analysis of the control flow and object lifecycles; our analysis tools do not currently have the capability to execute code or verify this via an active Proof of Concept.
Impact
This issue potentially leads to a use-after-free within the kMediaFoundationCdm LPAC-sandboxed utility process on Windows. If an attacker can groom or reclaim the freed allocation, they could potentially exploit this to hijack control flow and execute arbitrary code within the utility process.
Suggested Remediation
Implement a custom Release() override in MediaFoundationProtectionManager to ensure that destruction is safely routed to the designated task_runner_ via DeleteSoon if called from a different sequence, similar to sibling wrappers:
IFACEMETHODIMP_(ULONG) MediaFoundationProtectionManager::Release() {
ULONG ref_count = InternalRelease();
if (ref_count == 0) {
if (!task_runner_->RunsTasksInCurrentSequence()) {
task_runner_->DeleteSoon(FROM_HERE, this);
} else {
delete this;
}
}
return ref_count;
}
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 class does not override Release() to route destruction back to its bound task runner, so the default WRL Release() deletes the object on whatever thread drops the last reference.
Impact
If an attacker can groom or reclaim the freed allocation, they could potentially hijack control flow and execute arbitrary code within the sandboxed utility process.
What the attacker needed
Windows with Media Foundation; Playback of encrypted content; Attacker can groom freed memory
The fix
A custom Release() override should be implemented to route destruction to the bound task runner via DeleteSoon when called from a different sequence.
How it was found
- Play encrypted content, which creates MediaFoundationProtectionManager and registers it with MFMediaEngine.
- MFMediaEngine calls BeginEnableContent on a threadpool thread, which posts a task and arms a delayed timeout holding a weak pointer.
- Tear down the player, shutting down the media engine while it may still hold and release its reference asynchronously.
- The media engine drops its last reference on the threadpool while a delayed task is running on the task runner, causing a race.
- The task runner dereferences the freed object, leading to a use-after-free.
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.
This is a bug in how a Windows media component frees its memory. Normally, an object must be destroyed on the same thread that created it, but here it can be destroyed on a different thread while other code is still using it. That can lead to a use-after-free, where the program reads or writes memory that has already been freed.
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.