Use after free in Chromecast (CVE-2026-79202)
Several Chromecast renderer binding classes invoke page-supplied JavaScript callbacks and then write to their own member variables without checking whether the object still exists. If the callback detaches its own subframe, the binding deletes itself and the later write touches freed heap memory, a use-after-free write.
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: Multiple Chromecast CastBinding renderer subclasses synchronously invoke page-supplied JavaScript callbacks and subsequently write to their member variables without checking if the instance is still alive. If the callback synchronously detaches its own subframe, the CastBinding instance self-deletes, leading to a heap use-after-free (UAF) write.
Affected files:
chromecast/renderer/cast_window_manager_bindings.ccchromecast/renderer/settings_ui_bindings.ccchromecast/renderer/cast_demo_bindings.cc
Estimated timestamp from git blame: 2021-10-12
Detailed Description
There is a potential Use-After-Free (UAF) write vulnerability in several CastBinding subclasses (CastWindowManagerBindings, SettingsUiBindings, and CastDemoBindings) in the Chromecast renderer process.
All CastBinding subclasses are content::RenderFrameObservers that manage their own lifetime. They synchronously self-delete when their associated RenderFrame is destroyed:
// chromecast/renderer/native_bindings_helper.cc
void CastBinding::OnDestruct() {
delete this;
}
When page-supplied JavaScript registers a callback via these native bindings, the binding saves it as a v8::UniquePersistent<v8::Function>. Upon certain browser events or Mojo triggers, the binding retrieves this persistent handle and synchronously invokes the callback via v8::Function::Call().
However, there are at least five locations in these subclasses where a member of this is modified after the synchronous Call() execution completes without a liveness check. If the running JavaScript callback synchronously detaches its own subframe (e.g., via frameElement.remove()), the RenderFrame is destroyed, which synchronously calls OnDestruct() and deletes the CastBinding instance. When the execution returns to the C++ caller, the subsequent member write results in a heap UAF write.
Vulnerable Instances
-
CastWindowManagerBindings::OnBackGestureInchromecast/renderer/cast_window_manager_bindings.cc:C++ auto result = handler->Call(context, context->Global(), 0, nullptr); on_back_gesture_callback_ = v8::UniquePersistent<v8::Function>(isolate, handler); // UAF write -
CastWindowManagerBindings::InvokeV8Callback(Both overloads) Inchromecast/renderer/cast_window_manager_bindings.cc:C++ v8::MaybeLocal<v8::Value> maybe_result = handler->Call(context, context->Global(), args.size(), args.data()); *callback_function = v8::UniquePersistent<v8::Function>(isolate, handler); // UAF write -
CastDemoBindings::VolumeChangedInchromecast/renderer/cast_demo_bindings.cc:C++ v8::MaybeLocal<v8::Value> maybe_result = handler->Call(context, context->Global(), args.size(), args.data()); volume_change_handler_ = v8::UniquePersistent<v8::Function>(isolate, handler); // UAF write -
SettingsUiBindings::HandleSideSwipeInchromecast/renderer/settings_ui_bindings.cc:C++ v8::MaybeLocal<v8::Value> maybe_result = handler->Call(context, context->Global(), args.size(), args.data()); side_swipe_handler_ = v8::UniquePersistent<v8::Function>(isolate, handler); // UAF write -
SettingsUiBindings::SendPlatformInfoInchromecast/renderer/settings_ui_bindings.cc:C++ v8::MaybeLocal<v8::Value> maybe_result = handler->Call(context, context->Global(), args.size(), args.data()); platform_info_handler_ = v8::UniquePersistent<v8::Function>(isolate, handler); // UAF writeAdditionally, if triggered from JS via
SetPlatformInfoHandler():C++ if (!pending_platform_info_json_.empty()) { SendPlatformInfo(pending_platform_info_json_); pending_platform_info_json_.clear(); // Second UAF write on freed std::string }
Potential Trigger Steps
Note: These are suggested steps from manual code review. Our tooling does not currently have the capability to run code to confirm a working Proof of Concept.
-
Load a same-origin subframe in a Cast application environment that has feature flags (like system gestures or settings UI Mojo) enabled.
-
In the subframe's JavaScript context, register a callback with the binding interface, such as:
JavaScript cast.__platform__.windowManager.onTapGesture(() => { frameElement.remove(); // Synchronously detaches subframe and deletes the binding }); -
Trigger the corresponding event (e.g., simulating a tap gesture or calling a Gin-bound method that leads to the callback execution).
-
During the synchronous callback execution,
frameElement.remove()will triggerRenderFrameImpl::FrameDetached()->delete this, which in turn triggersCastBinding::OnDestruct()->delete thison the binding subclass instance. -
When V8 returns control to C++, the subclass code attempts to update its member variables (e.g., moving
v8::UniquePersistentor callingstd::string::clear()), corrupting the freed memory space.
Suggested Fix
To safely resolve this, use a weak pointer liveness check before accessing or modifying any member variables of the CastBinding subclass after returning from synchronous JavaScript execution.
Add a base::WeakPtrFactory to the binding subclasses and modify the callbacks to check the liveness of this:
base::WeakPtr<CastWindowManagerBindings> weak_this = weak_factory_.GetWeakPtr();
v8::MaybeLocal<v8::Value> maybe_result =
handler->Call(context, context->Global(), 0, nullptr);
if (!weak_this) {
return; // The frame and binding have been deleted
}
*callback_function = v8::UniquePersistent<v8::Function>(isolate, handler);
Evaluated with Chrome root at commit: 3947e01999a53d4e2382e39736cb79d79c7dffcf
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 binding classes call into JavaScript synchronously and then modify their own members without a liveness check, even though the callback can trigger their own destruction.
Impact
A heap use-after-free write could corrupt memory in the renderer process, though the report only describes a potential issue from code review and no exploit was run.
What the attacker needed
Cast app with feature flags enabled; same-origin subframe; attacker-controlled JavaScript in that frame
The fix
The binding subclasses should hold a weak pointer and check that the instance is still alive after the synchronous JavaScript call before touching any members.
How it was found
- Load a same-origin subframe in a Cast environment with the relevant feature flags enabled.
- Register a callback through the binding interface that detaches its own subframe.
- Trigger the event that causes the binding to invoke the callback.
- The detach destroys the render frame and the binding instance.
- When control returns to C++, the member write lands on freed memory.
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 a piece of memory and then keeps using it. Here a page's JavaScript can cause the object holding the callback to be destroyed while the C++ code is still running, so the next line writes into memory that no longer belongs to it. The report is from code review only, so no working exploit was demonstrated.
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.