Cordio BLE: fix OOB read in event processing (CVE-2024-48984) #387
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.mbed-os/connectivity/FEATURE_BLE/libraries/cordio_stack/ble-host/sources/hci/dual_chip/hci_evt.c
Line 1317 in 54e8693
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.
mbed-os/connectivity/FEATURE_BLE/libraries/cordio_stack/ble-host/sources/hci/dual_chip/hci_evt.c
Lines 1331 to 1343 in 54e8693
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
Test results