Slide 1

Slide 1 text

BTLEJUICE: THE BLUETOOTH SMART MITM FRAMEWORK DAMIEN CAUQUIL - CERT-UBIK

Slide 2

Slide 2 text

/ME Senior researcher at CERT-UBIK (ECONOCOM) Head of Research and Development Focus on Bluetooth Smart since 2014 Twitter (me): @virtualabs Twitter CERT-UBIK: @iotcert

Slide 3

Slide 3 text

AGENDA Bluetooth Smart (or Low Energy) 101 Bluetooth Smart vs. Bluetooth Classic Why sniffing sucks Man-in-the-Middle attacks on BTLE BtleJuice MitM framework Live demos !

Slide 4

Slide 4 text

BLUETOOTH SMART (LE) 101

Slide 5

Slide 5 text

BLUETOOTH CLASSIC VS. BLUETOOTH SMART Both defined in the Bluetooth 4.0+ Specs Bluetooth Smart was designed for low power devices (Low Energy) Bluetooth Smart is lighter than Bluetooth Classic Bluetooth Smart is widely used in tiny embedded devices

Slide 6

Slide 6 text

MANY BLUETOOTH SMART DEVICES USE BTLE

Slide 7

Slide 7 text

BLUETOOTH CLASSIC VS. BLUETOOTH SMART

Slide 8

Slide 8 text

BLUETOOTH SMART MAIN FEATURES Frequency Hopping Spread Spectrum to avoid interferences (FHSS) Encrypted communications (Security Manager Protocol) Simple communications through Services and characteristics (GAP/GATT) One connection at a time

Slide 9

Slide 9 text

FREQUENCY HOPPING SPREAD SPECTRUM Devices synchronize first ... ... then both of them hop from channel to channel Difficult to sniff an existing connection between two devices !

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

SECURITY MANAGER PROTOCOL

Slide 13

Slide 13 text

SECURITY MANAGER PROTOCOL Devices exchange pairing information (JustWorks, PIN, OOB) Devices authenticate the link Keys are distributed and long-term keys stored One must sniff this exchange to break the encryption keys (CrackLE)

Slide 14

Slide 14 text

THE HARD TRUTH IS: Few devices use encryption but do not require it (failed pairing is OK) Almost all devices are not strongly authenticated by mobile applications or other devices BD address is o en the only check performed to ensure authenticity Sniffing-based attacks are difficult to perform in the wild

Slide 15

Slide 15 text

BLUETOOTH SMART MAN-IN-THE-MIDDLE

Slide 16

Slide 16 text

WHY BTLE SNIFFING SUCKS Ubertooth: $120 Adafruit Bluefruit sniffer: $30 (non-standard PCAP) btproxy: only works for Bluetooth Classic, not BTLE Encryption: sniff first then decrypt

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

BLUETOOTH SMART MAN-IN-THE-MIDDLE 1. Connect to the device 2. Create a dummy device with same services and characteristics 3. Wait for connection and forward

Slide 19

Slide 19 text

INTRODUCING BTLEJUICE FRAMEWORK Noble for central and Bleno for dummy Standard BT 4.0+ adapters for both central and dummy Websocket to forward GATT operations (and more) Supports bonding (JustWorks) for Bluez 5.x and Linux kernel 4.x

Slide 20

Slide 20 text

ARCHITECTURE

Slide 21

Slide 21 text

HOLD ON, A SIMILAR TOOL EXISTS ! Presented @ BHUSA 2016 by Slawomir Jasek I just discovered it yesterday (thanks to its author) Same libs, same requirements I just discovered it yesterday (thanks to its author) Same goal, different tools More tricks with Bleno and Noble http://www.gattack.io/ https://en.wikipedia.org/wiki/Multiple_discovery

Slide 22

Slide 22 text

EASY SETUP $ s u d o a p t - g e t i n s t a l l b l u e t o o t h b l u e z \ l i b b l u e t o o t h - d e v l i b u d e v - d e v $ s u d o n p m i n s t a l l - g b t l e j u i c e

Slide 23

Slide 23 text

BTLEJUICE WEB UI (uses Ange Albertini's HEXII)

Slide 24

Slide 24 text

BTLEJUICE FEATURES Live GATT operations and data sniffing Burp-like interception mode allows data manipulation Web user interface Python bindings (2.x & 3.x) Node.js bindings (ES6)

Slide 25

Slide 25 text

REQUIREMENTS Two-machine setup (we can use a VM too) Two Bluetooth 4.0+ adapters (CSR 4.0+ ideally) Node >= v4.3.0

Slide 26

Slide 26 text

MAN-IN-THE-MIDDLE BENEFITS Works with any Bluetooth 4.0+ adapters Intercepting GATT reads and writes are way easier Supports bonding/encryption ! Compatible with tests using a Faraday cage BD address spoofing is possible =)

Slide 27

Slide 27 text

CREATING THE PERFECT DUMMY (OR HOW TO CLONE A DEVICE) Connect BtleJuice Proxy to target device ... No more advertisement, frequency hopping active ! BD address can be spoofed using CSR adapters We can advertise a new device with same address while connected to the original one ὠ

Slide 28

Slide 28 text

PYTHON BINDINGS class MySniffingInterface(SniffingInterface): def __init__(self, host, port, target): SniffingInterface.__init__(self, host, port, target) def on_data_read(self, service, characteristic, data): print('[<][%s - %s] %s' % (service, characteristic, data)) def on_data_write(self, service, characteristic, data, offset, without print('[>][%s - %s] %s' % (service, characteristic, data)) def on_notification_data(self, service, characteristic, data): print('[!][%s - %s] %s' % (service, characteristic, data)) def on_subscribe_notification(self, service, characteristic, enabled): print('[N][%s - %s] %s' % (service, characteristic, enabled))

Slide 29

Slide 29 text

NODE.JS BINDINGS class MySniffingInterface extends btlejuice.SniffingInterface { onClientConnected(client) { console.log('** Connection from '+client); } onClientLeft(client) { console.log('** Disconnection from '+client); } onRead(service, characteristic, data) { console.log('[<][%s - %s] %s', service, characteristic, hexiify(data)) } onWrite(service, characteristic, data) { console.log('[>][%s - %s] %s', service, characteristic, hexiify(data)) }

Slide 30

Slide 30 text

ON-THE-FLY DATA MODIFICATION def on_before_read(self, service, characteristic, offset): if service.lower() == '180f' and \ characteristic.lower()=='2a19': self.batt_level -= 1 if self.batt_level < 0: self.batt_level = 100 raise HookForceResponse(chr(self.batt_level)) def on_before_subscribe(self, service, characteristic, enabled): # dismiss raise HookForceResponse()

Slide 31

Slide 31 text

KNOWN LIMITATIONS Noble does not support long writes (>22 bytes) Induced latency (BTLE to websocket then back to BTLE) May be tricky to use when devices keep connections or advertise during a short delay

Slide 32

Slide 32 text

BTLEJUICE LIVE

Slide 33

Slide 33 text

MY TEST DEVICES Device Bonding Auth Interception Replay Gablys Lite ? ? ? ? Wistiki ? ? ? ? MasterLock 4400D ? ? ? ? Padlock ? ? ? ? Smartlock ? ? ? ?

Slide 34

Slide 34 text

DEMO: GABLYS LITE

Slide 35

Slide 35 text

GABLYS LITE Bonding supported, but not required No strong authentication Anyone may make this tag beep Denial of service attack found through replay

Slide 36

Slide 36 text

DEMO: WISTIKI

Slide 37

Slide 37 text

WISTIKI Bonding required Bonding provides strong authentication Tag is declared lost when connection is lost

Slide 38

Slide 38 text

MY TEST DEVICES Device Bonding Auth Interception Replay Gablys Lite NO ADDRESS YES YES Wistiki REQUIRED STRONG NO NO MasterLock 4400D ? ? ? ? Padlock ? ? ? ? Smartlock ? ? ? ?

Slide 39

Slide 39 text

MASTERLOCK 4400D Encrypted communications (AES-CCM) No bonding required Authentication through challenge/response Long writes through characteristics Available a short amount of time

Slide 40

Slide 40 text

DEMO: PADLOCK

Slide 41

Slide 41 text

PADLOCK Everything sent in plaintext Authentication based on BD address No bonding required Stays active once a client connected

Slide 42

Slide 42 text

MY TEST DEVICES Device Bonding Auth Interception Replay Gablys Lite NO ADDRESS YES YES Wistiki REQUIRED STRONG NO NO MasterLock 4400D NO STRONG NO NO Padlock NO ADDRESS YES YES Smartlock ? ? ? ?

Slide 43

Slide 43 text

SMARTLOCK Data partly transmitted unencrypted Authentication based on advertisement data No bonding required

Slide 44

Slide 44 text

MY TEST DEVICES Device Bonding Auth Interception Replay Gablys Lite NO ADDRESS YES YES Wistiki REQUIRED STRONG NO NO MasterLock 4400D NO STRONG NO NO Padlock NO ADDRESS YES YES Smartlock NO ADVERT. YES YES

Slide 45

Slide 45 text

SUMMARY

Slide 46

Slide 46 text

BTLEJUICE AS A SECURITY TOOL Useful to determine a device's behavior Allows data sniffing and manipulation Allows replay attacks Supports bonding

Slide 47

Slide 47 text

BTLEJUICE AS AN ATTACK TOOL Can bypass BD address authentication Can be instrumented to automate attacks Requires generic hardware but at least two machines Known limitations due to Noble and Bleno limitations

Slide 48

Slide 48 text

FUTURE WORK Improve BtleJuice's proxy reliability Solve the two-machine problem Improve user interfaces and bindings Moar testing (need feedback !)

Slide 49

Slide 49 text

QUESTIONS ?

Slide 50

Slide 50 text

CONTACT [email protected] @virtualabs (https://twitter.com/virtualabs) @iotcert (https://twitter.com/iotcert)

Slide 51

Slide 51 text

USEFUL LINKS https://github.com/DigitalSecurity/btlejuice https://github.com/DigitalSecurity/btlejuice-node-bindings https://github.com/DigitalSecurity/btlejuice-python-bindings http://www.silabs.com/Support%20Documents/RegisteredDocs/UG103.14.pd https://www.bluetooth.com/specifications/adopted-specifications http://lacklustre.net/projects/crackle/ http://www.gattack.io/