espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.75k stars 739 forks source link

Feature Suggestion: Mitigations for the security issues with Bluetooth #2353

Closed hexaheximal closed 1 year ago

hexaheximal commented 1 year ago

I've had a Bangle.js 2 for a while now (since launch, actually) and while I've found it very fun, one of the things I've been concerned about is that Bluetooth is used as the only form of communication between it and an external computer, and it gives full access to the device, which would allow an attacker to easily push malicious code to the device.

I'm aware that there is support for setting a Bluetooth PIN, however it only has 10,000 combinations as it is only a 4-digit PIN, and Bluetooth has also historically had a bad history of security vulnerabilities, so I doubt the PIN would really do much in practice.

However, I'm aware of 2 ways to mitigate it, although they are not perfect solutions:

  1. Implement a killswitch that would disable Bluetooth when it is not needed. If this is implemented, there should ideally be a way to toggle certain features too in case you do want to be able to send data via Bluetooth but you don't want to enable executing code via Bluetooth.
  2. Implement a cryptography layer on top of the Bluetooth transport, so that all data is encrypted and an attacker cannot send malicious commands or sniff the packets. This would be the best solution, but would be hard to implement.

I think that implementing a mitigation for the issues with Bluetooth (especially the second one I mentioned) would significantly improve the security of bluetooth-based Espruino devices.

gfwilliams commented 1 year ago

Hi, I really think you're being overly paranoid here. Bluetooth LE is used by billions of devices, and I think there would be a bigger uproar if there were realistically exploitable issues if it was set up properly.

The PIN is 6 digits, and enabling it also forces the need for encryption on the data channel to the Bangle. I really think the encryption used which has been tested on all those billions of devices is superior to what we might be able to come up with - but everything is open so if you really want to implement something on top, you're more than welcome to.

Connecting and pairing takes maybe 2 seconds at least, so for someone to brute-force all 1 million pairing keys would take them a month, 24 hours a day, within range of your disconnected Bangle.

If you wished, you could come up with an app which cycled the pairing key automatically every day too.

Implement a killswitch that would disable Bluetooth when it is not needed.

So honestly, it seems like there are more security options than you thought, and I don't think there's much extra I can really add for the Bangle here. If you want to add extra features on top yourself, you're welcome to though.