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

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

A use-after-free exists in Chromium's macOS Bluetooth L2CAP code because the delegate object is not unregistered from the native channel when an outgoing connection closes. An attacker could potentially trigger the freed delegate with late events and, via heap spraying, gain code execution in the browser process.

Google Chrome

Originally disclosed on Chrome VRP

Critical View original
  • Fix shipped in 36 days

Flapjack, 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 go/chrome-ai-generated-security-bugs-faq for more information.

Overview: A potential Use-After-Free vulnerability exists in the macOS Bluetooth L2CAP implementation due to a failure to clear the native IOBluetoothL2CAPChannel delegate when closing outgoing connections. The delegate object is deallocated while the native OS channel still holds a dangling pointer to it, which can be triggered if late events are dispatched.

Affected files:

  • device/bluetooth/bluetooth_l2cap_channel_mac.mm

Estimated timestamp from git blame: 2024-04-03

Summary

A potential Use-After-Free (UAF) vulnerability exists in the macOS Bluetooth L2CAP implementation in Chromium. For outgoing L2CAP connections, the BluetoothL2capChannelDelegate fails to properly unregister itself from the native IOBluetoothL2CAPChannel during connection teardown. This leads to a dangling pointer within the macOS Bluetooth framework, which can be triggered if subsequent events (such as late data arrival) are dispatched to the deallocated delegate.

Technical Details

In device/bluetooth/bluetooth_l2cap_channel_mac.mm, when an outgoing L2CAP connection is initiated via BluetoothL2capChannelMac::OpenAsync, the following sequence occurs:

  1. A BluetoothL2capChannelMac wrapper object is constructed with its internal channel_ member explicitly set to nil (line 124).
  2. The constructor immediately calls SetSocket(), which instantiates a BluetoothL2capChannelDelegate. The delegate is initialized using channel_, meaning its internal _l2capChannel ivar is set to nil (lines 147-148).
  3. [device openL2CAPChannelAsync:...] is called, which creates the native IOBluetoothL2CAPChannel and registers the delegate with it (line 128).
  4. BluetoothL2capChannelMac::channel_ is updated with the new native channel object (line 132). However, the delegate's internal _l2capChannel ivar is never updated.

When the connection is later closed, the macOS Bluetooth stack invokes l2capChannelClosed: on the delegate:

OBJC
- (void)l2capChannelClosed:(IOBluetoothL2CAPChannel*)l2capChannel {
  [_l2capChannel setDelegate:nil];  // This is a no-op because _l2capChannel is nil
  // ...
  _strongSelf = nil; // This releases the delegate object
}

Because _l2capChannel is nil for outgoing connections, the delegate fails to call setDelegate:nil on the actual native channel object. When _strongSelf is cleared, the delegate is deallocated via ARC. However, the native IOBluetoothL2CAPChannel object inside the OS framework still holds an unsafe_unretained (raw) pointer to this deallocated delegate.

This implementation is inconsistent with the RFCOMM implementation in device/bluetooth/bluetooth_rfcomm_channel_mac.mm, which correctly provides a setter (setRfcommChannel:) to update the delegate's channel reference during OpenAsync.

Potential Exploitation

(Note: These are suggested steps based on static analysis; a working proof-of-concept has not been executed.)

This UAF occurs in the Browser process. Furthermore, Objective-C objects are allocated using the system allocator and are not protected by MiraclePtr/PartitionAlloc.

An attacker could potentially trigger this by:

  1. Creating a malicious Web Extension that uses the chrome.bluetoothSocket API, or operating a malicious Bluetooth peripheral that Chrome connects to.
  2. Establishing an L2CAP connection.
  3. Racing a connection teardown (e.g., closing the socket) against incoming data packets from the peripheral.
  4. If a packet arrives and is processed by the OS after l2capChannelClosed: has released the delegate, but before the native channel is fully destroyed, the OS will attempt to dispatch an Objective-C message (e.g., l2capChannelData:) to the freed memory.
  5. Using heap spraying techniques, an attacker could replace the freed Objective-C object to gain control of the instruction pointer, leading to arbitrary code execution and a sandbox escape.

Suggested Fix

Similar to the RFCOMM implementation, update BluetoothL2capChannelDelegate to include a setter method for the channel, and call it after a successful connection:

  1. In BluetoothL2capChannelDelegate, add - (void)setL2capChannel:(IOBluetoothL2CAPChannel*)l2capChannel;.
  2. In BluetoothL2capChannelMac::OpenAsync, update the delegate after openL2CAPChannelAsync succeeds:
    C++
    if (*status == kIOReturnSuccess) {
      channel->channel_ = l2cap_channel;
      [channel->delegate_ setL2capChannel:l2cap_channel];
    } else {
    // ...
    

Evaluated with Chrome root at commit: 4a3e9db74111a3c6c4b3acfd70050a05077cf27a


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

Likely the delegate's internal channel reference is never updated after the native channel is created, so the cleanup call to clear the delegate is a no-op and the native channel keeps a dangling pointer.

Impact

An attacker could potentially achieve arbitrary code execution and a sandbox escape in the browser process, though no working proof-of-concept has been executed.

What the attacker needed

Malicious extension or Bluetooth peripheral; ability to establish an L2CAP connection; race condition timing

The fix

The delegate should be given a setter for the channel and updated after a successful connection, as the RFCOMM implementation already does.

How it was found

  1. Create a malicious extension using the Bluetooth socket API or operate a malicious Bluetooth peripheral.
  2. Establish an L2CAP connection.
  3. Race closing the connection against incoming data packets from the peripheral.
  4. If a packet arrives after the delegate is freed but before the native channel is destroyed, the OS dispatches a message to freed memory.
  5. Use heap spraying to replace the freed object and gain control of the instruction pointer.

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.

When a program frees an object but still keeps a pointer to it, that is a use-after-free: later use of the pointer can let an attacker control what the program does. Here, a helper object for a Bluetooth connection is freed while the operating system still thinks it can send messages to it. If an attacker can make one of those messages arrive at the right moment, they might take over the browser.

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.