Skip to content

bt: host/smp: DoS caused by null pointer dereference

Moderate
ceolin published GHSA-jmr9-xw2v-5vf4 Jul 3, 2024

Package

zephyr (west)

Affected versions

<= 3.6

Patched versions

None

Description

Summary

The function smp_error in subsys/bluetooth/host/smp.c
does not check if smp->chan.chan.conn is 0 or not and it will
lead to NULL pointer dereference.

A malicious BLE device can send a specific order of packet
sequence to cause a DoS attack on the victim BLE device

Description

image

The process triggered by the vulnerability is illustrated above.
Assuming LE Secure Connections (Just Works) is used to
establish a connection, and the Controller does not support
ECC (BT_TINYCRYPT_ECC=1).

  1. When the Peripheral receives the Paring public key
    command, it executes
    bt_long_wq_submit(&ecc_work) , allowing the worker
    to execute emulate_le_generate_dhkey to compute
    the DHKey.
  2. The Central sends a Paring DHKey Check packet
    containing incorrect Ea, causing DHKey checks to fail
    when verifying DHKey Check from Central (In step 4).
  3. Central sends an LL_TERMINATE_IND right after step 2,
    triggering the Peripheral's host to execute
    hci_disconn_complete_prio and
    hci_disconn_complete , causing hci_tx_thread to
    execute conn_cleanup to clear the connection. During
    the connection cleanup process, it will execute
    deferred_work -> bt_l2cap_disconnected ->
    bt_l2cap_chan_del .In this step, smp->chan->chan- >conn is set to NULL in bt_l2cap_chan_del , resulting
    in a crash in step 5.
  4. After computing the DHKey, bt_smp_dhkey_ready ->
    smp_dhkey_ready -> compute_and_check_and_send_periph_dhcheck are
    executed to perform DHKey Check verification, which
    fails.
  5. Since the verification failure triggers smp_error ,
    eventually bt_conn_send_cb is executed, and the conn
    accessed here originates from smp->chan->chan->conn
    which is NULL , causing a crash when accessing conn->state .

Due to scheduling constraints, the triggering of this
vulnerability is random.

Patches

main: #71030

For more information

If you have any questions or comments about this advisory:

embargo: 2024-07-01

Credits

Reported by Wei Che Kao (Xiaobye), graduate student from National Yang Ming Chiao Tung University, Dept. of CS,
Security and Systems Lab.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Adjacent
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

CVE ID

CVE-2024-3332

Weaknesses

Credits