This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Issue with connection kick

Hello, 

I have a security issue with a product with nr52840 because if a hacker connect to my device  with nrf toolbox for example, when i stop the bluetooth connexion on my device, it will reconnect automatically so i can't communicate with the device.

Is there a way to prevent connexion from a device if you know its mac adress for exemple?

Thank you.

  • Hello,

    There is no such thing as a blacklist in BLE. However, you can check the BLE address of the connected device (which I assume is what you mean by MAC address) in the connection event. If this is not the device you want to connect to, you can disconnect from the device from within this event.

    There is however something called whitelisting in BLE. This is usually used together with something called bonding. But this would require you to know what device you want to connect to, by knowing the BLE address of that device. If so, you can add this address to the whitelist, and the peripheral will only accept connection requests from devices in the whitelist.

    If you do not use a whitelist when you advertise, then anyone can connect to the device, so the peripheral will have to decide whether or not to disconnect after the connection event.

    Best regards,

    Edvin

  • Okay thank you Edvin this is really helpful,

    Is it possible that the program runs without a whitelist on the beginning and that we set a whitelist after when all the devices adresses authorized are known by the device ? 

  • Yes. That is in fact the common way to do that. But note that whitelisting is typically used together with bonding (storing connection encryption for future use). If you want to try it out, you can try to connect to the ble_app_gls example example from SDK17.0.2\examples\ble_peripheral\ble_app_gls folder. Note that the first time you connect, you need to enter a 6-digit passkey that is printed in the log from the nRF, while the next time you don't need to do that. After entering this passkey, only the bonded device will be able to connect, unless you press the button2 on the DK with a long press. Look at the implementation of the BSP_EVENT_WHITELIST_OFF.

    Alternatively you can delete the bonding information by holding button 2 is held while you power on or reset the device (or erase the flash on the nRF).

    Best regards,

    Edvin

Related