Skip to content

BT: HCI: adv_ext_report Improper discarding in adv_ext_report

High
ceolin published GHSA-p5j7-v26w-wmcp Sep 13, 2024

Package

zephyr (zephyr)

Affected versions

<=3.6

Patched versions

None

Description

Summary

An improper discarding routine causes a heap overflow in bt_hci_le_adv_ext_report in /subsys/bluetooth/host/scan.c.

Details

After pulling bt_hci_evt_le_ext_advertising_info from the buffer, it sometimes proceeds to the cont routine based on event types and states.

		...

		if (buf->len < sizeof(*evt)) {
			LOG_ERR("Unexpected end of buffer");
			break;
		}
		...
		
		if (evt_type & BT_HCI_LE_ADV_EVT_TYPE_LEGACY) {
			/* Legacy advertising reports are complete.
			 * Create event immediately.
			 */
			create_ext_adv_info(evt, &scan_info);
			le_adv_recv(&evt->addr, &scan_info, &buf->b, evt->length);
			goto cont;
		}

		...

cont:
		net_buf_pull(buf, evt->length);

In cont routine, there is no length check of remaining buffer before pulling data, causing under wrap of the buffer length. This bypasses the next check of the remaining buffer size, directly leading to a heap overflow.

PoC

Set the number of reports to a value other than 0 to enter the while loop.

The remaining buffer after pulling 1 byte should be larger than sizeof(*evt) which is 24 bytes.

Set the evt_type of first bt_hci_evt_le_ext_advertising_info to BT_HCI_LE_ADV_EVT_TYPE_LEGACY, which is BIT(4).

evt->length can vary depending on input length.

Impact

Result of exploitation could lead to instability (i.e., crash) or denial of service attacks.

Patches

main: #74639
v3.6: #77960

For more information

If you have any questions or comments about this advisory:

embargo: 2024-09-12

Severity

High

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
Low
Integrity
Low
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:L/I:L/A:H

CVE ID

CVE-2024-6259

Credits