Use after free in UI (CVE-2026-8511)
A use-after-free vulnerability exists in the browser process due to a raw 'this' pointer captured in a WinRT asynchronous callback within SystemMediaControlsWin::SetThumbnail. If the object is destroyed while a media artwork update is pending, the callback dereferences freed memory, potentially leading to arbitrary code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 52 days
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: A potential Use-After-Free (UAF) vulnerability exists in the browser process due to a raw this pointer capture in a WinRT asynchronous callback within SystemMediaControlsWin::SetThumbnail. If the object is destroyed while a media artwork update is pending, the callback will execute on a WinRT thread-pool thread and dereference the freed memory, potentially leading to arbitrary code execution.
Affected files:
components/system_media_controls/win/system_media_controls_win.cc
Estimated timestamp from git blame: 2021-09-08
Description
A potential Use-After-Free (UAF) vulnerability has been identified in the browser process within SystemMediaControlsWin::SetThumbnail on Windows. The issue stems from capturing a raw C++ this pointer in a Microsoft::WRL::Callback that handles the completion of an asynchronous WinRT operation.
In components/system_media_controls/win/system_media_controls_win.cc, the SetThumbnail method initiates an asynchronous write to an icon stream using icon_data_writer_->StoreAsync. A completion handler is registered via store_async_operation->put_Completed():
// components/system_media_controls/win/system_media_controls_win.cc:311
auto store_async_callback = Microsoft::WRL::Callback<
ABI::Windows::Foundation::IAsyncOperationCompletedHandler<unsigned int>>(
[this](ABI::Windows::Foundation::IAsyncOperation<unsigned int>* async_op,
ABI::Windows::Foundation::AsyncStatus status) mutable {
// ...
result = display_updater_->put_Thumbnail(icon_stream_reference_.Get());
// ...
});
The lambda captures this as a raw pointer. However, the SystemMediaControlsWin destructor does not cancel or synchronize with this pending asynchronous operation.
If the SystemMediaControlsWin object is destroyed while the write is still in flight, the WinRT runtime will eventually execute the callback, dereferencing the freed this pointer to access member variables like display_updater_ (which is a ComPtr). Because the capture is a raw pointer and no base::raw_ptr references keep the memory in MiraclePtr's quarantine, the memory is fully freed and can be reclaimed by an attacker.
Reachability and Impact
This code path is reachable via the Media Session API. When a Progressive Web App (PWA) or an app popup window plays media, Chrome creates an instanced SystemMediaControlsWin object for that specific WebContents, managed by WebAppSystemMediaControlsManager.
If an attacker's PWA sets media artwork (triggering SetThumbnail) and then immediately closes its own window (e.g., via window.close()), the underlying WebContents and its MediaSession are destroyed. This causes WebAppSystemMediaControlsManager to delete the SystemMediaControlsWin object while the WinRT async operation is still pending.
When the callback eventually runs, it attempts to make a virtual method call on the display_updater_ member of the freed object (display_updater_->put_Thumbnail(...)). By using standard heap spraying techniques in the browser process to control the freed memory chunk, an attacker could point display_updater_ to a forged vtable, achieving arbitrary Remote Code Execution (RCE) and a full Sandbox Escape.
Suggested Steps to Reproduce
Note: These are potential steps as we have not yet developed a working exploit.
- An attacker convinces a user to install a malicious website as a PWA, or opens an app popup window.
- The user launches the PWA, fulfilling
Browser::ShouldUseInstancedSystemMediaControls(). - The PWA's JavaScript starts playing an audio track (e.g.,
<audio autoplay src="...">), creating aMediaSessionand requesting audio focus. - The browser creates a
WebAppSystemMediaControlsinstance, which allocates aSystemMediaControlsWinobject. - The JavaScript updates the Media Session metadata with a large artwork image to delay the WinRT processing:
navigator.mediaSession.metadata = new MediaMetadata({ artwork: [{ src: "large.png" }] }); SystemMediaControlsWin::SetThumbnailis called, initiating the asynchronousStoreAsyncoperation and registering the vulnerable callback.- Immediately after setting the metadata (allowing ~10-20ms for debounce timers to fire), the JavaScript executes
window.close(). - The window closes, destroying the
WebContentsand causing theSystemMediaControlsWinobject to be freed. - The attacker performs a heap spray in the browser process to reclaim the freed memory with a controlled payload.
- The WinRT async operation completes, the callback executes, and the dangling
thispointer is dereferenced, leading to a virtual call on the attacker's sprayed data.
Suggested Fix
To prevent this Use-After-Free, the callback should use a base::WeakPtr instead of a raw this pointer, similar to how the ButtonPressed handler is implemented in SystemMediaControlsWin::Initialize (lines 113-125).
auto weak_ptr = weak_factory_.GetWeakPtr();
auto store_async_callback = Microsoft::WRL::Callback<
ABI::Windows::Foundation::IAsyncOperationCompletedHandler<unsigned int>>(
[weak_ptr](ABI::Windows::Foundation::IAsyncOperation<unsigned int>* async_op,
ABI::Windows::Foundation::AsyncStatus status) mutable {
if (!weak_ptr) return S_OK;
// ... safe to access weak_ptr->display_updater_ ...
});
Evaluated with Chrome root at commit: 9760e6c70cd33a320713361f17c6dcca85648c0f
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. Please feel free to reach out to me if you have concerns or feedback.
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
The callback captures a raw `this` pointer without using a weak pointer or synchronising with the object's destruction, so the callback can run after the object is freed.
Impact
An attacker could potentially achieve arbitrary Remote Code Execution (RCE) and a full Sandbox Escape, but the report notes that a working exploit has not yet been developed.
What the attacker needed
Victim installs a malicious PWA or opens an app popup; victim launches the PWA; PWA plays audio and sets large artwork; PWA closes its window immediately after
The fix
The callback should use a `base::WeakPtr` instead of a raw `this` pointer, similar to the `ButtonPressed` handler, to safely check if the object still exists before accessing it.
How it was found
- An attacker convinces a user to install a malicious website as a PWA, or opens an app popup window.
- The user launches the PWA, fulfilling `Browser::ShouldUseInstancedSystemMediaControls()`.
- The PWA's JavaScript starts playing an audio track, creating a `MediaSession` and requesting audio focus.
- The browser creates a `WebAppSystemMediaControls` instance, which allocates a `SystemMediaControlsWin` object.
- The JavaScript updates the Media Session metadata with a large artwork image to delay the WinRT processing.
- `SystemMediaControlsWin::SetThumbnail` is called, initiating the asynchronous `StoreAsync` operation and registering the vulnerable callback.
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 is a type of memory bug where a program keeps a pointer to memory after it has been freed, and then later uses it. Here, a callback function holds a raw pointer to an object that might be destroyed before the callback runs, so when the callback executes it accesses memory that is no longer valid. An attacker could try to control that freed memory to 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.