Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordio BLE: fix OOB read in event processing (CVE-2024-48984) #387

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Diff-fusion
Copy link

Summary of changes

hciEvtProcessLeExtAdvReport parses lists of hci reports. In doing so, it dynamically determines the length of the list by reading a byte from the input buffer.

The function then steps through the input buffer and reads the length of all the individual reports in order to find the largest one. It then allocates a buffer that is capable of holding the largest report.

while (i-- > 0)
{
ptr += HCI_EXT_ADV_RPT_DATA_LEN_OFFSET;
BSTREAM_TO_UINT8(dataLen, ptr);
ptr += dataLen;
/* if len greater than max len seen so far */
if (dataLen > maxLen)
{
/* update max len */
maxLen = dataLen;
}
}

However, no check is done to ensure that those other reports are actually held within the buffer.

This fix checks that all reports are fully contained within the buffer.

Impact of changes

Migration actions required

Documentation

None


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

@Diff-fusion
Copy link
Author

This PR fixes CVE-2024-48984

@Diff-fusion Diff-fusion changed the title Cordio BLE: fix OOB read in event processing Cordio BLE: fix OOB read in event processing (CVE-2024-48984) Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant