Skip to content

Incorrect Error Handling in Bluetooth HCI core

Low
d3zd3z published GHSA-gc66-xfrc-24qr Apr 26, 2021

Package

zephyr (west)

Affected versions

v1.14.2, v2.2.0

Patched versions

v2.2.1, v2.3.0

Description

Issue Description

In hci_cmd_done, the buf argument being passed as null causes
nullpointer dereference.

This is triggered in case of subsys/bluetooth/host/hci_core.c#send_cmd
calling hci_cmd_done with null pointer after error status of bt_send.

static void send_cmd(void)
{
    ...
    err = bt_send(buf);
    if (err) {
        BT_ERR("Unable to send to driver (err %d)", err);
        k_sem_give(&bt_dev.ncmd_sem);
        // Tobias Scharnowski: Calling hci_cmd_done with buf=NULL
        hci_cmd_done(cmd(buf)->opcode, BT_HCI_ERR_UNSPECIFIED,
                 NULL);
    ...
    }
    ...
}
...
static void hci_cmd_done(u16_t opcode, u8_t status, struct net_buf *buf)
{
    BT_DBG("opcode 0x%04x status 0x%02x buf %p", opcode, status, buf);
    // Tobias Scharnowski: Use of buf without check
    if (net_buf_pool_get(buf->pool_id) != &hci_cmd_pool) {
        BT_WARN("opcode 0x%04x pool id %u pool %p != &hci_cmd_pool %p",
            opcode, buf->pool_id, net_buf_pool_get(buf->pool_id),
            &hci_cmd_pool);
        return;
    }
    ...
}

Source Code References

Impact

  • Based on the ability of an attacker to influence the success of a
    low-level bluetooth send, this can lead to a DoS.
  • Ideas for such influence have not been further investigated, but may
    consist of jamming or causing timeouts (possibly by withholding things
    like acknowledgements or the like)

Patches

This has been fixed in:

For more information

If you have any questions or comments about this advisory:

embargo: 2020-06-29
zepsec: ZEPSEC-67
thanks: Stuart Steffen

Severity

Low
2.5
/ 10

CVSS base metrics

Attack vector
Local
Attack complexity
High
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:L

CVE ID

CVE-2020-10066

Weaknesses