Inappropriate implementation in USB (CVE-2026-13882)
A race condition in the browser's WebUSB implementation allows a compromised renderer to bypass the blocklist of protected USB interface classes. By sending a configuration change and an interface claim in quick succession, an attacker could gain raw access to interfaces such as HID keyboards or smart cards.
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 Time-of-Check Time-of-Use (TOCTOU) race condition in the WebUSB Device Service allows a compromised renderer to bypass the protected-interface-class blocklist. By sending a SetConfiguration Mojo request followed immediately by a ClaimInterface request, the browser validates the claim against stale configuration metadata but executes the claim against the newly set configuration. This can potentially grant an attacker raw access to protected USB interfaces like HID keyboards or smart cards.
Affected files:
services/device/usb/mojo/device_impl.ccservices/device/usb/usb_device_handle_usbfs.ccservices/device/usb/usb_device_handle_impl.ccservices/device/usb/usb_device.ccservices/device/usb/usb_device_impl.cc
Estimated timestamp from git blame: 2026-01-06
Summary
A Time-of-Check Time-of-Use (TOCTOU) vulnerability exists in the browser's WebUSB implementation (services/device/usb/mojo/device_impl.cc). The vulnerability arises because DeviceImpl::SetConfiguration updates the device's configuration asynchronously on a background thread, while DeviceImpl::ClaimInterface validates interface claims synchronously on the main thread using potentially stale state before posting the actual claim operation to the same background thread.
A compromised renderer can bypass Blink's JavaScript-level concurrency checks and send pipelined Mojo messages to exploit this. By carefully timing a SetConfiguration and a ClaimInterface request, the renderer can trick the browser into validating an interface against an old, permissive configuration, while the underlying OS claims the interface under a new, restricted configuration.
Potential Steps to Trigger
These are the suggested steps an attacker would follow to trigger this vulnerability:
- Preconditions: The attacker compromises a renderer process (e.g., via a v8 bug) and the user has granted WebUSB access to a USB device with at least two configurations (Config A and Config B).
- Config A contains a harmless interface (e.g., Vendor Specific, class
0xFF) at indexN. - Config B contains a protected interface (e.g., HID, class
0x03, which is inblocked_interface_classes_) at the exact same indexN.
- Config A contains a harmless interface (e.g., Vendor Specific, class
- Bypass JS checks: The compromised renderer bypasses
USBDevice::EnsureNoDeviceOrInterfaceChangeInProgressin Blink and communicates directly with themojom::UsbDeviceinterface. - Initiate Configuration Change: The renderer sends a
SetConfiguration(Config B)Mojo message.DeviceImpl::SetConfigurationreceives this and posts the task to a sequenced background task runner (e.g.,helper_on Linux/Android orblocking_task_runner_on macOS). The browser's active configuration state is not updated yet. - Initiate Interface Claim: The renderer immediately sends a
ClaimInterface(N)Mojo message. - Stale State Validation:
DeviceImpl::ClaimInterfacesynchronously callsdevice_->GetActiveConfiguration()to validate the interface against theblocked_interface_classes_list. Since the background task hasn't finished, this returns the metadata for the old Config A. The check sees a benign Vendor Specific interface and permits the claim, posting it to the same background task runner. - Sequential Execution: The background thread executes the tasks sequentially:
- It issues a synchronous USB control transfer to the OS to switch the physical device to Config B.
- It immediately issues an ioctl/request to claim interface
N. Since the device is now in Config B, the OS claims the protected HID interface. Because these requests execute back-to-back, native OS drivers (likeusbhid) do not have time to asynchronously bind and lock the interface.
- State Synchronization: The completion callbacks run on the main thread in order. The configuration state is updated to Config B. Then,
ClaimInterfaceCompleteruns and callsRefreshEndpointInfo(), which caches the protected endpoints of Config B's interfaceNinto the browser's allowedendpoints_map. - Exploitation: The compromised renderer can now send
GenericTransferInorGenericTransferOutMojo messages to the protected endpoints. The browser allows them because they exist in theendpoints_map, granting the attacker raw USB access to the restricted interface (e.g., injecting keystrokes).
Suggested Fix
The DeviceImpl class must enforce synchronization between configuration changes and interface claims.
A potential fix is to introduce a state flag (e.g., bool device_state_change_in_progress_) in DeviceImpl that is set when a SetConfiguration or Reset operation is pending. If ClaimInterface, SetInterfaceAlternateSetting, or similar methods are called while this flag is true, they should immediately fail and return an error (or be queued until the configuration change is complete). Alternatively, the interface class validation could be deferred and performed inside the completion callback on the main thread after the configuration change has definitively occurred.
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.
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 configuration change is performed asynchronously on a background thread while the interface claim is validated synchronously on the main thread using stale configuration state.
Impact
A compromised renderer could gain raw USB access to protected interfaces, potentially allowing keystroke injection or smart card access.
What the attacker needed
Compromised renderer process; WebUSB permission granted for a device with two…; device has a protected interface at the same index as a…
The fix
The DeviceImpl class should enforce synchronization between configuration changes and interface claims, for example by using a state flag to reject or queue claims during a pending configuration change.
How it was found
- Compromise a renderer process and obtain WebUSB permission for a device with two configurations where a harmless interface and a protected interface share the same index.
- Bypass Blink's JavaScript-level checks and send Mojo messages directly to the browser process.
- Send a SetConfiguration request for the configuration containing the protected interface.
- Immediately send a ClaimInterface request for the shared index.
- The browser validates the claim against the old configuration and allows it, then executes the claim after the configuration change.
- Use GenericTransferIn or GenericTransferOut to communicate with the now-accessible protected interface.
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, but the browser blocks access to sensitive interfaces like keyboards to prevent abuse. This report shows that if an attacker already controls part of the browser, they can trick the browser into allowing access to those blocked interfaces by changing the device configuration at just the right moment.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.