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

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
Local
Attack complexity
High
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low

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:L/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:L

CVE ID

CVE-2020-10066

Weaknesses