7.8high
Bluetooth: SCO: fix race conditions in sco_sock_connect()
- Severity
- 7.8high CVSS:3.1 by Linux
- Exploit likelihood
- 0.10% (higher than 0% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: Bluetooth: SCO: fix race conditions in sco_sock_connect() sco_sock_connect() checks sk_state and sk_type without holding the socket lock. Two concurrent connect() syscalls on the same socket can both pass the check and enter sco_connect(), leading to use-after-free. The buggy scenario involves three participants and was confirmed with additional logging instrumentation: Thread A (connect): HCI disconnect: Thread B (connect): sco_sock_connect(sk) sco_sock_connect(sk) sk_state==BT_OPEN sk_state==BT_OPEN (pass, no lock) (pass, no lock) sco_connect(sk): sco_connect(sk): hci_dev_lock hci_dev_lock hci_connect_sco <- blocked -> hcon1 sco_conn_add->conn1 lock_sock(sk) sco_chan_add: conn1->sk = sk sk->conn = conn1 sk_state=BT_CONNECT release_sock hci_dev_unlock hci_dev_lock sco_conn_del: lock_sock(sk) sco_chan_del: sk->conn=NULL conn1->sk=NULL sk_state= BT_CLOSED SOCK_ZAPPED release_sock hci_dev_unlock (unblocked) hci_connect_sco -> hcon2 sco_conn_add -> conn2 lock_sock(sk) sco_chan_add: sk->conn=conn2 sk_state= BT_CONNECT // zombie sk! release_sock hci_dev_unlock Thread B revives a BT_CLOSED + SOCK_ZAPPED socket back to BT_CONNECT. Subsequent cleanup triggers double sock_put() and use-after-free. Meanwhile conn1 is leaked as it was orphaned when sco_conn_del() cleared the association. Fix this by: - Moving lock_sock() before the sk_state/sk_type checks in sco_sock_connect() to serialize concurrent connect attempts - Fixing the sk_type != SOCK_SEQPACKET check to actually return the error instead of just assigning it - Adding a state re-check in sco_connect() after lock_sock() to catch state changes during the window between the locks - Adding sco_pi(sk)->conn check in sco_chan_add() to prevent double-attach of a socket to multiple connections - Adding hci_conn_drop() on sco_chan_add failure to prevent HCI connection leaks
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 70a13b1e25fef37c87c8a1228ddb8900efbca7cf before dabf22269242e2f2bf44c43fcdc2fa763df7f9cc, from 9a8ec9e8ebb5a7c0cfbce2d6b4a6b67b2b78e8f3 before adb90cd0f9f7a8d438fcb93354040fbafc5ae2a0, from 9a8ec9e8ebb5a7c0cfbce2d6b4a6b67b2b78e8f3 before 7e296ffdab5bdab718dff7c14288fdcb9154fa27, from 9a8ec9e8ebb5a7c0cfbce2d6b4a6b67b2b78e8f3 before 98c8d3bfdaa657d8f472dbbebd7ea8cd816d8a8d, from 9a8ec9e8ebb5a7c0cfbce2d6b4a6b67b2b78e8f3 before d002bd11024bd231bcb606877e33951ffb7bed14, from 9a8ec9e8ebb5a7c0cfbce2d6b4a6b67b2b78e8f3 before 8a5b0135d4a5d9683203a3d9a12a711ccec5936b, from 6.1.109 before 6.1.168, 6.3 Not affected: before 6.3, from 6.1.168 up to 6.1.*, from 6.6.134 up to 6.6.*, from 6.12.81 up to 6.12.*, from 6.18.22 up to 6.18.*, from 6.19.12 up to 6.19.* | CVE List |
| linux linux_kernel | from 6.1.109 before 6.1.168, from 6.3.1 before 6.6.134, from 6.7 before 6.12.81, from 6.13 before 6.18.22, from 6.19 before 6.19.12, 6.3, 7.0 | NVD |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: Bluetooth: SCO: fix race conditions in sco_sock_connect() sco_sock_connect() checks sk_state and sk_type without holding the socket lock. Two concurrent connect() syscalls on the same socket can both pass the check and enter sco_connect(), leading to use-after-free. The buggy scenario involves three participants and was confirmed with additional logging instrumentation: Thread A (connect): HCI disconnect: Thread B (connect): sco_sock_connect(sk) sco_sock_connect(sk) sk_state==BT_OPEN sk_state==BT_OPEN (pass, no lock) (pass, no lock) sco_connect(sk): sco_connect(sk): hci_dev_lock hci_dev_lock hci_connect_sco <- blocked -> hcon1 sco_conn_add->conn1 lock_sock(sk) sco_chan_add: conn1->sk = sk sk->conn = conn1 sk_state=BT_CONNECT release_sock hci_dev_unlock hci_dev_lock sco_conn_del: lock_sock(sk) sco_chan_del: sk->conn=NULL conn1->sk=NULL sk_state= BT_CLOSED SOCK_ZAPPED release_sock hci_dev_unlock (unblocked) hci_connect_sco -> hcon2 sco_conn_add -> conn2 lock_sock(sk) sco_chan_add: sk->conn=conn2 sk_state= BT_CONNECT // zombie sk! release_sock hci_dev_unlock Thread B revives a BT_CLOSED + SOCK_ZAPPED socket back to BT_CONNECT. Subsequent cleanup triggers double sock_put() and use-after-free. Meanwhile conn1 is leaked as it was orphaned when sco_conn_del() cleared the association. Fix this by: - Moving lock_sock() before the sk_state/sk_type checks in sco_sock_connect() to serialize concurrent connect attempts - Fixing the sk_type != SOCK_SEQPACKET check to actually return the error instead of just assigning it - Adding a state re-check in sco_connect() after lock_sock() to catch state changes during the window between the locks - Adding sco_pi(sk)->conn check in sco_chan_add() to prevent double-attach of a socket to multiple connections - Adding hci_conn_drop() on sco_chan_add failure to prevent HCI connection leaks
NVD (es)
En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: Bluetooth: SCO: corregir condiciones de carrera en sco_sock_connect() sco_sock_connect() comprueba sk_state y sk_type sin mantener el bloqueo del socket. Dos llamadas al sistema connect() concurrentes en el mismo socket pueden ambas pasar la comprobación y entrar en sco_connect(), lo que lleva a uso después de liberación. El escenario con errores involucra a tres participantes y fue confirmado con instrumentación de registro adicional: Hilo A (conexión): Desconexión HCI: Hilo B (conexión): sco_sock_connect(sk) sco_sock_connect(sk) sk_state==BT_OPEN sk_state==BT_OPEN (pasa, sin bloqueo) (pasa, sin bloqueo) sco_connect(sk): sco_connect(sk): hci_dev_lock hci_dev_lock hci_connect_sco <- bloqueado -> hcon1 sco_conn_add -> conn1 lock_sock(sk) sco_chan_add: conn1 -> sk = sk sk -> conn = conn1 sk_state=BT_CONNECT release_sock hci_dev_unlock hci_dev_lock sco_conn_del: lock_sock(sk) sco_chan_del: sk -> conn=NULL conn1 -> sk=NULL sk_state= BT_CLOSED SOCK_ZAPPED release_sock hci_dev_unlock (desbloqueado) hci_connect_sco -> hcon2 sco_conn_add -> conn2 lock_sock(sk) sco_chan_add: sk -> conn=conn2 sk_state= BT_CONNECT // ¡sk zombi! release_sock hci_dev_unlock El Hilo B revive un socket BT_CLOSED + SOCK_ZAPPED de nuevo a BT_CONNECT. La limpieza posterior dispara un doble sock_put() y uso después de liberación. Mientras tanto, conn1 se filtra ya que quedó huérfano cuando sco_conn_del() eliminó la asociación. Esto se soluciona mediante: - Mover lock_sock() antes de las comprobaciones de sk_state/sk_type en sco_sock_connect() para serializar los intentos de conexión concurrentes - Corregir la comprobación sk_type != SOCK_SEQPACKET para que realmente devuelva el error en lugar de solo asignarlo - Añadir una nueva comprobación de estado en sco_connect() después de lock_sock() para detectar cambios de estado durante la ventana entre los bloqueos - Añadir una comprobación sco_pi(sk) -> conn en sco_chan_add() para evitar la doble asociación de un socket a múltiples conexiones - Añadir hci_conn_drop() en caso de fallo de sco_chan_add para evitar fugas de conexión HCI
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-43023 changed 2026-10-19 | CVE Terms of Use |
| NVD | CVE-2026-43023 changed 2026-11-11 | Public domain |