HackInTheBox Amsterdam 2020 training [cancelled]

Bluer Oceans: Advanced Attacks Against BLE, NFC, HCE and more

Amsterdam

HITB Conference

Due to COVID-19 the event has been cancelled

Organizer’s statement:

Out of an abundance of caution for our speakers, crew, volunteers and of course attendees, we have decided that it is in everyone’s best interests to cancel HITBSecConf2020 – Amsterdam.

More information: https://conference.hitb.org/hitbsecconf2020ams/

Training description

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. This is probably the most exhaustive and up to date training regarding BLE security – for both pentesters and developers. Based on hands-on exercises with real devices (including multiple smart locks), dedicated personal device flashed to a BLE devkit, and a deliberately vulnerable, training hackmelock.

RFID/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 today. Among other practical exercises performed on real installations, the attendees will reverse-engineer an example hotel access system, and as a result will be able to open all the doors in facility. A list of several hundred affected hotels included.

With prevalence of NFC smartphones, a new implementation of this technology is recently gaining attention: mobile contactless payments/access control, on Android known as Host Card Emulation. Using combination of cloud services and mobile security, it is now possible to embed not only credit card, but also 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!

Each attendee will receive 300 EUR hardware pack including among others Proxmark, a rooted Android smartphone and Raspberry Pi (detailed below). The hardware will allow for BLE attacks (sniffing, intercepting), cloning and cracking multiple kinds of proximity cards, analyse BLE or NFC mobile applications, and most importantly - practice majority of the training exercises later at home.

Who should attend

  • Pentesters, security professionals, red teamers, researchers
  • BLE/NFC device designers, developers
  • Anyone interested

Key learning objectives

  • In-depth knowledge of Bluetooth Low Energy, common implementation pitfalls, device assessment process and best practices
  • Ability to identify vulnerable access control systems, clone cards and reverse-engineer data stored on card

Prerequisite knowledge

  • Basic familiarity with Linux command-line
  • Scripting skills, pentesting experience, Android mobile applications security background will be an advantage, but is not crucial
  • No prior knowledge of Bluetooth Low Energy nor NFC is required

Hardware/software requirements

  • Contemporary laptop capable of running Kali Linux in virtual machine (VirtualBox or VMWare), 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 (over 2000 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
    • 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
  • Required hardware for BLE assessment

BLE advertisements

  • Scanning for visible devices, hcitool, bleah, bettercap, Mirage, GATTacker, …
  • 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
  • BLE advertisements of Microsoft and Apple devices (user tracking, decoding of current status/phone number)
  • Advertisement spoofing – Denial of Service, device impersonation

BLE connections

  • Central vs peripheral device
  • GATT – services, characteristics, descriptors, handles, reading, writing, notifications
  • Mapping device services and characteristics
  • Interacting with BLE devices using mobile phone, command-line, various tools
  • Taking control of simple, insecure devices – sex toys, key finders, …

Sniffing BLE connections using RF layer hardware

  • BLE radio modulation, channels, hopping, connection initiation
  • BLE link layer encryption – introduction, why is it hardly used in practice
  • Sniffing hardware: Ubertooth, nRF sniffer, BtleJack, Sniffle, SDR …
  • Wireshark filters, tips&tricks
  • Sniffing static cleartext password of a smart lock and other devices

HCI dump - capturing own BLE traffic

  • Difference from RF layer sniffing
  • Linux command-line hcidump
  • Android: live BLE packets analysis in Wireshark via TCP service

Device spoofing, active MITM interception

  • How to perform “man in the middle” attack on BLE connections
  • Available tools: GATTacker, BtleJuice, BtleJack, Mirage
  • MAC address cloning, mobile OS GATT cache potential problems
  • Analysing intercepted traffic
  • Denial of Service attacks
  • Jamming and 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

Relay attacks – abusing automatic proximity features (e.g. smart lock autounlock).

Day 2

Various smart locks vulnerabilities case-studies

  • 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”
  • Example unlocked AT command interface via BLE service of a smart lock
  • Remote access share functions and their weaknesses – how to bypass timing restrictions.
  • 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

Advanced BLE MITM topics

  • Hooks, data modification on the fly (example attack on mobile PoS)
  • Command injection
  • Upstream websocket proxy
  • “Rolljam”-like attacks on single use keys
  • When MITM attack does not work or is not possible – debugging, troubleshooting

Device DFU firmware update OTA services.

Bluetooth link-layer encrypted connections

  • BLE pairing, bonding, encryption
  • Intercepting pairing process and decoding Long Term Keys (crackLE)
  • Weaknesses of simple pairing (static PIN, just works)
  • How to trick a victim into re-pairing

Abusing BLE bonding trust relationships

  • Analysis of Google Titan U2F token vulnerability
  • Possibilities for malicious actions (e.g. change device to appear as a BLE keyboard).

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

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 Android phone and “gen2” UID-changeable card, or libnfc/Proxmark and gen1 card
  • 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, ESP RFID Tool, BLE-Key, …
  • Decode card UID from sniffed bytes, clone the card
  • Replay card data on the wire to open lock

Mifare Ultralight

  • Data structure
  • Reading, cloning, emulating
  • Example data stored on hotel access card
  • Ultralight EV1, C

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
  • Online attacks against reader

Reverse-engineering data stored on card - based on a real hotel system

  • Recoding 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

Mifare DESFire – introduction, sample attack on misconfigured access control system

ISO15693/iCode SLIX

  • Cloning ISO15693 UID on a “magic UID” card, unlocking smart lock
  • Data of several example ski passes

HID iClass

  • Cloning “legacy” / “standard security” iClass
  • Attacks on iClass Elite

Hitag2 access control

  • Sniffing password mode transmission between reader and tag
  • Simulating Hitag2 against the reader using Proxmark

Intercepting card data from distance – building antenna, possibilities and limits.

Host Card Emulation – phone acting as NFC

  • Hardware Secure Element vs software Host Card Emulation
  • Example vulnerable HCE access control system (unlocking door using your NFC phone)
  • Protocols, commands, applications – ISO14443-4, 7816-4, APDU, AID, …
  • Analysis, sniffing NFC using Proxmark, dumping NFC on the phone,
  • Bypassing security mechanisms, key extraction, spoofing other user’s credentials
  • Remote relay attacks and countermeasures

Previous training session evaluation

Training score

Instructor: 90%

Course material: 91%

Trainee’s quotes

Well prepared training, due to the amount of tools and equipment also easy to continue at home.

Trainer did a good job in preparing all the labs. Really gorgeous.

The best thing with this course is the instructor and our ability to do all exercise back at home .

Great instructor, well maintained materials had a lot of experience.

I am amazed how well everything is prepared.

Great instructor, lot’s of information, topics and exercise to practise at home.

Register here:

https://conference.hitb.org/hitbsecconf2020ams/sessions/3-day-training-5-bluer-oceans-attacking-ble-nfc-hce-and-more/

comments powered by Disqus