mynewt-nimble icon indicating copy to clipboard operation
mynewt-nimble copied to clipboard

Notifications are a free for all, security be damned.

Open fhars opened this issue 2 months ago • 1 comments

Nimble automatically creates a Client Configuration Characteristic for every Characteristic that allows notifications or indications that is writeable without encryption or authentication:

https://github.com/apache/mynewt-nimble/blob/c802fe74b3034bd163f98e1de5761ac216ba43d6/nimble/host/src/ble_gatts.c#L823

This allows any connected client to subscribe to any notification and get the values in plain text, independent of the confidentiality settings of the characteristic itself.

It should probably set the appropriate BLE_ATT_F_READ_* and BLE_ATT_F_WRITE_* flags if any of BLE_ATT_F_READ_{ENC,AUTHEN,AUTHOR} is set for the base characteristic.

fhars avatar Nov 04 '25 12:11 fhars

Hi,

CCCD is required by spec to be readable without authentication or authorization... This would probably require a bit more rework on how this is handled in stack.

As a quick workaround I'd suggest to not use ble_gatts_chr_updated() and use ble_gatts_notify_custom() with txom provided by caller. In such case application would be able to validate security before sending notification.

Image

sjanc avatar Dec 12 '25 15:12 sjanc