dwyl / learn-security

:closed_lock_with_key: For most technology projects Security is an "after thought", it does not have to be that way; let's be proactive!
67 stars 10 forks source link

Can we use Bluetooth in High Security Applications? #75

Open nelsonic opened 4 years ago

nelsonic commented 4 years ago

We are planning to use Bluetooth Low Energy (BTLE) to authenticate people via their Phone (or other BTLE capable device) in order to enter the house @home.

door-diagram

We know this is how the keyless entry works on Tesla Model 3: https://www.tesla.com/support/car-safety-security-features image

We need to investigate if the Bluetooth Identifier for the device can bee spoofed or if there is any way to crack the data transmission. We are going to be entrusting a lot of value into this system so we need to know that the foundations we are building on are rock solid.

So far this is what I've read:

Todo

th0mas commented 4 years ago

From the (small) amount of research I've done the general consensus is that Bluetooth 4 / Bluetooth low energy is "secure". However i'm not sure how well Bluetooth stands up to replay and man-in-the-middle attacks.

I think by treating Bluetooth as an insecure protocol we gain several benefits:

I believe we could easily implement a challenge response protocol over Bluetooth that would be plenty secure enough for use on a door lock.

Sharing private keys in a initial setup phase could easily be done over WiFi or, if needed, the wider internet over TLS.

Challenge-Response

  1. App asks the door to unlock over BLE
  2. The door responds with a randomly generated number
  3. The App signs this number with a shared/private key
  4. The door then verifies the signature before unlocking

This may be vulnerable to Relay attacks, but this could be pretty easily mitigated by adding a timestamp to the signed response number, making it impossible to use stored responses at a later date.

There is an industry standard protocol based on this, Kerberos, but it looks a bit heavy handed for our usage.

Other solution

This is arguably less secure, but is simpler (less to go wrong) and plenty "good enough" - especially if we presume Bluetooth has good security on top of this.

  1. App signs the current time and date and sends an unlock command over BLE.
  2. Door checks signature and makes sure time is within bounds before unlocking.

This however, won't work if the door does not have a reliable way to keep time.


The running theme of the research on "Smart Door Locks" I've done so far is the biggest vulnerability is the locks themselves to "low tech" attacks. Some of the most cryptographically secure locks on the market are vulnerable to simple attacks with screwdrivers.

Remote entry is a hard problem, Tesla, VW, Citroen, Ford and Peugeot have struggled to use an implement secure systems.

Its worth remembering that most physical locks are also vulnerable to picking and other physical attacks, so your not gaining or loosing any "real world" security by making a well-implemented smart lock.


Some interesting reading on remote access systems, some aren't Bluetooth based but still give a good overview of why remote locks are so hard to do properly.

https://morphuslabs.com/hacking-the-nok%C4%93-padlock-adfe7b1b5617 - Hacking a BLE padlock - used a hardcoded key however so this shouldn't apply to a challenge-response solution.

https://www.cs.bham.ac.uk/~oswalddf/publications/2016_usenix_lock_it_and_still_lose_it.pdf - A research paper on various car keys.

https://eprint.iacr.org/2010/332.pdf - Another research paper targeting car keys.

th0mas commented 4 years ago

Also interesting, slides from Black Hat 2016 documenting attacks on Bluetooth 4: https://github.com/securing/docs/blob/master/slides.pdf

and the associated white paper: https://github.com/securing/docs/blob/master/whitepaper.pdf

nelsonic commented 4 years ago

Hi @th0mas thanks very much for doing some initial investigation on this! šŸ„‡ I read through the links you shared; the slides and whitepaper.pdf and both are insightful. šŸ‘ Had a look at https://gattack.io & https://github.com/securing/gattacker And my takeaway is that attacks are most effective during the initial pairing. MITM attacks rely on there being no encryption implemented between devices. A DOS via signal jamming attack is not one that concerns us as it requires reasonable technical sophistication and does not have a payoff for the attacker beyond service disruption.

The tech we want to use is not regular Bluetooth but rather BLE Beacons as per the diagram above. But what I got wrong is that we don't want the Phone to be the beacon but rather the phone to be the reader and the Raspberry Pi to be the Beacon. More info to follow in a revised diagram.

Meanwhile if you are new to BLE Beacons, this is a good intro: image https://youtu.be/L44m7otNI7o

nelsonic commented 4 years ago

https://en.wikipedia.org/wiki/Bluetooth_low_energy_beacon

nelsonic commented 4 years ago

image https://youtu.be/SzUJho0uGRs

Annoyingly the video creator did not link to any blog post or GitHub repo so this is only a demo, not a tutorial.

This video actually links to source: image https://youtu.be/bAcK80fm1_0 https://github.com/HackerShackOfficial/Smartphone-Doorlock I'm not as fussed about the code, doubt we will be able to re-use any of it.