48

Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

  • Upload
    others

  • View
    3

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is
Page 2: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Hacking challenge: steal a car!

Page 3: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Your "local partner in crime"

Sławomir Jasek

• IT security expert

• since 2005, and still loves this job

Agenda

• BLE vs security

• How to hack the car

• New tool

• Vulnerabilities examples • Smart lock • Anti-theft device • Mobile PoS • Other gadgets

• What can we do better

Page 4: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Bluetooth Smart? (aka Low Energy, 4.0...)

• Probably most thriving IoT technology • Wearables, sensors, home automation,

household goods, medical devices, door locks, alarms, banking tokens, smart every-things...

• Completely different than previous Bluetooth

Page 5: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

BLE (v4.0) security: encryption • Pairing (once, in a secure environment)

• JustWorks (R) – most common, devices without display cannot implement other

• 6-digit PIN – if the device has a display • Out of band – not yet spotted in the wild

• Establish Long Term Key, and store it to secure future communication ("bonding")

• "Just Works and Passkey Entry do not provide any passive eavesdropping protection"

Mike Ryan, https://www.lacklustre.net/bluetooth/

Page 6: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

BLE (v4.0) security in practice • 8 of 10 tested devices do not implement BLE-layer encryption

• The pairing is in OS level, mobile application does not have full control over it

• It is troublesome to manage with requirements for: • Multiple users/application instances per device

• Access sharing

• Cloud backup

• Usage scenario does not allow for secure bonding (e.g. public cash register, "fleet" of beacons, car rental)

• Other hardware/software/UX problems with pairing

• "Forget" to do it, or do not consider clear-text transmission a problem

Page 7: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

BLE (v4.0) security in practice

• Security in "application" layer (GATT)

• Various authentication schemes • Static password/key

• Challenge-response (most common)

• PKI

• Requests/responses encryption

• No single standard, library, protocol

• Own crypto, based usually on AES

Controller (firmware)

Link layer

Physical layer

Host (OS)

Host Card Interface

L2CAP

SMP ATT

GATT

UN

ENC

RYP

TED

Page 8: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is
Page 9: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Satisfies regular users, but how about you?

Page 10: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

So, how to hack the BLE car lock?

• Remote relay?

Relay Attacks on Passive Keyless Entry and Start Systems in Modern Cars http://eprint.iacr.org/2010/332.pdf

Page 11: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

So, how to hack the BLE car lock?

• Remote relay?

• Jamming?

• Brute force?

Relay Attacks on Passive Keyless Entry and Start Systems in Modern Cars http://eprint.iacr.org/2010/332.pdf

Page 12: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

So, how to hack the BLE car lock? • Remote relay?

• Jamming?

• Brute force?

• BLE sniffing?

• Mobile app analysis?

• ...

• MITM?

http://greatscottgadgets.com/ubertoothone/

Page 13: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Man in the Middle?

Alice

Bob

Mallory

Page 14: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

How to MITM: isolate the signal?

Page 15: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

How to MITM?

Stronger signal?

• Class 1 adapter? +8dBm, 100m range

"little difference in range whether the other end of the link is a Class 1 or Class 2 device as the lower powered device tends to set the range limit"

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

More signals?

And how to handle them in a single system?

Page 16: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Typical connection flow

Advertise

Connect the advertising device (MAC)

Start scanning for advertisements

Specific advertisement received, stop scanning

Further communication

Page 17: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

MITM

Start scanning for advertisements

Advertise more frequently

MITM?

Keep connection to original device. It

does not advertise while connected ;)

Specific advertisement received, stop scanning

Connect the advertising device (MAC)

Further communication

Page 18: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

New tool - architecture

Gather

advertisement and services

data for cloning

Keep connection to original device

forward req/resp

Advertise

Get serv

services Data interception

and manipulation

Advertise (high freq)

Offer exact services

Forward req/resp

Get serv

services

websockets

Page 19: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

New BLE MITM Tool – a must have for IoT tester!

• Open source

• Node.js

• Websockets

• Modular design

• Json

• .io website

• And a cool logo!

Page 20: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Car hacking challenge: authentication

Get "Challenge"

Commands (Open, Close...)

Random challenge

AES("LOGIN",AES(Challenge,key))

AES("LOGIN",

AES (Challenge,

key

NOT ENCRYPTED: Open, Close...

Page 21: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Authentication: attack?

Open

AES("LOGIN",

AES (Challenge,

key

Other cmd

MITM

Get "Challenge"

Random challenge

AES("LOGIN",AES(Challenge,key))

Page 22: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Other commands (based on mobile app): • setEngineBlockadeSetting – turn on/off

• setBlinker – blinker sequence unlocking engine

• initConfigMode – initiate the configuration – overwrite the passwords

• initiateDataTransfer – dump the whole configuration (including all passwords)

Page 23: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

PRNG?

- Is there any function which allows to generate a random number?

- There is no function to do this. However, there is a reasonably good alternative (...), which reads the module's serial number and uses the two least significant bytes, then triggers a channel 14 (temperature) ADC read and combines the two with some very basic math* to generate a sort of "multiplier seed" which can be used for randomness.

* (multiplication of the values by themselves)

https://bluegiga.zendesk.com/entries/59399217-Random-function

Page 24: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Smart lock • Challenge-response, session key

• Commands encrypted by session key

• Challenge looks random

• Ranging: GPS-enabled, you have to leave the area and return

• What could possibly go wrong?

• Let's take a look at the details...

Page 25: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Smart lock - protocol

Get "Challenge"

Challenge

SESSION KEY = AES(Challenge,

KEY

Commands AES-encrypted by session key

Page 26: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Smart lock - protocol

Get "Challenge"

Challenge

SESSION KEY = AES(Challenge,

KEY

Close lock

OK, closed

MITM (intercept,

record, pass

through)

Page 27: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Smart lock – attack

Get "Challenge"

Challenge (previously intercepted)

SESSION KEY = AES(Challenge,

KEY

Close lock

OK, closed (repeat the encrypted)

MITM (replay)

The same as recorded session

Page 28: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Smart lock – attack v2

Get "Challenge" MITM

Do not forward req to device.

Advertise status "Closed"

STALL

CLOSED

Page 29: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Smart lock – DEMO

Page 30: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Smart lock: AT commands • BLE module AT interface exposed

Page 31: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

AT commands

Page 32: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

AT commands

Page 33: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

AT commands

Page 34: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Fallback to analog key may be unavailable...

Page 35: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

DEMO: AT commands

Page 36: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

DEMO: Anti-thief

Page 37: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

DEMO: interception – static password

Page 38: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

DEMO: Mobile PoS

Page 39: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

But what about BLE encryption?

Bond – encrypted communication

Page 40: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

"Just Works"

Bond – encrypted communication

MITM

Bond – encrypted communication

?

Page 41: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is
Page 42: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Remove pairing, new connection with MITM

Bond – encrypted communication

MITM

Bond – encrypted communication

New connection

Page 43: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

PIN entry – trick into pairing again, sniff, crack

Bond – encrypted communication

MITM

Page 44: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Passive interception of pairing process

Crack the PIN using crackle

PIN entry – trick into pairing again, sniff, crack

Bond – encrypted communication

Page 45: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Some attacks • Denial of Service

• Interception

• Replay

• Authentication bypass

• Proximity actions

• Misconfiguration/excessive services abuse

• Logic flaws

• Badly designed crypto

• Brute force

• Fuzzing

• ...

Page 46: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Risk? It depends... • Your pulse indication will not have any significance for

by-passing people

• But an adversary may be extremely interested in it during negotiations

• Or, if it is used for biometric authentication in banking application

http://www.ibtimes.co.uk/fears-barack-obamas-new-fitbit-fitness-tracker-represent-national-security-risk-1492705

https://www.theguardian.com/technology/2015/mar/13/halifax-trials-heartbeat-id-technology-for-online-banking

Page 47: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

How to fix the problem? • Use the BLE encryption, bonding, random MACs properly

• Do not implement static passwords

• Design own security layers with active interception possibility in mind

• Beware excessive services, misconfiguration

• Prepare fallback for Denial of Service

• ...

• More details in whitepaper

Page 48: Hacking challenge: steal a car! Conf/Blackhat/2016/us-16-J… · BLE (v4.0) security in practice •8 of 10 tested devices do not implement BLE-layer encryption •The pairing is

Q&A? More information, these slides, whitepaper, videos, tool source code:

[email protected]