Use after free in Serial (CVE-2026-11012)
A data race on a hash map in the Android serial device enumerator can cause heap corruption and a use-after-free in the browser process. An attacker could potentially exploit this to escape the sandbox and run code with the browser's privileges.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: SerialDeviceEnumeratorAndroid mutates an absl::flat_hash_map concurrently from multiple background threads without synchronization. This data race can lead to heap corruption and a potential use-after-free in the highly privileged browser process. Triggering this requires the disabled-by-default Web Serial on Android feature and explicit user permission.
Affected files:
services/device/serial/serial_device_enumerator_android.ccservices/device/serial/serial_device_enumerator_android.hservices/device/serial/serial_io_handler_android.ccservices/device/serial/android/java/src/org/chromium/device/serial/ChromeSerialManager.java
Estimated timestamp from git blame: 2026-02-02
Description
There is a potential data race and memory corruption vulnerability in SerialDeviceEnumeratorAndroid due to unsynchronized access to the callbacks_ member variable, which is an absl::flat_hash_map<std::string, std::unique_ptr<Callbacks>>.
This map is mutated from at least two distinct, unsynchronized thread contexts:
- Chrome ThreadPool (
OpenPath): When a Web Serial port is opened,SerialIoHandlerAndroid::OpenImpl()posts a task usingbase::ThreadPool::PostTask({base::MayBlock(), ...})to executeSerialDeviceEnumeratorAndroid::OpenPath(). This method performsfind(),emplace(), and potentiallyextract()on thecallbacks_map. Because it uses an unsequenced task runner, concurrentport.open()requests can execute simultaneously on multiple worker threads. - Android AsyncTask Thread (
OpenPathCallbackViaJni/ErrorCallbackViaJni): When the Android OS finishes opening the port, Java invokes the completion handlers via JNI. The Java code usesAsyncTask.THREAD_POOL_EXECUTOR, meaning these JNI calls execute on an Android background thread. The C++ JNI handlers (OpenPathCallbackViaJniandErrorCallbackViaJni) directly callcallbacks_.extract()without posting back to a safe sequence.
absl::flat_hash_map is not thread-safe. Concurrent mutations—such as a ThreadPool worker performing an emplace() (which may trigger a rehash and free the backing array) while an Android worker performs an extract()—will severely corrupt the map's internal state. This leads to Heap Use-After-Free (UAF) and memory corruption.
Because the Device Service on Android runs directly in the browser process, this heap corruption provides a potential path to a sandbox escape and Remote Code Execution (RCE) with the privileges of the browser app.
Note: The kWebSerialWiredDevicesAndroid feature is currently disabled by default and requires a physical USB device and explicit user permission to trigger.
Potential Steps to Reproduce
Note: Our tooling agent cannot run live code, so these are suggested steps to trigger the race condition.
- Enable the
chrome://flags/#enable-web-serial-wired-devices-androidfeature flag. - Connect a USB-serial device to the Android device.
- Navigate to a malicious website that requests Web Serial permissions (
navigator.serial.requestPort()). - The user approves the chooser dialog.
- The malicious JavaScript acquires multiple references to the
SerialPortobject (e.g., using same-origin Web Workers or iframes). - The script concurrently calls
port.open({ baudRate: 9600 })across the workers, or rapidly initiates and aborts port openings. - This causes simultaneous
emplace()andextract()calls on theabsl::flat_hash_mapfrom Chrome's ThreadPool and Android's AsyncTask threads, triggering a crash or UAF.
Suggested Fix
Access to the callbacks_ map must be synchronized.
- Use a SequencedTaskRunner: Ensure all accesses to
callbacks_happen onSerialDeviceEnumeratorAndroid's internaltask_runner_.- Modify
SerialIoHandlerAndroid::OpenImplto post to the enumerator's specifictask_runner_instead of a genericThreadPool::PostTask. - Modify the JNI callbacks (
OpenPathCallbackViaJniandErrorCallbackViaJni) so they do not accesscallbacks_directly. Instead, they should post a task totask_runner_to handle the extraction and callback execution, similar to howAddPortViaJnihandles non-initial enumerations.
- Modify
- Alternatively, use a Mutex: Guard
callbacks_with abase::Lock, though sequence bounding is generally preferred in Chromium over manual locking.
Evaluated with Chrome root at commit: a9cbf6e8b275fe4147435aa905f3b7f5a656f5f0
Results from 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
The callbacks_ hash map is accessed and modified from two different threads without any synchronisation.
Impact
Heap corruption in the browser process could allow a sandbox escape and remote code execution, but the feature is disabled by default and requires a physical USB device and explicit user permission.
What the attacker needed
Web Serial on Android feature enabled; Physical USB-serial device connected; Victim visits malicious site; User grants serial permission
The fix
All accesses to the callbacks_ map should be moved onto the enumerator's own sequenced task runner, or alternatively guarded by a mutex.
How it was found
- Enable the Web Serial on Android feature flag.
- Connect a USB-serial device to the Android device.
- Visit a malicious site that requests Web Serial permission.
- Approve the permission dialog.
- Obtain multiple references to the serial port object from workers or iframes.
- Call port.open concurrently from those contexts to trigger the race.
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 hash map is a data structure that stores key-value pairs. If two threads change it at the same time without coordination, its internal memory can become corrupted. Here, that corruption happens inside the browser's main process, which could let an attacker 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.