Bluetooth: hci_sock: Serialize dead-device detachment
- Published
- Last modified
- Where the record stands: published, rejected by its publisher, or superseded by another id.What do these mean? →
- published
- Whether CISA lists it in its Known Exploited Vulnerabilities catalog: proof that attackers are using it.What do these mean? →
- Not listed in CISA KEV
- Fix
- Fixed in 4.5, 4.10, 4.15, 4.20, 5.5, and 6 more
- Whether working attack code is public (Exploit-DB, Metasploit, Nuclei or GitHub). Public code makes attacks easier.What do these mean? →
- None on Exploit-DB, Metasploit or GitHub
Summary
In the Linux kernel, the following vulnerability has been resolved: Bluetooth: hci_sock: Serialize dead-device detachment Rebinding an HCI socket after its controller is unregistered can race monitor control replay and crash the kernel. hci_sock_bind() clears hci_pi(sk)->hdev and drops the device reference under only the socket lock, whereas send_monitor_control_replay() holds hci_sk_list.lock for reading. Replay can observe a non-NULL hdev, then bind can clear it and drop the last reference before create_monitor_ctrl_open() reads hdev->id. This can cause a NULL pointer dereference if the pointer is reloaded, or a use-after-free if the old pointer is retained. The kernel reported: KASAN: null-ptr-deref in range [0x0000000000000068-0x000000000000006f] RIP: 0010:create_monitor_ctrl_open+0x579/0x800 Call Trace: hci_sock_bind+0xd96/0x1190 __sys_bind+0x166/0x200 __x64_sys_bind+0x6d/0xb0 do_syscall_64+0xdd/0x4a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f The same missing serialization lets hci_send_to_sock() select a socket for the old device and queue its frame after bind has detached the socket or installed a new binding. Take hci_sk_list.lock for writing when clearing the device pointer and resetting the socket state. This waits for existing replay and delivery readers to finish before detachment and prevents later readers from using the old binding. Keep hci_dev_put() outside the critical section because the final device release can sleep.
Timeline
- CVE published
- First seen by cve.now
Affected versions
- Linux Linux
From e04480920d1eec9c061841399aa6f35b6f987d8b · fixed in 37cef0c8fb537f40600910d2c2e5f2d5509305f3; From e04480920d1eec9c061841399aa6f35b6f987d8b · fixed in 76f2e2665697340ac719e7ff1bf148dd014e55c1; From e04480920d1eec9c061841399aa6f35b6f987d8b · fixed in c3d2799877906d0c8392d96e14216cd82b020330; From e04480920d1eec9c061841399aa6f35b6f987d8b · fixed in e660a22402944f2615a16fde7129a3c497537329; From e04480920d1eec9c061841399aa6f35b6f987d8b · fixed in 381a0925c556a8d91a80a9b9e3e86651d60ffee3; From 4.4.281 · fixed in 4.5; From 4.9.280 · fixed in 4.10; From 4.14.244 · fixed in 4.15; From 4.19.203 · fixed in 4.20; From 5.4.140 · fixed in 5.5; From 5.10.58 · fixed in 5.11; From 5.13.10 · fixed in 5.14
- Linux Linux
5.14
- KernelLinux
From 5.14.0 · fixed in 6.6.160; From 6.7.0 · fixed in 6.12.113; From 6.13.0 · fixed in 6.18.57; From 6.19.0 · fixed in 7.2.11