Skip to content

BT: Unchecked user input in bap_broadcast_assistant

Moderate
ceolin published GHSA-r8h3-64gp-wv7f Sep 13, 2024

Package

zephyr (zephyr)

Affected versions

<=3.6

Patched versions

None

Description

Summary

In parse_recv_state in subsys/bluetooth/audio/bap_broadcast_assistant.c, the recv_state->num_subgroups in not verified, leading to stack overflow in subsequent for loop.

Details

The function parse_recv_state is invoked from read_recv_state_cb, and its third parameter, recv_state, is defined as a local stack variable within read_recv_state_cb.

In parse_recv_state, the number of subgroups is determined by user input through the following line of code:

recv_state->num_subgroups = net_buf_simple_pull_u8(&buf);

This value is not validated and is directly used as the upper limit in a subsequent for loop. During the loop's execution, the subgroup can eventually exceed the bounds of the recv_state array, causing a stack overflow.

for (int i = 0; i < recv_state->num_subgroups; i++) {
	struct bt_bap_bass_subgroup *subgroup = &recv_state->subgroups[i];

The maximum number of subgroups should be restricted to a predefined configuration value, ensuring that user input does not exceed CONFIG_BT_BAP_BASS_MAX_SUBGROUPS.

struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS];

Impact

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

Patches

main: #74062
v3.6: #77966

For more information

If you have any questions or comments about this advisory:

embargo: 2024-09-10

Credits

@ekleezg

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

CVE ID

CVE-2024-5931

Credits