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

Use after free in WebUSB (CVE-2026-13778)

A use-after-free was identified in the macOS WebUSB implementation because Chromium and libusb map a duplicated endpoint address to different interfaces. A malicious USB device could exploit this mismatch to skip transfer cancellation and race interface release, potentially leading to code execution in the browser process.

Google Chrome

Originally disclosed on Chrome VRP

Critical View original
  • Fix shipped in 48 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 without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential Use-After-Free (UAF) vulnerability exists in the macOS WebUSB implementation due to inconsistent endpoint-to-interface mapping between Chromium and libusb. A malicious USB device can exploit this discrepancy to bypass transfer cancellation checks and trigger a race condition during interface release. This leads to a vtable dereference on a freed IOKit interface proxy within the privileged browser process.

Affected files:

  • third_party/libusb/src/libusb/os/darwin_usb.c
  • services/device/usb/usb_device_handle_impl.cc
  • third_party/libusb/src/libusb/io.c
  • third_party/libusb/src/libusb/core.c

Estimated timestamp from git blame: 2016-02-04

Summary

A potential Use-After-Free (UAF) vulnerability has been identified in the macOS backend of WebUSB. The issue arises from a combination of 'endpoint aliasing'—where a malicious USB device provides duplicate endpoint addresses across different interfaces—and a race condition between transfer cancellation and interface release in the underlying libusb library. Because the Device Service runs within the browser process on macOS, this can lead to an attacker-controlled indirect call in a privileged, unsandboxed context.

Vulnerability Details

1. Endpoint Mapping Discrepancy

When a device is claimed, Chrome maintains an internal endpoint_map_ in UsbDeviceHandleImpl to track which claimed interface owns which endpoint. If a malicious device advertises the same endpoint address (e.g., 0x81) on multiple interfaces (e.g., Interface 0 and Interface 1), a mapping discrepancy occurs:

  • Chromium Logic: UsbDeviceHandleImpl::RefreshEndpointMap iterates through claimed interfaces. If an endpoint is duplicated, the map is overwritten, effectively associating the endpoint with the interface having the highest index (Interface 1).
  • libusb Logic: The macOS backend function ep_to_pipeRef (in darwin_usb.c) iterates from index 0 and returns the first match. It associates the endpoint with Interface 0.

2. The Race Condition

When a transfer is initiated on Interface 1, Chrome believes Interface 1 owns it. However, libusb executes the transfer using the IOKit pipe associated with Interface 0.

If the website then releases Interface 0, Chrome's UsbDeviceHandleImpl::ReleaseInterface iterates through active transfers to perform pre-release cancellation. Because it believes the transfer belongs to Interface 1, it skips cancellation. The interface release is then posted to a background ThreadPool.

On the ThreadPool, libusb_release_interface begins destroying the Interface 0 proxy. Concurrently, if the website releases Interface 1, Chrome triggers libusb_cancel_transfer on the UI thread. Inside libusb, darwin_abort_transfers is called. It uses ep_to_pipeRef to find the owner of the endpoint, which is still Interface 0 (as the release hasn't completed).

Because libusb_cancel_transfer and libusb_release_interface use disjoint locks (itransfer->lock vs dev->lock), the UI thread may dereference the Interface 0 proxy's vtable (to call AbortPipe or ClearPipeStallBothEnds) while the ThreadPool is simultaneously freeing that same proxy object.

Potential Steps to Reproduce

Note: These are suggested steps based on source code analysis; the behavior has not been verified with a live Proof of Concept.

  1. Connect a malicious USB device that advertises a duplicate bulk endpoint address on both Interface 0 and Interface 1.
  2. Claim both Interface 0 and Interface 1 via WebUSB.
  3. Start a bulk transfer on the duplicate endpoint (associated with Interface 1 by Chrome).
  4. Release Interface 0. Chromium will skip the cancellation check for the active transfer.
  5. Immediately release Interface 1 or close the device. This triggers libusb_cancel_transfer on the UI thread.
  6. The UI thread and a background thread may race on the destruction and access of the Interface 0 IOKit proxy, leading to a UAF.

Impact

This vulnerability impacts the unsandboxed browser process on macOS. Successful exploitation could allow an attacker with a malicious USB device to achieve arbitrary code execution (RCE) in the context of the browser process. The issue is not mitigated by MiraclePtr as it occurs within the third-party C library libusb.

Suggested Fix

  1. Strict Validation: Chromium should prevent claiming interfaces that contain endpoints already present in other claimed interfaces for the same device.
  2. Mapping Consistency: Ensure UsbDeviceHandleImpl::RefreshEndpointMap uses the same search logic as the underlying platform backend to prevent ownership mismatches.
  3. libusb Hardening: Submit a patch to libusb to ensure that darwin_release_interface and darwin_abort_transfers use synchronized locking or that the interface proxy is nullified before the object is released.

Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e


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 endpoint-to-interface mapping differs between Chromium (last match) and libusb (first match), so cancellation checks miss transfers and unsynchronised locks allow a use-after-free.

Impact

Successful exploitation could allow an attacker with a malicious USB device to achieve arbitrary code execution in the unsandboxed browser process on macOS; the issue is not mitigated by MiraclePtr.

What the attacker needed

MacOS; malicious USB device with duplicate endpoint; website using WebUSB; user grants USB access

The fix

Chromium should reject claiming interfaces with duplicate endpoints, align its endpoint mapping with the platform backend, and libusb should synchronise locking or nullify the interface proxy before release.

How it was found

  1. Connect a malicious USB device that advertises a duplicate bulk endpoint address on both Interface 0 and Interface 1.
  2. Claim both Interface 0 and Interface 1 via WebUSB.
  3. Start a bulk transfer on the duplicate endpoint (associated with Interface 1 by Chrome).
  4. Release Interface 0. Chromium will skip the cancellation check for the active transfer.
  5. Immediately release Interface 1 or close the device. This triggers `libusb_cancel_transfer` on the UI thread.
  6. The UI thread and a background thread may race on the destruction and access of the Interface 0 IOKit proxy, leading to a UAF.

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.

WebUSB lets websites talk to USB devices. The browser and a helper library disagreed about which part of the device owned a connection, so when the website released one part, the browser forgot to cancel an active transfer. That let one thread free memory while another still used it, which can crash or be abused 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.