Skip to content
Memory corruption Advisory Advanced CVE-2026-10014

Use after free in WebMIDI (CVE-2026-10014)

Access to the MIDI output port vector in MidiManagerAndroid was not synchronised between the Android UI thread and the Chrome IO thread, so a device attach could reallocate the vector while the IO thread was reading it. This could cause a use-after-free of the vector's backing store, which the report suggests might be escalated to JNI type confusion in the browser process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 9 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A race condition in MidiManagerAndroid allows for a potential Use-After-Free (UAF) on a vector's backing store due to unsynchronized access between the Android UI and Chrome IO threads. This vulnerability could be leveraged to achieve JNI type confusion within the browser process. The issue stems from mutating MIDI port vectors during device attachment while concurrently reading them to dispatch MIDI data.

Affected files:

  • media/midi/midi_manager_android.cc
  • media/midi/midi_manager_android.h

Estimated timestamp from git blame: Unknown (Google3 checkout)

Summary

A potential race condition exists in MidiManagerAndroid because access to the all_output_ports_ vector is not synchronized between the Android UI thread and the Chrome IO thread. This can result in a Use-After-Free (UAF) during vector reallocation, which may lead to JNI type confusion in the unsandboxed browser process.

Technical Details

MidiManagerAndroid manages MIDI output ports using a std::vector<raw_ptr<MidiOutputPortAndroid>> all_output_ports_. While the class defines a base::Lock lock_, this lock is not acquired during many critical operations on the port vectors.

1. Mutation on the UI Thread: When a MIDI device is attached, the Android framework triggers JNI callbacks on the UI thread. This eventually calls MidiManagerAndroid::OnAttached (in media/midi/midi_manager_android.cc), which invokes AddDevice. Inside AddDevice, the code performs all_output_ports_.push_back(port.get()) without any locking.

2. Concurrent Read on the IO Thread: Renderer-initiated MIDI data transfers (via Mojo SendData) are handled by MidiHost on the IO thread. This calls MidiManagerAndroid::DispatchSendMidiData, which reads from the vector using all_output_ports_[port_index] to retrieve a port pointer, also without holding a lock.

3. The Race and UAF: If the push_back on the UI thread triggers a vector reallocation, the vector's internal backing storage is deallocated and replaced. If the IO thread is concurrently reading from the vector, it may access the old storage after it has been freed.

Notably, while the elements are raw_ptr, MiraclePtr (BackupRefPtr) protects the objects the pointers point to, but not the internal backing array of the std::vector itself. Thus, the UAF occurs on the buffer containing the pointers.

Potential Exploitation Primitive

An attacker could potentially escalate this UAF to JNI type confusion:

  1. Pointer Capture: The IO thread reads a garbage value from the freed vector storage and binds it as a base::Unretained pointer into a delayed task.
  2. Heap Reclamation: By providing a timestamp in the Mojo call, the renderer can delay the task's execution, creating a window to spray the browser process heap and reclaim the freed storage with controlled data.
  3. JNI Type Confusion: When the task executes, it calls MidiOutputPortAndroid::Send on the controlled pointer. This method reads a jobject handle from offset 0 (the location of ScopedJavaGlobalRef<jobject> raw_port_) and passes it to Java_MidiOutputPortAndroid_send. This allows the attacker to invoke JNI methods using an arbitrary object handle.

Suggested Potential Steps to Trigger

Note: These steps are theoretical as our tooling cannot currently execute code.

  1. A compromised renderer process obtains MIDI permissions.
  2. The renderer begins a high-frequency stream of MIDI data to an existing port.
  3. Simultaneously, an external event (such as a malicious App cycling virtual MIDI devices on the same Android device) triggers frequent MIDI device-attach notifications.
  4. The resulting race triggers a vector reallocation in AddDevice while DispatchSendMidiData is active.
  5. The attacker attempts to groom the browser heap to control the contents of the freed vector buffer during the reallocation window.

Suggested Fix

Ensure that all accesses (reads and writes) to all_input_ports_, all_output_ports_, and their associated index maps in MidiManagerAndroid are protected by a base::Lock. The existing lock_ in the class should be utilized for this purpose.

Evaluated with Chrome root at commit: 29093e11cf509e3593f6229e4b1b075cca356049


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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 class's existing lock was not taken around reads and writes of the port vectors, so a push_back reallocation on the UI thread could free storage the IO thread was still reading.

Impact

The report claims this could potentially lead to JNI type confusion in the unsandboxed browser process, but the steps are theoretical and the tooling could not execute code to confirm it.

What the attacker needed

Compromised renderer; MIDI permissions granted; attacker can cycle virtual MIDI devices

The fix

All reads and writes of the port vectors and their index maps should be protected by the class's existing lock.

How it was found

  1. A compromised renderer obtains MIDI permissions.
  2. The renderer streams MIDI data to an existing port at high frequency.
  3. At the same time, frequent MIDI device-attach events are triggered on the Android device.
  4. The race causes a vector reallocation in AddDevice while DispatchSendMidiData is reading the vector.
  5. The attacker tries to groom the browser heap to control the freed vector buffer.

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 program keeps a list of MIDI devices in memory. One part of the browser adds a device to the list while another part reads it at the same time, and adding can move the list to a new memory location, leaving the reader looking at freed memory. Reading freed memory can crash the browser or, in theory, let an attacker influence what is read.

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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.