Skip to contentSkip to conversation

bass: Fix heap buffer overflow allocating subgroup_data array

PATCH Applied Bastien Nocera 3 participants 3 messages Aug 27 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bass: Fix heap buffer overflow allocating subgroup_data array

bass_build_bcast_src() in src/shared/bass.c parses the Broadcast Receive State characteristic value received from a remote BASS server.

It reads an attacker-controlled num_subgroups byte (range 0-255) but always allocates a single bt_bass_subgroup_data entry (24 bytes):

subgroup_data = new0(struct bt_bass_subgroup_data, 1);   // line 337: always 1
for (int i = 0; i < num_subgroups; i++) {                // line 343: up to 255
    subgroup_data[i].bis_sync = bis_sync_state;          // line 355: OOB write

with Claude and Anthropic Research

Fixes 8980f4f1f7 ("shared/bass: Functions cleanup")

See: https://github.com/bluez/bluez/security/advisories/GHSA-7wjj-8mrm-jhw4

---
 src/shared/bass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/shared/bass.c +1 -1
index 65ee4a8cbb18..6566b89ae368 100644
@@ -334,7 +334,7 @@ static int bass_build_bcast_src(struct bt_bcast_src *bcast_src,
 	if (num_subgroups == 0)
 		goto done;
 
-	subgroup_data = new0(struct bt_bass_subgroup_data, 1);
+	subgroup_data = new0(struct bt_bass_subgroup_data, num_subgroups);
 	if (!subgroup_data) {
 		DBG(bcast_src->bass, "Unable to allocate memory");
 		return -1;
Signature · 1 line
2.55.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1152688

---Test result---

Test Summary:

CheckPatch                    FAIL      0.47 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      20.42 seconds
BluezMake                     PASS      568.03 seconds
MakeCheck                     PASS      1.07 seconds
MakeDistcheck                 PASS      160.97 seconds
CheckValgrind                 PASS      148.32 seconds
CheckSmatch                   PASS      301.79 seconds
bluezmakeextell               PASS      100.22 seconds
IncrementalBuild              PASS      596.27 seconds
ScanBuild                     PASS      948.51 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
bass: Fix heap buffer overflow allocating subgroup_data array WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #50:
bass_build_bcast_src() in src/shared/bass.c parses the Broadcast Receive State

ERROR:BAD_SIGN_OFF: Unrecognized email address: '@thaidn and @bronson-calif of Calif.io in collaboration' #59:

ERROR:BAD_SIGN_OFF: Unrecognized email address: '@trace37labs for the Fixes' #61:

WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: 8980f4f1f730 ("shared/bass: Functions cleanup")' #63:

Fixes 8980f4f1f7 ("shared/bass: Functions cleanup")

/github/workspace/src/patch/14771428.patch total: 2 errors, 2 warnings, 8 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/patch/14771428.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

https://github.com/bluez/bluez/pull/2441

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Bastien Nocera
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 10 lines · On Thu, 27 Aug 2026 16:56:37 +0200 you wrote:

bass_build_bcast_src() in src/shared/bass.c parses the Broadcast Receive State characteristic value received from a remote BASS server.

It reads an attacker-controlled num_subgroups byte (range 0-255) but always allocates a single bt_bass_subgroup_data entry (24 bytes):

subgroup_data = new0(struct bt_bass_subgroup_data, 1);   // line 337: always 1
for (int i = 0; i < num_subgroups; i++) {                // line 343: up to 255
    subgroup_data[i].bis_sync = bis_sync_state;          // line 355: OOB write

[...]

Here is the summary with links:
- bass: Fix heap buffer overflow allocating subgroup_data array

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3c18444ced8e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html