Skip to content

os/net : Fix the reported security vulnerabilities related to Bluetooth#7187

Open
giwon-nam wants to merge 3 commits intoSamsung:masterfrom
giwon-nam:fix_ble_sec_vulnerability
Open

os/net : Fix the reported security vulnerabilities related to Bluetooth#7187
giwon-nam wants to merge 3 commits intoSamsung:masterfrom
giwon-nam:fix_ble_sec_vulnerability

Conversation

@giwon-nam
Copy link
Contributor

@giwon-nam giwon-nam commented Mar 11, 2026

Fixed the following three security vulnerabilities related to Bluetooth.

  • bledev-lwnl-msg-params-overflow
    Verification of existing BLE functionalities.

  • bt-adv-set_ad-len-underflow

  • bt-adv-unbounded-list

For os/net/bluetooth, it is unknown whether multi advertising was previously supported. However, since it has been modified to support only single advertising, previously functioning features may malfunction.
If the following configs are enabled, the modifications may have an impact.

- `Drivers` -> `Wireless Device Support` -> `Bluetooth Device Support`
  - `Enable BR/EDR = y`
  - `Enable BLE = y`
  - `Bluetooth Driver` -> `NULL Bluetooth device`
- `Network` -> `Bluetooth` -> `Enable Bluetooth Subsystem` (`BLUETOOTH=y`)

- In the `bledev_handle` function, `memcpy` is performed before checking the parameters of the received message. Since `memcpy` is executed for the length specified by `data_len`, if a value larger than the actual parameter is input as `data_len`,
 an overflow may occur.
- Defended against overflow by using `_memcpy_safe` instead of simple `memcpy`, ensuring that copying is not performed if the input value exceeds the actual buffer size.
…neric Bluetooth stack

- In the generic Bluetooth stack, when setting legacy advertising data, which can allocate up to 31 bytes, there is a possibility of underflow because the process of checking for cases where the data copy exceeds 31 bytes does not handle negative
numbers.
- Instead of simply checking if the remaining buffer size is zero, the code has been updated to also verify for negative values, thereby preventing underflow.
…he generic Bluetooth stack

- The existing API was implemented to receive advertising data in an array format without size restrictions, allowing for simultaneous transmission of multiple advertisements.
- Although the requirements at the time of the function's creation are unknown, to resolve the security vulnerability, it has been modified to assume support for only single advertising, starting advertising with only one raw data and one scan response.
@giwon-nam giwon-nam marked this pull request as ready for review March 11, 2026 07:32
@giwon-nam giwon-nam requested a review from hk-gwak March 11, 2026 07:43
case LWNL_REQ_BLE_SEC_PARAM_SET:
{
trble_sec_param *sec_param = (trble_sec_param *)data;
trble_sec_param sec_param = { 0, };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line looks like not only security vulnerability fix, but also changing ble behavior. Is this OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BLE functionality was verified using the TizenLite test cases based on the final build output.
To elaborate further on the modifications, after saving the pointer to the trble_sec_param structure into a local pointer variable, memcpy is performed. However, since the destination and source are identical, this operation is meaningless. Therefore, it has been modified to align with the method of copying into lwnl_msg_params.

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.

2 participants