Use after free in Media (CVE-2026-106335)
A use-after-free vulnerability exists in MediaRemotingInterstitial due to a garbage collection phase ordering issue, where a timer started during pre-finalization creates a weak handle that is not cleared, leading to execution on freed memory. An attacker could potentially achieve remote code execution by spraying the heap to control the freed object's vtable.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 6 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 Use-After-Free vulnerability exists in MediaRemotingInterstitial due to an Oilpan GC phase ordering issue. A timer initiated during an HTMLMediaElement pre-finalizer creates a WeakPersistent handle after the garbage collector has already processed weak handles, allowing the timer to fire on a swept object.
Affected files:
third_party/blink/renderer/core/html/media/media_remoting_interstitial.ccthird_party/blink/renderer/core/html/media/html_media_element.ccthird_party/blink/renderer/core/html/media/html_video_element.ccthird_party/blink/renderer/platform/media/web_media_player_impl.cc
Estimated timestamp from git blame: 2025-08-26
Summary
A potential Use-After-Free (UAF) vulnerability exists in the Renderer process due to an interaction between Blink's garbage collector (Oilpan) and MediaRemotingInterstitial.
When an HTMLMediaElement is garbage collected, its pre-finalizer initiates a shutdown sequence that calls Hide() on its associated MediaRemotingInterstitial. This method starts a HeapTaskRunnerTimer. Because this timer is started during the pre-finalization phase—which occurs after Oilpan's weak processing phase (ProcessWeakness)—the newly created WeakPersistent handle is not cleared during the current GC cycle. Consequently, the task runner retains a dangling pointer to the unmarked interstitial, which is subsequently swept and its memory reclaimed. When the timer fires, execution continues on the reclaimed memory.
Technical Details & Exploitation Path
-
GC Phase Ordering Bug:
- During a full GC cycle, Oilpan first marks live objects.
- It then enters
ProcessWeakness(v8/src/heap/cppgc/marker.cc:322), clearingWeakPersistenthandles that point to unmarked objects. - Next, it calls
ExecutePreFinalizers(v8/src/heap/cppgc/heap.cc:202). HTMLMediaElementhas a pre-finalizer (Dispose) that synchronously callsweb_media_player_->Shutdown(), which then callsHTMLVideoElement::MediaRemotingStopped(), ultimately invokingremoting_interstitial_->Hide().Hide()callstoggle_interstitial_timer_.StartOneShot(), which creates a newWeakPersistentto theMediaRemotingInterstitialobject. BecauseProcessWeaknesshas already run, this weak handle is not cleared in the current cycle.- The
MediaRemotingInterstitialis then swept and its memory is freed.
-
Use-After-Free:
- 300ms later, the delayed task executes
HeapTaskRunnerTimer::RunInternalTrampoline. - The trampoline checks the
WeakPersistentpointer. Since it was never cleared, it unwraps to a non-null, dangling pointer. - The trampoline invokes
MediaRemotingInterstitial::ToggleInterstitialTimerFired()on the freed memory.
- 300ms later, the delayed task executes
-
Remote Code Execution (RCE):
- An attacker can spray the Oilpan heap to reclaim the freed
MediaRemotingInterstitialmemory, placing a forged vtable pointer at the beginning of the object and controlling its internal state. - Inside
ToggleInterstitialTimerFired, the code checksIsVisible()andstate_. By controlling the sprayed memory, the attacker can setstate_tokHidden, forcing execution into theelse if (state_ == kHidden)branch. - This branch calls
SetInlineStyleProperty(...)onthis. Element::SetInlineStylePropertyeventually callsInlineStyleChanged, which invokes the virtual methodInvalidateStyleAttribute()onthis.- This virtual call dereferences the attacker's forged vtable pointer, leading to direct Remote Code Execution within the renderer process.
- Note: Because the object is managed by Oilpan (Blink GC), it is not protected by MiraclePtr (BackupRefPtr), which primarily protects PartitionAlloc allocations.
- An attacker can spray the Oilpan heap to reclaim the freed
Suggested Reproduction Steps
Note: These are potential steps as our tooling agent cannot execute code to verify the PoC directly.
- Create an
<video>element with a playable source via JavaScript. - Trigger Media Remoting (e.g.,
video.remote.prompt()) so theMediaRemotingInterstitialis created and reachesstate_ == kVisible. - Pause the video, remove it from the DOM, and drop all JavaScript references to the element.
- Force a full garbage collection (e.g., by allocating large
ArrayBuffers). - Spray the Oilpan heap with objects containing a forged vtable to reclaim the interstitial's memory.
- Wait >300ms for the
toggle_interstitial_timer_to fire.
Suggested Fix
The core issue is that MediaRemotingInterstitial holds a timer that can be started during its destruction sequence but is never explicitly stopped when the object is swept.
We recommend adding a pre-finalizer to MediaRemotingInterstitial that explicitly stops the timer:
// media_remoting_interstitial.h
class MediaRemotingInterstitial final : public HTMLDivElement {
USING_PRE_FINALIZER(MediaRemotingInterstitial, Dispose);
// ...
void Dispose();
};
// media_remoting_interstitial.cc
void MediaRemotingInterstitial::Dispose() {
toggle_interstitial_timer_.Stop();
}
Alternatively, ToggleInterstitialTimerFired could check if the object is still alive or valid, though explicit cleanup via a pre-finalizer is the standard approach in Blink for objects holding active timers.
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 root cause is that MediaRemotingInterstitial starts a timer during the pre-finalization phase, after weak handles have been processed, so the timer's weak reference is not cleared and later fires on freed memory.
Impact
An attacker could potentially achieve remote code execution within the renderer process by controlling the freed memory and hijacking a virtual call.
What the attacker needed
Victim visits a malicious page; browser supports Media Remoting
The fix
The fix should add a pre-finalizer to MediaRemotingInterstitial that explicitly stops the timer.
How it was found
- Create a video element with a playable source via JavaScript.
- Trigger Media Remoting so the MediaRemotingInterstitial is created and reaches state_ == kVisible.
- Pause the video, remove it from the DOM, and drop all JavaScript references to the element.
- Force a full garbage collection (e.g., by allocating large ArrayBuffers).
- Spray the Oilpan heap with objects containing a forged vtable to reclaim the interstitial's memory.
- Wait >300ms for the toggle_interstitial_timer_ to fire.
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 report describes a memory safety bug in a web browser's media component. When an object is cleaned up by the garbage collector, a timer is started that later tries to use the already-freed object, which could let an attacker run their own code. The bug is in how the cleanup phases are ordered, so the timer's reference isn't cleared in time.
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.