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

Codrio BLE: ignore packet if data allocation fails (CVE-2024-48985) #384

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

Conversation

Diff-fusion
Copy link

Summary of changes

hciTrSerialRxIncoming parses incoming hci packets. It takes two bytes from the packet header and tries to allocate a buffer based on the packet size contained in those bytes. There is no logic to account for the case of an allocate failing. If WSF_ASSERT is not enabled (it isn't by default), the packet isn't dropped either.

This means that the function will stay in it's HCI_RX_STATE_HEADER state for longer than intended. Because every iteration of the loop writes another byte to hdrRx and the intended exit condition for this state has been passed, it will continue writing to hdrRx past it's bounds, causing a buffer overflow.

This fix handles the failed allocation by resetting the parser and exiting the function, similar to #374.

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-48985

@Diff-fusion Diff-fusion changed the title Codrio BLE: ignore packet if data allocation fails Codrio BLE: ignore packet if data allocation fails (CVE-2024-48985) 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