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

Use after free in Bluetooth (CVE-2026-13878)

A use-after-free write occurs in BluetoothSocketMac::Send because the active_async_writes counter is incremented after a potentially synchronous WriteAsync callback has already freed the SendRequest object. An attacker could trigger a predictable browser process crash (denial of service) by sending a large payload over Web Serial to a Bluetooth device.

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 without the security team.

Overview: A Use-After-Free (UAF) and subsequent CHECK crash can occur in BluetoothSocketMac::Send on macOS. The issue arises because the active_async_writes counter is incremented after a potentially synchronous WriteAsync callback has already destroyed the SendRequest object, leading to a write-after-free and a predictable browser process crash (DoS).

Affected files:

  • device/bluetooth/bluetooth_socket_mac.mm
  • services/device/serial/bluetooth_serial_port_impl.cc

Estimated timestamp from git blame: 2020-07-13

Summary

A Use-After-Free (UAF) vulnerability exists in BluetoothSocketMac::Send (device/bluetooth/bluetooth_socket_mac.mm). The issue is caused by incorrect state management when the macOS IOBluetooth framework executes an asynchronous write completion delegate synchronously. While this leads to a write-after-free, Chromium's object lifetime semantics and internal checks safely catch the resulting state corruption, turning this into a Denial of Service (DoS) (browser process crash) rather than an exploitable RCE.

Technical Details

In BluetoothSocketMac::Send, the code loops to chunk data and initiates asynchronous writes using channel_->WriteAsync. The counter tracking active writes is incremented only after the WriteAsync call returns:

C++
// device/bluetooth/bluetooth_socket_mac.mm
778:    IOReturn status =
779:        channel_->WriteAsync(send_buffer->data(), byte_count, request_ptr);
...
799:    request_ptr->active_async_writes++;

Under specific conditions on macOS, IOBluetooth can dispatch the completion delegate (rfcommChannelWriteComplete:refcon:status:) synchronously before returning to the caller. When this happens:

  1. BluetoothSocketMac::OnChannelWriteComplete executes while request_ptr->active_async_writes is still 0.
  2. The counter is decremented to -1.
  3. Because the counter is less than 1, the SendRequest is moved from send_queue_ into a local std::unique_ptr and popped from the queue.
  4. The success_callback is executed inline.
  5. OnChannelWriteComplete returns, destroying the local std::unique_ptr and freeing the SendRequest memory.
  6. Execution resumes in Send immediately after the WriteAsync call.
  7. At line 799, request_ptr->active_async_writes++ increments a field on the now-freed object, constituting a UAF write.

If the data payload was larger than the MTU, the while loop continues to a second iteration. It calls WriteAsync again, passing the dangling request_ptr as the refcon. If this second call also completes synchronously, OnChannelWriteComplete is re-entered.

At line 811, CHECK_EQ(static_cast<SendRequest*>(refcon), request_ptr) attempts to verify the refcon against the front of the queue. Because the original request was popped during the first iteration, the queue is either empty (undefined behavior) or contains a new request pushed by a re-entrant Send during the success_callback. Because the original request was kept alive during the first success_callback by the local std::unique_ptr, its memory address cannot have been reused for the new request. Thus, the CHECK_EQ predictably fails, causing a safe browser crash (DoS).

Potential Trigger Steps

  1. A malicious website requests and is granted Web Serial API permissions to a Bluetooth device.
  2. The compromised renderer process calls SerialPort::write() with a data payload strictly larger than the Bluetooth MTU.
  3. The macOS Bluetooth stack processes the first chunk synchronously, triggering the UAF and the sequence described above.
  4. The browser process crashes with a CHECK failure on the second chunk's synchronous completion.

Suggested Fix

The vulnerability can be resolved by incrementing active_async_writes before initiating the write operation, and decrementing it upon failure, ensuring the object is not prematurely destroyed by synchronous callbacks:

C++
    request_ptr->active_async_writes++;
    IOReturn status =
        channel_->WriteAsync(send_buffer->data(), byte_count, request_ptr);

    if (status != kIOReturnSuccess) {
      request_ptr->active_async_writes--;
      ...

Alternatively, OnChannelWriteComplete could unconditionally post its work to the current sequence task runner, strictly enforcing asynchronous completion semantics.

Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33


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.

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

The active_async_writes counter is incremented after the WriteAsync call, so a synchronous completion callback can free the SendRequest before the increment, leading to a write to freed memory.

Impact

The issue leads to a predictable browser process crash (denial of service) rather than exploitable remote code execution, because Chromium's internal checks catch the state corruption.

What the attacker needed

MacOS with Bluetooth; Web Serial permission granted; payload larger than Bluetooth MTU

The fix

The fix is to increment active_async_writes before initiating the write and decrement it on failure, or to post completion work asynchronously.

How it was found

  1. A malicious website requests and is granted Web Serial API permissions to a Bluetooth device.
  2. The renderer calls SerialPort::write() with a payload larger than the Bluetooth MTU.
  3. The macOS Bluetooth stack processes the first chunk synchronously, triggering the use-after-free.
  4. The browser process crashes with a CHECK failure on the second chunk's synchronous completion.

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 keeps using a piece of memory after it has been freed. Here, a counter is updated too late, so the code writes to memory that has already been released, which crashes the browser. The report says this only causes a crash, not a way to run attacker 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.

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.