Use after free in Core (CVE-2026-8574)
A race condition between the asynchronous dismissal of the Android colour picker dialog and the synchronous destruction of the native ColorPickerBridge object can leave a dangling pointer in the Java implementation. A compromised renderer could exploit this to achieve arbitrary code execution in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 50 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 Android Browser process. A race condition between the asynchronous dismissal of the Android color picker dialog and the synchronous destruction of the native ColorPickerBridge object can leave a dangling C++ pointer in the Java implementation, which is subsequently dereferenced.
Affected files:
components/embedder_support/android/delegate/color_picker_bridge.cccomponents/embedder_support/android/java/src/org/chromium/components/embedder_support/delegate/ColorPickerBridge.javacontent/browser/web_contents/web_contents_impl.cccomponents/embedder_support/android/delegate/color_picker_bridge.h
Estimated timestamp from git blame: 2026-01-13
Description
A potential Use-After-Free (UAF) vulnerability exists in the Android Browser process due to a race condition between the asynchronous dismissal of an Android AlertDialog and the renderer-initiated destruction of the ColorPickerBridge object.
In the Android implementation of the color picker, ColorPickerBridge.java stores a native pointer to its corresponding C++ object in a final long mNativeDialog field (line 30). When a user cancels the dialog (e.g., by pressing the Back button), Android's Dialog.cancel() enqueues an OnCancelListener callback as a message in the main Looper. This callback is processed asynchronously on the UI thread.
Root Cause
A compromised renderer can exploit the window between the dialog dismissal and the execution of the asynchronous callback by triggering the destruction of the ColorPickerBridge.
A renderer can repeatedly call blink::mojom::ColorChooserFactory::OpenColorChooser. In WebContentsImpl::OpenColorChooser, the call to color_chooser_holder_.reset() unconditionally destroys the previous chooser and its associated native ColorPickerBridge object.
When the native ColorPickerBridge is destroyed, its memory is freed. However, the Java-side mNativeDialog pointer is not invalidated and continues to point to the now-freed memory.
Potential Exploitation Scenario
These are suggested steps, as this AI agent does not yet have the ability to run code to confirm a working exploit.
- A compromised renderer opens a color picker dialog.
- The user dismisses the dialog (e.g., via the Back key). The
OnCancelListenermessage is enqueued to the main Looper. - The renderer immediately spams
OpenColorChooserMojo messages. One of these is processed before the dismissal message, causingWebContentsImplto reset the current chooser and free the nativeColorPickerBridgememory. - The attacker performs a heap spray to reclaim the freed memory (approximately 32 bytes) and places a controlled value at the offset of the
web_contents_field. - The queued Java cancel-listener finally fires, calling
onDialogDismissed(line 65), which invokes the JNI methodonColorChosen(mNativeDialog, ...). - The native JNI stub calls
OnColorChosenusing the stalemNativeDialogpointer. ColorPickerBridge::OnColorChosenreads the attacker-controlledweb_contents_value and performs a virtual call (DidChooseColorInColorChooser) through an attacker-controlled vtable. This could lead to arbitrary code execution (RCE) in the browser process.
Mitigation Analysis
This issue is not mitigated by MiraclePtr (BackupRefPtr). The UAF occurs on the ColorPickerBridge object itself (the "container"). The raw_ptr<WebContents> web_contents_ field resides within the freed memory. Because the attacker-controlled data is loaded as the raw_ptr value before the virtual call dispatch, the internal reference counting and quarantine mechanisms that protect the pointee of a raw_ptr are bypassed if the attacker points the fake pointer outside the BRP pool.
Suggested Fix
Add a clearNativePtr() method to the Java ColorPickerBridge class that sets mNativeDialog to 0. Call this method from the C++ ColorPickerBridge destructor via JNI. Additionally, check if mNativeDialog is non-zero before invoking JNI methods in Java.
Evaluated with Chrome root at commit: 0eb4855bda702feaaa8b899336664f97e3df88b8
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 Java ColorPickerBridge holds a native pointer that is not invalidated when the C++ object is destroyed, and a race allows the pointer to be used after free.
Impact
This could lead to arbitrary code execution (RCE) in the browser process.
What the attacker needed
Compromised renderer; user dismisses dialog; race condition won
The fix
Add a clearNativePtr() method to the Java ColorPickerBridge class that sets mNativeDialog to 0, call it from the C++ destructor via JNI, and check if mNativeDialog is non-zero before invoking JNI methods in Java.
How it was found
- A compromised renderer opens a colour picker dialog.
- The user dismisses the dialog, enqueuing an OnCancelListener message.
- The renderer spams OpenColorChooser messages to free the native object.
- The attacker performs a heap spray to reclaim the freed memory.
- The queued cancel-listener fires and calls onDialogDismissed.
- The native JNI stub uses the stale pointer, leading to a virtual call through attacker-controlled vtable.
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 memory but keeps using a pointer to it. Here, a dialog's native object is freed while Java still holds its address, so later use can crash or run attacker code. The attacker needs a compromised renderer to trigger the race.
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.