travis goodspeed - not quite zigbee

106
22 April 2010 -- Source Boston Not Quite ZigBee; or, How to Sniff a Strange Radio Travis Goodspeed [email protected] Open with “Why should you give a shit?” List of Exploits

Upload: source-conference

Post on 14-May-2015

1.458 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Travis Goodspeed - Not Quite ZigBee

22 April 2010 -- Source Boston

Not Quite ZigBee; or,How to Sniff a Strange Radio

Travis [email protected]

Open with “Why should you give a shit?”

List of Exploits

Page 2: Travis Goodspeed - Not Quite ZigBee

Introduction

✤ Wifi

✤ Bluetooth

✤ Ubertooth

✤ ZigBee

✤ KillerBee, GoodFET, Freakduino Chibi, Daintree

✤ What about everything else?

Page 3: Travis Goodspeed - Not Quite ZigBee

Introduction

✤ This is not a USRP lecture.

✤ Weird radios are usually one-off designs.

✤ Bad cryptography, if any.

✤ Little testing, quality control.

✤ Vulnerabilities inherited from the chipset.

Page 4: Travis Goodspeed - Not Quite ZigBee

Citations

✤ Max Moser and Thorsten Schröder

✤ Michael Ossmann

✤ Read my articles for the rest,http://travisgoodspeed.com

Page 5: Travis Goodspeed - Not Quite ZigBee

Example Targets

✤ Radio Remote Controls

✤ Apple/Nike+ Shoe Pod

✤ Garmin ANT+ Watch

✤ Microsoft Keyboard

Page 6: Travis Goodspeed - Not Quite ZigBee

Methodology

✤ Dissect a device.

✤ Part numbers, chip die photographs, firmware.

✤ Determine radio encoding, rate, and frequency.

✤ 2FSK, 2Mbps, 2.4GHz

✤ QPSK, 1Mbps, 2.4GHz

✤ Build a transceiver.

Page 7: Travis Goodspeed - Not Quite ZigBee
Page 8: Travis Goodspeed - Not Quite ZigBee

Part Numbers

✤ CC2420, EM250, A7125

✤ Uniquely identify the part, index the datasheet.

✤ Vulnerabilities are indexed by part number, not product name.

✤ Sometimes they are missing or ground off.

✤ HNO3 and H2SO4 are your friends!

Page 9: Travis Goodspeed - Not Quite ZigBee

Datasheets

✤ Describe registers and pins.

✤ Sometimes private, but often public.

✤ Read the whole damned thing, and you’re secure to find bugs.

✤ Also read the errata sheets.

✤ For this chip and its ancestors.

Page 10: Travis Goodspeed - Not Quite ZigBee

Datasheets

Page 11: Travis Goodspeed - Not Quite ZigBee
Page 12: Travis Goodspeed - Not Quite ZigBee
Page 13: Travis Goodspeed - Not Quite ZigBee

Die Badges

✤ Identify the internal part number.

✤ Sometimes this is the public one.

✤ Sometimes it isn’t.

✤ Animals, Logos

✤ Lot numbers.

Page 14: Travis Goodspeed - Not Quite ZigBee

TI/Chipcon CC1110

Page 15: Travis Goodspeed - Not Quite ZigBee
Page 16: Travis Goodspeed - Not Quite ZigBee

Amiccon 7125

Page 17: Travis Goodspeed - Not Quite ZigBee

Amiccon 7125

Page 18: Travis Goodspeed - Not Quite ZigBee

nRF24L01+

Page 19: Travis Goodspeed - Not Quite ZigBee

Ember EM357

Page 20: Travis Goodspeed - Not Quite ZigBee

Ember EM357 Magnum

Page 21: Travis Goodspeed - Not Quite ZigBee

Mystery 2.4GHz Radio

✤ Logo first.

✤ Inductors.

✤ Lollypops!

✤ Fill Pattern

nRF24E1G

Page 22: Travis Goodspeed - Not Quite ZigBee

✤ ffo

Page 23: Travis Goodspeed - Not Quite ZigBee

Mystery vs. CC1110

Page 24: Travis Goodspeed - Not Quite ZigBee

Mystery vs. EM357

Page 25: Travis Goodspeed - Not Quite ZigBee

Mystery vs. nRF24L01+

Page 26: Travis Goodspeed - Not Quite ZigBee
Page 27: Travis Goodspeed - Not Quite ZigBee
Page 28: Travis Goodspeed - Not Quite ZigBee

Mystery vs. nRF24L01+

Page 29: Travis Goodspeed - Not Quite ZigBee

Meet the Lineup

✤ Chipcon

✤ Nordic RF

✤ Amiccom

✤ Others

Page 30: Travis Goodspeed - Not Quite ZigBee

Chipcon ISM Band

✤ CC1100, 2500 radio.

✤ CC1110, 2500 system-on-chip.

✤ Very configurable.

✤ CC1110 talks to anything sub-GHz.

✤ Undocumented 4FSK, use register settings for CC1101.

Page 31: Travis Goodspeed - Not Quite ZigBee
Page 32: Travis Goodspeed - Not Quite ZigBee

Nordic RF

✤ Microsoft Keyboards, Mice

✤ OpenBeacon

✤ Sparkfun Keyfob

✤ ANT+, Nike+

✤ No promiscuous mode.

✤ There’s a hack, but it’s ugly.

✤ Not very configurable:

✤ 2FSK, fixed deviation.

✤ Integer MHz channels.

Page 33: Travis Goodspeed - Not Quite ZigBee
Page 34: Travis Goodspeed - Not Quite ZigBee
Page 35: Travis Goodspeed - Not Quite ZigBee

Amiccom A7125

✤ 2.4GHz, 2FSK

✤ Doccos in English, Chinese

✤ Unbuffered mode for outputting symbols directly.

✤ 2 million symbols/second!

✤ Handy, but not necessary, for prom. sniffing of Nordic traffic.

Page 36: Travis Goodspeed - Not Quite ZigBee

Modulation Schemes

✤ Frequency Shift Keying (FSK)

✤ Cheap digital radios, Bluetooth.

✤ Amplitude Shift Keying (ASK, OOK)

✤ Car remotes, garage door openers.

✤ Phase Shift Keying (PSK)

✤ Wifi, ZigBee

✤ Complicated variations of each.

Page 37: Travis Goodspeed - Not Quite ZigBee

Frequency Shift Keying

✤ Symbol Rate: Integer or floating?

✤ Frequency: Integer or fractional?

✤ SYNC: Configurable? Repurposed as the address?

✤ Deviation: Space between highest and lowest symbol.

✤ Encoding:

✤ 2FSK: Low frequency is zero, high frequency is 1.

✤ 4FSK: +1, +1/3, -1/3, -1

Page 38: Travis Goodspeed - Not Quite ZigBee

Getting a radio board.

✤ Chips are difficult to use directly.

✤ QFN or BGA chip packages.

✤ Radio layout requires a custom board.

✤ Modules are available with radio and analog chain.

✤ Often lack an MCU, so use a GoodFET.

✤ Commercial boards are often useful.

✤ GirlTech IMME, Next Hope Badge

Page 39: Travis Goodspeed - Not Quite ZigBee
Page 40: Travis Goodspeed - Not Quite ZigBee
Page 41: Travis Goodspeed - Not Quite ZigBee
Page 42: Travis Goodspeed - Not Quite ZigBee
Page 43: Travis Goodspeed - Not Quite ZigBee
Page 44: Travis Goodspeed - Not Quite ZigBee
Page 45: Travis Goodspeed - Not Quite ZigBee
Page 46: Travis Goodspeed - Not Quite ZigBee
Page 47: Travis Goodspeed - Not Quite ZigBee
Page 48: Travis Goodspeed - Not Quite ZigBee
Page 49: Travis Goodspeed - Not Quite ZigBee
Page 50: Travis Goodspeed - Not Quite ZigBee
Page 51: Travis Goodspeed - Not Quite ZigBee
Page 52: Travis Goodspeed - Not Quite ZigBee

Configuring the Radio

✤ All digital radios are configured by Special Function Registers (SFR).

✤ Register settings can come from multiple sources:

✤ SmartRF Studio configuring TI/Chipcon radios.

✤ Datasheets

✤ Ask Ossmann

Page 53: Travis Goodspeed - Not Quite ZigBee
Page 54: Travis Goodspeed - Not Quite ZigBee
Page 55: Travis Goodspeed - Not Quite ZigBee

✤ RF Parameters

✤ Register Addresses

✤ Register Values

Page 56: Travis Goodspeed - Not Quite ZigBee

Always bring it back to Python

Page 57: Travis Goodspeed - Not Quite ZigBee

GoodFET Radio Architecture

✤ Firmware in C, client in Python.

✤ Py2Exe port for Win32.

✤ Only tested on the Chinese build.

✤ Firmware is trimmed to support only the needed drivers.

✤ New drivers can be written in pure-Python.

✤ Port functions to C as needed.

Page 58: Travis Goodspeed - Not Quite ZigBee

Turning Point Clicker

✤ Classroom remote control.

✤ Attendance, Quizzing

✤ Nordic nRF24E1G

✤ 8051 MCU

✤ 2.4GHz Radio

✤ External Flash

Page 59: Travis Goodspeed - Not Quite ZigBee
Page 60: Travis Goodspeed - Not Quite ZigBee
Page 61: Travis Goodspeed - Not Quite ZigBee
Page 62: Travis Goodspeed - Not Quite ZigBee

Radio+8051 MCU

SPI ROM

Page 63: Travis Goodspeed - Not Quite ZigBee

Dumping Firmware

✤ Chips

✤ nRF24E1G -- 8051 MCU + nRF2401 Radio

✤ 24C32 Boot Rom

✤ Documentation

✤ Datasheets, Reference Design

Page 64: Travis Goodspeed - Not Quite ZigBee

nRF24E1

✤ 8051 Microcontroller

✤ More popular than ARM and X86.

✤ Internal nRF2401 Radio

✤ 1Mbps GFSK Radio

✤ 2.4 to 2.5 GHz, 1MHz Channel Spacing

✤ No internal Flash. Boots from external EEPROM.

✤ No promiscuous mode. (The hack comes later.)

Page 65: Travis Goodspeed - Not Quite ZigBee

Radio+8051 MCU

SPI ROM

Page 66: Travis Goodspeed - Not Quite ZigBee

nRF24E1 Firmware in IDA

✤ ``goodfet.spi25c dump clicker.hex’’

✤ Copy all but first 7 bytes to clicker.bin.

✤ Load clicker.bin to CODE memory at 0x0000.

Page 67: Travis Goodspeed - Not Quite ZigBee

Just 3kB of Code

Page 68: Travis Goodspeed - Not Quite ZigBee

nRF24E1 Internal Arrangement

✤ 8051 MCU

✤ Internal SPI Bus

✤ RADIO register #0x80

Page 69: Travis Goodspeed - Not Quite ZigBee

Useful Registers

✤ SPI_DATA, SPICLK, SPI_CNTRL, EXIF

✤ P1 LED Port

✤ P0.0 SPI EEPROM Slave Select

✤ RADIO #0x80

✤ RADIO.3 is Radio Slave Select

✤ RADIO.7 is Power Up

Page 70: Travis Goodspeed - Not Quite ZigBee

From Registers to Functions

Page 71: Travis Goodspeed - Not Quite ZigBee

RADIOWRCONFIG

✤ Just a lot of SPIRXTX.

✤ 08 08 00 00 00 00 00 00 00

✤ (1B) (1C) (1D)

✤ 63 6F

✤ (1A)+1

Page 72: Travis Goodspeed - Not Quite ZigBee

Data Width

ADRADR WidthCRC LEN

Config Channel

Page 73: Travis Goodspeed - Not Quite ZigBee

RADIOWRCONFIG

✤ Just a lot of SPIRXTX.

✤ 08 08 00 00 00 00 00 00 00

✤ (1B) (1C) (1D)

✤ 63 6F

✤ (1A)+1

✤ Channel at 0x1A

✤ MAC at 0x1B, 0x1C, 0x1D

✤ 4 bytes of data

✤ 1 byte checksum

Page 74: Travis Goodspeed - Not Quite ZigBee

Transmission

✤ Function takes one byte of input.

✤ Repeated calls to SPITXRX

✤ (1E) (1F) (20) //Destination MAC Address

✤ (1B) (1C) (1D) //Source MAC Address

✤ (input) //Button Code

Page 75: Travis Goodspeed - Not Quite ZigBee

Destination MAC at 1E, 1F, 20

✤ MOV 0x1E, #0x12

✤ MOV 0x1F, #0x34

✤ MOV 0x20, #0x56

✤ DMAC is 0x123456

✤ Payload length is 4 bytes.

✤ One byte checksum.

Page 76: Travis Goodspeed - Not Quite ZigBee

Turning Point Sniffing

✤ 2.441 GHz, 1Mbps

✤ Address: [0x12, 0x34, 0x56]

✤ Payload:

✤ 3 byte MAC

✤ 1 byte Button (ASCII)

Page 77: Travis Goodspeed - Not Quite ZigBee
Page 78: Travis Goodspeed - Not Quite ZigBee

Load the Registers by GoodFET

Page 79: Travis Goodspeed - Not Quite ZigBee
Page 80: Travis Goodspeed - Not Quite ZigBee

Microsoft Keyboard

✤ 2.4GHz Nordic, XOR crypto

✤ SYNC varies by unit.

✤ Again, there’s no promiscuous mode.

✤ Initial Exploit in Keykeriki 2.0

✤ Max Moser and Thorsten Schröder

✤ Amiccom A7125, nRF24L01+

Page 81: Travis Goodspeed - Not Quite ZigBee

Holy crap that’s bad crypto!

Page 82: Travis Goodspeed - Not Quite ZigBee

Promiscuity is a Citizen’s Duty

✤ If the crypto is so bad, why is it hard to sniff?

✤ SYNC field is unique to the unit.

✤ Receiver must know the SYNC to receive a packet.

✤ Two solutions:

✤ 1) Search raw radio traffic for Preamble. (Keykeriki)

✤ 2) Use the preamble as if it were a SYNC. (GoodFET)

Page 83: Travis Goodspeed - Not Quite ZigBee

Schröder and Moser’s Solution

✤ A7125 samples raw bits at 2Mbps.

✤ ARM CPU looks for Preamble.

✤ When the MAC is found,

✤ Load nRF24L01+ to sniff.

✤ Dump to PC for interpretation.

✤ Can it be cheaper?

Page 84: Travis Goodspeed - Not Quite ZigBee

GoodFET Autotune

✤ Reduce MAC length to two bytes.

✤ Disable checksums.

✤ Set MAC to 0x0055 or 0x00AA.

✤ Count occurrences of 5-byte sequences:

✤ Might by shifted off by a bit.

✤ Filter out noise.

Page 85: Travis Goodspeed - Not Quite ZigBee

GoodFET Autotune

Page 86: Travis Goodspeed - Not Quite ZigBee

GoodFET Autotune

Page 87: Travis Goodspeed - Not Quite ZigBee
Page 88: Travis Goodspeed - Not Quite ZigBee
Page 89: Travis Goodspeed - Not Quite ZigBee

Conclusions

Page 90: Travis Goodspeed - Not Quite ZigBee

Sidebar

✤ Somehow we have time left.

✤ Let’s not waste it.

Page 91: Travis Goodspeed - Not Quite ZigBee
Page 92: Travis Goodspeed - Not Quite ZigBee
Page 93: Travis Goodspeed - Not Quite ZigBee
Page 94: Travis Goodspeed - Not Quite ZigBee
Page 95: Travis Goodspeed - Not Quite ZigBee
Page 96: Travis Goodspeed - Not Quite ZigBee
Page 97: Travis Goodspeed - Not Quite ZigBee
Page 98: Travis Goodspeed - Not Quite ZigBee
Page 99: Travis Goodspeed - Not Quite ZigBee
Page 100: Travis Goodspeed - Not Quite ZigBee
Page 101: Travis Goodspeed - Not Quite ZigBee
Page 102: Travis Goodspeed - Not Quite ZigBee
Page 103: Travis Goodspeed - Not Quite ZigBee
Page 104: Travis Goodspeed - Not Quite ZigBee
Page 105: Travis Goodspeed - Not Quite ZigBee
Page 106: Travis Goodspeed - Not Quite ZigBee