from printed from printed circuit boards to circuit
play

FROM PRINTED FROM PRINTED CIRCUIT BOARDS TO CIRCUIT BOARDS TO - PowerPoint PPT Presentation

FROM PRINTED FROM PRINTED CIRCUIT BOARDS TO CIRCUIT BOARDS TO EXPLOITS EXPLOITS (PWNING IOT DEVICES LIKE A BOSS) (PWNING IOT DEVICES LIKE A BOSS) @virtualabs | Hack in Paris '18 ABOUT ME ABOUT ME Head of Research @ Econocom Digital


  1. FROM PRINTED FROM PRINTED CIRCUIT BOARDS TO CIRCUIT BOARDS TO EXPLOITS EXPLOITS (PWNING IOT DEVICES LIKE A BOSS) (PWNING IOT DEVICES LIKE A BOSS)  @virtualabs | Hack in Paris '18

  2. ABOUT ME ABOUT ME Head of Research @ Econocom Digital Security Hardware hacker (or at least pretending to be one) Speaker @ various conferences Special interest in Bluetooth Low Energy since 2 years

  3. WHAT THIS TALK IS NOT WHAT THIS TALK IS NOT A detailed reference guide on how to p0wn IoT devices A list of tools you may use to test devices

  4. IT IS ALL ABOUT HOW TO THINK IT IS ALL ABOUT HOW TO THINK AND ANALYZE AND EXPLOIT AND ANALYZE AND EXPLOIT LET'S DO IT THE HACKER WAY ! LET'S DO IT THE HACKER WAY !

  5. METHODOLOGY METHODOLOGY

  6. EXISTING METHODOLOGIES EXISTING METHODOLOGIES Rapid7 's methodology (7 basic steps) OWASP IoT Project (not really mature yet)

  7. PCB REVERSE-ENGINEERING PCB REVERSE-ENGINEERING

  8. COMPONENTS IDENTIFICATION COMPONENTS IDENTIFICATION

  9. MEMORY EXTRACTION MEMORY EXTRACTION

  10. SOFTWARE REVERSE-ENGINEEERING SOFTWARE REVERSE-ENGINEEERING

  11. SNIFFING WIRED COMMS. SNIFFING WIRED COMMS.

  12. SNIFFING WIRELESS COMMS. SNIFFING WIRELESS COMMS.

  13. FIND VULNS & ATTACK ! FIND VULNS & ATTACK !

  14. OUR VICTIM SMARTLOCK OUR VICTIM SMARTLOCK

  15. STEP #1: TEARDOWN STEP #1: TEARDOWN

  16. USE THE RIGHT TOOLS USE THE RIGHT TOOLS

  17. KEEP CALM ! KEEP CALM !

  18. STEP #2: GLOBAL ANALYSIS STEP #2: GLOBAL ANALYSIS

  19. ELECTRONICS ENGINEERS ARE ELECTRONICS ENGINEERS ARE HUMANS TOO HUMANS TOO Components position based on their global role Connectors and components producing heat placed near the edges

  20. COMPONENTS IDENTIFICATION COMPONENTS IDENTIFICATION nRF52832 2.4 GHz Bluetooth Low Energy capable System-on-Chip DRV8848 Dual H-Bridge Motor driver

  21. FUNCTIONS VS. COMPONENTS FUNCTIONS VS. COMPONENTS

  22. STEP #3: RECOVER SCHEMATICS STEP #3: RECOVER SCHEMATICS

  23. PICTURES + SOFTWARE FTW PICTURES + SOFTWARE FTW Using high-res pictures (or multimeter), follow tracks and vias Determine protocols used for Inter-IC communication Draw a simplified schematics

  24. FOLLOW TRACKS AND VIAS FOLLOW TRACKS AND VIAS

  25. DETERMINE PROTOCOLS USED DETERMINE PROTOCOLS USED

  26. SIMPLIFIED SCHEMATICS SIMPLIFIED SCHEMATICS Use Inkscape, Adobe Illustrator, MS Visio, or whatever Draw only the interesting stuff, we do not want to counterfeit

  27. STEP #4: GET FIRMWARE STEP #4: GET FIRMWARE

  28. USE DEBUGGING INTERFACES ! USE DEBUGGING INTERFACES ! Offers a proper way to access Flash memory Found in > 50% of devices we have tested Requires the right adapter to connect to

  29. DUMPING FIRMWARE WITH DUMPING FIRMWARE WITH OPENOCD OPENOCD $ openocd -f interface/stlink-v2.cfg -f target/nrf5x.cfg -c init -c halt -c "dump_image /tmp/firmware.bin 0x0 0x80000"

  30. WHEN DEBUGGING IS NOT WHEN DEBUGGING IS NOT ENABLED, ABUSE ENABLED, ABUSE OTA OTA ! !

  31. OVER-THE-AIR UPDATES OVER-THE-AIR UPDATES

  32. OR DUMP EVERY AVAILABLE OR DUMP EVERY AVAILABLE STORAGE DEVICE 😏 STORAGE DEVICE 😏

  33. FIRMWARE DUMPED ! FIRMWARE DUMPED !

  34. SPARE AREA IS EVIL SPARE AREA IS EVIL

  35. REMOVE OOB DATA ! REMOVE OOB DATA ! (AND USE ECC TO FIX ERRORS) (AND USE ECC TO FIX ERRORS)

  36. STEP #5: DETERMINE TARGET STEP #5: DETERMINE TARGET ARCHITECTURE ARCHITECTURE

  37. ANSWER THE BASIC QUESTIONS ANSWER THE BASIC QUESTIONS What architecture is this ? Does it run an OS ? Does it use a FS ?

  38. WHAT ARCHITECTURE IS IT ? WHAT ARCHITECTURE IS IT ? ARM CORTEX-M0 (ARMV7-M) ARM CORTEX-M0 (ARMV7-M)

  39. DOES IT RUN AN OS ? DOES IT RUN AN OS ? NOPE. NOPE.

  40. DOES IT USE A FS ? DOES IT USE A FS ? NOPE. NOPE.

  41. NRF51 SOFTDEVICE NRF51 SOFTDEVICE

  42. SOFTDEVICE VERSION ? SOFTDEVICE VERSION ? EASY-PEASY EASY-PEASY ! ! $ strings firmware-original.bin | grep sdk /home/benoit/workspace/nrf51/firmware/sdk/sdk13.0/components/l /home/benoit/workspace/nrf51/firmware/sdk/sdk13.0/components/s /home/benoit/workspace/nrf51/firmware/sdk/sdk13.0/components/s /home/benoit/workspace/nrf51/firmware/sdk/sdk13.0/components/l /home/benoit/workspace/nrf51/firmware/sdk/sdk13.0/components/l /home/benoit/workspace/nrf51/firmware/sdk/sdk13.0/components/l /home/benoit/workspace/nrf51/firmware/sdk/sdk13.0/components/s

  43. QUICK REMINDER QUICK REMINDER It runs an OS or use a known FS: You'd better drop binaries in IDA Pro It uses no FS and looks like a crappy blob of data: You'd better figure out the architecture and memory layout.

  44. STEP #6: DISASSEMBLE ! STEP #6: DISASSEMBLE !

  45. SPECIFY TARGET ARCHITECTURE AND SPECIFY TARGET ARCHITECTURE AND LAYOUT LAYOUT Configure CPU accordingly Configure memory layout if required Perform a quick sanity check (strings xrefs, ...)

  46. AUTOMATED SDK FUNCTIONS AUTOMATED SDK FUNCTIONS DETECTION AND RENAMING DETECTION AND RENAMING We developed our own tool to ease So�Device- based firmware reverse-engineering It helps detecting So�Device version and automatically rename SDK exported functions

  47. 0:00 / 2:36

  48. NRF5X-TOOLS AVAILABLE ON GITHUB NRF5X-TOOLS AVAILABLE ON GITHUB https://github.com/DigitalSecurity/nrf5x-tools

  49. MOBILE APPS TOO MOBILE APPS TOO

  50. STEP #7: SNIFF ALL THE THINGS STEP #7: SNIFF ALL THE THINGS

  51. SNIFF/INTERCEPT SNIFF/INTERCEPT COMMUNICATIONS COMMUNICATIONS May require various hardware : SPI, I2C, WiFi, BLE, nRF24, Sigfox, LoRa, ... PCAP compatible tools are great Beware the cost (a lot of $$$) !

  52. BLUETOOTH LOW ENERGY MITM BLUETOOTH LOW ENERGY MITM https://github.com/DigitalSecurity/btlejuice

  53. HOW OUR SMARTLOCK WORKS HOW OUR SMARTLOCK WORKS (BASED ON A MITM ATTACK) (BASED ON A MITM ATTACK) 1. App retrieves a Nonce from the lock 2. App encrypts a token and send it to the lock 3. Lock decrypts token and react accordingly

  54. BY THE WAY ... BY THE WAY ... The mobile app authenticates the smartlock only by its exposed service UUID:

  55. STEP #8: FIND BUGS & VULNS STEP #8: FIND BUGS & VULNS

  56. SEARCH BUGS & VULNS SEARCH BUGS & VULNS Default password/key Escape shell Buffer overflow Misconfiguration ...

  57. SMARTLOCK SECURITY SMARTLOCK SECURITY FEATURES FEATURES Relies on a Nonce generated by the smartlock to avoid replay attacks True AES-based encryption used, cannot break it Resisted to fuzzing , we did not managed to force open the lock

  58. BUT ... BUT ...

  59. ... IS IT «RANDOM» ? ... IS IT «RANDOM» ?

  60. I'VE ALREADY SEEN THAT ... I'VE ALREADY SEEN THAT ... (SOURCE: XKCD) (SOURCE: XKCD)

  61. SECURITY ISSUES SECURITY ISSUES Spoofing : App does not authenticate the smartlock it connects to Random Nonce is not random at all !

  62. SO WHAT ? SO WHAT ? An attacker may spoof the smartlock to force the App to send an encrypted token He/she may be able to replay a valid token as the nonce is always the same

  63. STEP #9: EXPLOIT ! STEP #9: EXPLOIT !

  64. SPOOF SMARTLOCK SPOOF SMARTLOCK Use NodeJS with Bleno FTW Exploit based on our Mockle library https://github.com/DigitalSecurity/mockle

  65. SPOOFING SMARTLOCK SPOOFING SMARTLOCK $ sudo node capture-token.js [setup] creating mock for device XXXXXXX (xx:xx:xx:6b:fc:88) [setup] services registered [ mock] accepted connection from address: 5e:74:79:1e:5f:a9 > Register callback for service 6e4...ca9e:6e4...ca9e > Read Random, provide default value 1. > End of transmission [i] Token written to `token.json`

  66. REPLAY TOKEN REPLAY TOKEN $ sudo node replay-token.js BTLE interface up and running, starting scanning ... [i] Target found, replaying token ... done

  67. 0:00 / 1:23

  68. BUG IS NOW FIXED BUG IS NOW FIXED

  69. CONCLUSION CONCLUSION

  70. TO BE IMPROVED TO BE IMPROVED We have been using this methodology intensively since the last two years There is space for improvements , obviously Vendor fixed (some) of the vulnerabilities we demonstrated

  71. PRO TIPS PRO TIPS Take your time and document all the things Read datasheets carefully Learn how to master Inkscape , it helps a lot Start from the bottom (PCB) and go up !

  72. PRO TIPS (CONT'D) PRO TIPS (CONT'D) As usual, know your tools and how to use them Share and learn from others (many cool tricks to discover)

  73. PRACTICE ! PRACTICE ! Soldering (tiny wires) Desoldering with hot air gun Use the scope Use the scope again Code on embedded devices ...

  74. QUESTIONS ? QUESTIONS ?  @virtualabs CONTACT CONTACT  damien.cauquil@digital.security

Recommend


More recommend