Use after free in Core (CVE-2026-10953)
A use-after-free vulnerability exists in the browser process when processing RenderFrameMetadata, where a synchronous JNI callback can cause the embedder to destroy the WebContents, leading to the destruction of RenderWidgetHostViewAndroid while still on the stack. An attacker with renderer code execution could potentially exploit this to corrupt memory and escape the sandbox.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 40 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 without the Chrome Security team. 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 vulnerability exists in the browser process during RenderFrameMetadata processing. A compromised renderer can trigger a synchronous JNI selection callback that, if it causes the embedder to synchronously destroy the WebContents, leads to the destruction of RenderWidgetHostViewAndroid while it is still on the stack. MiraclePtr does not protect the object because all tracking raw_ptr references are explicitly cleared during destruction.
Affected files:
content/browser/renderer_host/render_widget_host_view_android.ccui/touch_selection/touch_selection_controller.cccontent/browser/renderer_host/render_frame_metadata_provider_impl.cc
Estimated timestamp from git blame: 2022-06-17
Root Cause Analysis
A potential Use-After-Free (UAF) vulnerability exists in RenderWidgetHostViewAndroid (RWHVA) due to the handling of synchronous JNI callouts during the processing of RenderFrameMetadata IPCs.
When a renderer sends new metadata via mojom::RenderFrameMetadataObserverClient, it is processed by RenderFrameMetadataProviderImpl::OnRenderFrameMetadataChanged. This iterates through its observers and dispatches to RenderWidgetHostViewAndroid::OnRenderFrameMetadataChangedBeforeActivation. This function then calls TouchSelectionController::OnSelectionBoundsChanged to update selection handles.
OnSelectionBoundsChanged can trigger selection events (e.g., SELECTION_HANDLES_CLEARED) that are dispatched to Java via JNI in SelectionPopupControllerImpl.onSelectionEvent. These Java callbacks (such as onDestroyActionMode or onSelectionEvent) allow the Android embedder to execute arbitrary code. If the embedder synchronously destroys the WebContents during this callback, the RWHVA and its members are destroyed.
Crucially, because the destruction process explicitly clears all tracking raw_ptr references (including removing the observer from RenderFrameMetadataProviderImpl's list mid-iteration, and clearing RenderWidgetHostConnector pointers), BackupRefPtr (MiraclePtr) does not quarantine the RenderWidgetHostViewAndroid memory block. It is freed immediately.
When the JNI call returns and the C++ stack unwinds, RenderWidgetHostViewAndroid::OnRenderFrameMetadataChangedBeforeActivation continues to execute, performing multiple member reads, writes, and virtual method calls on the fully freed, unquarantined memory block.
Potential Exploitation Steps
Note: These are suggested potential steps; no working proof-of-concept has been executed by this agent.
- An attacker gains arbitrary code execution in a sandboxed Renderer process (e.g., via a V8 bug).
- The attacker constructs a malicious
cc::RenderFrameMetadataIPC payload, specifically modifying theselectionfield to provide empty bounds (sostart.HasHandle()evaluates to false). - The renderer sends this IPC to the browser process.
RenderWidgetHostViewAndroid::OnRenderFrameMetadataChangedBeforeActivationreceives the metadata and triggers a selection update.- Because the bounds are empty,
TouchSelectionControllerhides the handles and fires aSELECTION_HANDLES_CLEAREDevent. - This event is forwarded synchronously over JNI to the Android Java layer.
- In Java, this triggers the destruction of the Action Mode, firing the
onDestroyActionModecallback to the Android embedder. - The embedder (e.g., a custom WebView host) reacts to this callback by synchronously destroying the
WebContents. - The
RenderWidgetHostViewAndroidis destroyed. All BRPraw_ptrtracking references are explicitly cleared viaRemoveObserverandRenderWidgetHostConnectortear-down. - The memory is returned to PartitionAlloc. The attacker uses asynchronous IPCs to spray the heap and overwrite the freed RWHVA memory block with controlled data.
- The C++ stack unwinds back to
RenderWidgetHostViewAndroid::OnRenderFrameMetadataChangedBeforeActivation, which accesses the freed and attacker-controlled memory block, resulting in memory corruption and a potential sandbox escape.
Suggested Fix
RenderWidgetHostViewAndroid::OnRenderFrameMetadataChangedBeforeActivation and the functions it calls (UpdateTouchSelectionController) should not make synchronous callouts to Java that could alter the lifecycle of the WebContents or RenderWidgetHostViewAndroid.
Consider using base::WeakPtr at the beginning of OnRenderFrameMetadataChangedBeforeActivation to check if this has been destroyed after UpdateTouchSelectionController returns, or posting the selection event updates as asynchronous tasks to the UI thread's message loop rather than executing them synchronously.
Evaluated with Chrome root at commit: 3acbde3302da0cb19488c22c0eb007c791207b4b
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 a synchronous JNI callback during RenderFrameMetadata processing can cause the embedder to destroy the WebContents, leading to the destruction of RenderWidgetHostViewAndroid while it is still on the stack, and because all tracking raw_ptr references are explicitly cleared during destruction, MiraclePtr does not protect the object.
Impact
A compromised renderer could potentially cause memory corruption and a sandbox escape.
What the attacker needed
Attacker gains code execution in renderer; embedder synchronously destroys WebContents
The fix
The fix should avoid synchronous callouts to Java that could alter the lifecycle of the WebContents, for example by using base::WeakPtr checks or posting selection event updates as asynchronous tasks.
How it was found
- An attacker gains arbitrary code execution in a sandboxed Renderer process.
- The attacker constructs a malicious RenderFrameMetadata IPC payload with empty selection bounds.
- The renderer sends this IPC to the browser process.
- The browser processes the metadata and triggers a selection update, firing a SELECTION_HANDLES_CLEARED event.
- The event is forwarded synchronously over JNI to the Android Java layer, triggering onDestroyActionMode.
- The embedder reacts by synchronously destroying the WebContents, leading to 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 report describes a memory safety bug in a web browser. When the browser processes certain information from a web page, it can trigger a callback that destroys an object, but the code continues to use that object afterwards, which can lead to memory corruption. An attacker who already controls a web page's code could potentially exploit this to break out of the browser's security sandbox.
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.