HackInTheBox Amsterdam 2019 training
Blue Oceans: Advanced Attacks Against BLE, NFC, HCE and more
Bluetooth Low Energy is one of the most exploding IoT technologies. BLE devices surround us more and more - not only as wearables, toothbrushes and sex toys, but also smart locks, medical devices and banking tokens. Alarming vulnerabilities of these devices have been exposed multiple times recently. And yet, the knowledge on how to comprehesively assess their security seems very uncommon. Not to mention best practices guidelines, which are practically absent.
This is probably the most exhaustive and up to date training regarding BLE security - for both pentesters and developers. Compressing years of painful debugging and reversing into practical, useful checklists. Based on hands-on exercises on real devices (including multiple smart locks) as well as a deliberately vulnerable, training hackmelock.
NFC, on the other hand, has been around us for quite long. However, the vulnerabilities pointed out years ago, probably won’t be resolved in a near future. It is still surprisingly easy to clone most access control cards used for buildings today. Among other practical exercises performed on real installations, the attendees will reverse an example hotel access system, and as a result will be able to open all the doors in facility.
With prevalence of NFC smartphones, a new implementation of this technology is recently gaining attention: mobile contactless payments/access control. Using combination of cloud services and mobile security, it is now possible to embed credit card (or NFC key to a lock) in your phone. Is the technology as robust as advertised? How to check its security, and how to implement it correctly? Find out during practical exercises, including step by step guide on how to bypass security mechanisms and clone a contactless payment card,
Each attendee will receive worth over 300 EUR hardware pack including among others Proxmark 3, a rooted Android smartphone and Raspberry Pi (detailed below). The hardware will allow for BLE analysis (sniffing, intercepting), cloning and cracking multiple kinds of proximity cards, analyse BLE or NFC mobile applications, and practice most of the training exercises later at home.
Who should attend
- Pentesters, security professionals, red teamers, researchers
- BLE Device designers, developers
- Mobile contactless payments integrators, managers, security team members
Key learning objectives
- In-depth knowledge of Bluetooth Low Energy, common implementation pitfalls, device assessment process and best practices for implementation
- Ability to identify vulnerable access control systems, clone cards and reverse-engineer data stored on card
- Understanding mobile contactless payments technology, possible attacks, risks and countermeasures
Prerequisite knowledge
- Basic familiarity with Linux command-line, Kali
- Scripting skills, pentesting experience, Android mobile applications security background will be an advantage, but is not crucial
Hardware/software requirements
- Contemporary laptop capable of running Kali Linux in virtual machine, and at least two USB ports available for VM guest
- You can bring your own BLE device or access control card to check its security
Each student will receive
- Course materials in PDFs (several hundred pages)
- All required additional files: source code, documentation, installation binaries, virtual machine images on a pendrive
- Take-away hardware pack for hands-on exercises consisting of:
- Rooted NFC- and BLE-capable Android smartphone with all the required applications; root-hiding and device characteristics spoofing frameworks configured
- Proxmark 3 with latest firmware
- Multiple RFID/NFC tags for cracking and cloning, including “Chinese magic UID”, T5577, Ultralight, HID Prox, iClass, EV1, Mifare Classic with various content (bus ticket, hotel, e-wallet, …)
- NFC PN532 board (libnfc)
- Raspberry Pi 3 (+microSD card and 3.1A power adapter), with assessment tools and Hackmelock installed for further hacking at home.
- Bluetooth Smart hardware sniffer (nRF, BtleJack) based on nrf51822 module
- Individual BLE device to attack running on development kit (including source code)
- ST-Link V2 SWD debugger for programming nRF boards
- 2 Bluetooth Low Energy USB dongles
Detailed agenda
Day 1
Bluetooth Smart (Low Energy)
Based on about 10 various smart locks, beacons, mobile PoS, banking token, various other devices, and tools developed by the trainer: GATTacker BLE MITM proxy and deliberately vulnerable Hackmelock (consisting of Android mobile application and lock device simulated on Raspberry Pi).
Theory introduction
- What is Bluetooth Smart/Low Energy/4.0, how it is different from previous Bluetooth versions?
- Usage scenarios, prevalence in IoT devices
- Protocol basics
- Advertisements, connections
- Central vs peripheral device
- GATT - services, characteristics, descriptors, handles Security features - pairing/encryption, whitelisting, MAC randomization Security in practice: own crypto in application layer hardware required for BLE assessment
BLE beacons
- iBeacon, Eddystone, Physical Web
- Simulating beacons - using mobile phone, Linux scripts, other devices.
- How to get free beer by abusing beacon-based reward application
- “Encrypted” beacons
- Abusing weaknesses in beacon management control protocols
Other BLE advertisements
- scanning for visible devices, hcitool, bleah, GATTacker, …
- decoding data in advertisements
- advertisement spoofing - Denial of Service, device impersonation
Sniffing BLE connections using RF layer hardware
- Ubertooth, Adafruit sniffer, other hardware
- Wireshark filters, tips&tricks
- sniffing static cleartext password of a smart lock and other devices
HCI dump (Linux, Android) - setup, analysis, difference from RF-layer sniffing, replay/fuzzing possibilities
Attacking services exposed by devices
- mapping device services and characteristics
- interacting with devices that do not require pairing/authentication
- abusing simple pairing (static PIN, just works)
- example unlocked AT command interface via BLE service of a smart lock
- fuzzing data written to device
Device spoofing, active MITM interception
- how to perform “man in the middle” attack on BLE connections
- available tools: GATTacker, BtleJuice, BtleJack
- MAC address cloning, mobile OS GATT cache potential problems
- analysing intercepted traffic
- Denial of Service attacks
- hijacking active connections with BtleJack
Replay attacks
- intercept transmission
- analyse authentication protocol weakness in example smart lock
- perform replay using tools or mobile phone, and unlock the device
Mobile application analysis, attacks on proprietary authentication and protocols
- decompile Android app, locate relevant source code fragments
- understand proprietary BLE communication protocol - commands, data exchanged with device
- based on example smart lock, discover protocol weakness, create exploit to open the lock without knowing current password or prior sniffing
- exploit the vulnerability using just a mobile phone - nRF Connect macros
- verify other vendor’s claims on “Latest PKI technology” and “military grade encryption”
Relay attacks - abusing automatic proximity features (e.g. smart lock autounlock).
Day 2
Advanced BLE MITM topics
- hooks, data modification on the fly (example attack on mobile PoS)
- command injection
- upstream websocket proxy
- when MITM attack does not work or is not possible - debugging, troubleshooting
Remote access share functions and their weaknesses - how to bypass timing restrictions.
Device DFU firmware update OTA services.
How to create own, independent server-side API for device - based on a real smart lock vendor, which disappeared and shut the servers, effectively rendering the device e-waste.
Bluetooth link-layer encrypted connections
- intercepting pairing process and decoding Long Term Keys (crackLE)
- how to trick a victim into re-pairing
- weaknesses in devices allowing for easier attacks
Web Bluetooth - interfacing with nearby devices from javascript.
- how hard is it to hijack BLE devices from a hostile web site
- writing new javascript interface to control own device
Bluetooth Mesh, Bluetooth 5.0 - what these technologies change and what not in terms of BLE security.
BLE Hackmelock - open-source software emulated device with multiple challenges to practice at home.
BLE best practices and security checklist - for security professionals, pentesters, vendors and developers.
NFC
Comprising of hands-on exercises on a real access control installations and mobile payment applications. Every time a student succeeds in bypassing access control system (e.g. cloning a card), a specially prepared box will automatically unlock, and allow to collect a delicious prize.
Short introduction
- RFID/NFC - where do I start?
- frequencies, card types, usage scenarios
- how to recognize card type - quick walkthrough
- equipment, and what can you do with it - mobile phone, card reader, simple boards, Chameleon Mini, Proxmark, other hardware
UID-based access control - practical exercises on example reader + door lock
- UID-based access control - still surprisingly popular
- UID lengths, formats
- clone Mifare UID using “Chinese magic” card and provided hardware
- how to emulate contactless cards and unlock UID-based system using just a smartphone (Android, iOS), without any additional hardware
- how to clone a card by making its picture - decoding numbers printed on cards
- cloning other ID-based cards - Low Frequency EM41XX, HID Prox, …
- emulate card using Proxmark, Chameleon Mini
- brute-force - is it possible in practice to guess other cards UID?
- countermeasures against attacks
Wiegand - wired access control transmission standard
- sniff the data transmitted from access control reader using Raspberry Pi GPIO
- decode card UID from sniffed bytes, clone the card
- replay card data on the wire to open lock
- Wiegand sniffers/repeaters: BLE-Key, ESP RFID Tool, others
Mifare Ultralight
- data structure
- reading, cloning, emulating
- example data stored on hotel access card
Day 3
Mifare Classic & its weaknesses - practical exercises based on hotel door lock system, ski lift card, bus ticket
- Mifare Classic - data structure, access control, keys, encryption
- default & leaked keys
- reading & cloning card data using just a mobile phone
- cracking keys - nested, darkside attacks
- libnfc tools - mfoc, mfcuk, MiLazyCracker
- cracking Mifare using Proxmark
- attacks on EV1 “hardened” Mifare Classic
- attacks with access to reader
Reverse-engineering data stored on card
- decoding access control data (room number, date) stored on card by an example hotel system
- creating hotel „emergency card” to open all the hotel doors unconditionally
ISO15693/iCode SLIX
- cloning ISO15693 UID on a “magic” card, unlocking smart lock
- data of several example ski passes
Intercepting card data from distance - building antenna, possibilities and limits.
Other cards: Mifare Plus, DESFire, Ultralight C, EV1, EV2, HID iClass/iClass SE … - known attacks, cloning possibilities, default & leaked keys, security best practices.
EMV
- protocols, commands, applications - ISO14443-4, 7816-4, APDU, AID, …
- reading data from contactless payment cards
- remote relay attacks and countermeasures
- other attacks (e.g. magstripe downgrade, pre-play)
Mobile contactless payments & more
- hardware Secure Element vs software Host Card Emulation
- example vulnerable HCE access control system (unlocking door using your NFC phone) - analysis, bypassing security mechanisms, key extraction, spoofing other user’s credentials
- mobile contactless payments SDK: MasterCard MCBP, Visa, other vendors
- typical system architecture
- most notable implementations: Android Pay, Samsung Pay, Apple Pay, few other example banks
- security mechanisms: tokenisation, cloud services, encryption, tampering prevention, obfuscation, root/malware detection, …
- how to bypass security mechanisms and clone mobile contactless card
- how to intercept push notifications with card data replenishment
- HCE implementations from attackers perspective - pentester’s checklist, implementation best practices
- access control systems with HCE - open lock using NFC Android phone
Share this post
Twitter
Google+
Facebook
Reddit
LinkedIn
StumbleUpon
Email