avatar a framework for dynamic security analysis of
play

AVATAR: A Framework for Dynamic Security Analysis of Embedded - PowerPoint PPT Presentation

AVATAR: A Framework for Dynamic Security Analysis of Embedded Systems Firmwares Jonas Zaddach (zaddach@eurecom.fr) Luca Bruno, Aurlien Francillon, Davide Balzarotti Outline Introduction AVATAR overview Framework components


  1. AVATAR: A Framework for Dynamic Security Analysis of Embedded Systems’ Firmwares Jonas Zaddach (zaddach@eurecom.fr) Luca Bruno, Aurélien Francillon, Davide Balzarotti

  2. Outline • Introduction • AVATAR overview • Framework components • Use cases • Conclusion 2/24/14 2

  3. Software is everywhere • Embedded devices are diverse – but all of them run software 2/24/14 3

  4. Reasons for embedded security • Embedded devices are ubiquitous – Even if invisible, they are essential to your life • Can operate for many years – Legacy systems, no (security) updates • Have a large attack surface – Networking, forgotten debug interfaces, etc 2/24/14 4

  5. Third party security evaluation • No source code available • No toolchain available • No documentation available • Distinct tools (to flash and debug) for each manufacturer 2/24/14 5

  6. Wishlist for security evaluation • Typical PC security toolbox – Advanced debugging techniques A • Tracing ≤ 0 > 0 • Fuzzing • Tainting B C • Symbolic Execution – Integrated tools < 8 ≥ 8 • IDA Pro D E • GDB 0 < x < 8 2/24/14 6

  7. Challenges • Advanced dynamic analysis needs emulation • Full emulation – Unknown peripherals – Firmware fails if peripherals are missing • Integration – Support multiple vendors and platforms 2/24/14 7

  8. Outline • Introduction • AVATAR overview • Framework components • Use cases • Conclusion 2/24/14 8

  9. AVATAR • Orchestrate execution between emulator and device • Forward peripheral accesses to the device under analysis • Do not attempt to emulate peripherals – No documentation – Reverse engineering is difficult 2/24/14 9

  10. Avatar overview Device Emulator Avatar . . . In-memory mov r2, r0 stub mov r3, r1 plugins Analysis add r3, r3, #1 ldr r2, [r2, #0] plugins cmp r2, r3 . . . Memory Registers CPU state Analysis script 2/24/14 10

  11. Avatar overview Device Emulator Avatar . . . In-memory mov r2, r0 stub mov r3, r1 plugins Analysis add r3, r3, #1 ldr r2, [r2, #0] plugins cmp r2, r3 . . . Memory Registers CPU state Analysis script 2/24/14 11

  12. Avatar overview Device Emulator Avatar . . . In-memory mov r2, r0 stub mov r3, r1 plugins Analysis add r3, r3, #1 ldr r2, [r2, #0] plugins cmp r2, r3 . . . Memory Registers CPU state Analysis script 2/24/14 12

  13. Avatar overview Device Emulator Avatar . . . In-memory mov r2, r0 stub mov r3, r1 plugins Analysis add r3, r3, #1 IRQ ldr r2, [r2, #0] plugins cmp r2, r3 . . . Memory Registers CPU state Analysis script 2/24/14 13

  14. Outline • Introduction • AVATAR overview • Framework components • Use cases • Conclusion 2/24/14 14

  15. Emulator Emulator Avatar S 2 E Configuration LLVM Qemu Qemu GDB Klee Remote Memory Memory Analysis Registers plugins CPU state 2/24/14 15

  16. Avatar core Device Emulator Avatar Configuration interface GDB interface GDB interface plugins Analysis Remote plugins memory Analysis script 2/24/14 16

  17. Embedded target Device Avatar In-memory stub JTAG server Memory Registers CPU state 2/24/14 17

  18. Target communication • Either a debugging interface – JTAG – Debug Serial Interface • Or code injection and a communication channel – Custom GDB Stub + Serial Port 2/24/14 18

  19. Bottlenecks • Emulated execution is much slower than execution on the real device – Memory access forwarding through low- bandwidth channel is the bottleneck – In one case down to ~10 memory accesses/ sec. • Interrupts can saturate debug connection 2/24/14 19

  20. Improving performance • Transfer execution/state – From the device to the emulator – From the emulator to the device • Migrate memory and code snippets – Keep memory regions in the emulator – Execute IO-intensive pieces of code on the device 2/24/14 20

  21. Full separation mode Device Emulator Avatar State State Register Memory 2/24/14 21

  22. Memory access optimization Device Emulator Avatar State State Register Memory IO Memory 2/24/14 22

  23. Execute code snippets on the device Device Emulator Avatar State State Code 2/24/14 23

  24. Execute code snippets on the device Device Emulator State State Code Code 2/24/14 24

  25. Outline • Introduction • AVATAR overview • Framework components • Use cases • Conclusion 2/24/14 25

  26. Use case: Hard Disk • Recover bootloader protocol with symbolic execution – Inject GDB stub – Instrument flash loading – Inject symbolic values for data read from serial port – Keep track of which input leads into which code flow http://www.s3.eurecom.fr/docs/ndss14_zaddach.pdf 2/24/14 26

  27. Use case: GSM Phone • Search vulnerabilities in SMS decoding routine – Connect through JTAG – Execute on device until SMS decoding – Replace SMS payload with symbolic values – Check for symbolic values in • program counter • load/store address 2/24/14 27

  28. Use case: Econotag • Find proof-of-concept bug in user application – Connect through JTAG – Execute on device until Zigbee packet arrives – Replace payload with symbolic values – Check for symbolic values in • program counter • load/store address 2/24/14 28

  29. We are adding more devices 2/24/14 29

  30. Outline • Introduction • AVATAR overview • Framework components • Use cases • Conclusion 2/24/14 30

  31. Future work • Enhance state consistency – DMA memory changes not tracked • Automatically emulate peripherals • Improve symbolic execution – Coherency between HW and SW – Improve bug-finding strategies 2/24/14 31

  32. Conclusion • AVATAR is a modular open-source tool to – Enable dynamic analysis – And perform symbolic execution – On embedded devices – Where only binary code is available � A first step towards better analysis tools for embedded systems! 2/24/14 32

  33. Questions? • Thank you for listening! • Open source on github: https://github.com/eurecom-s3/avatar-python • Project page: http://s3.eurecom.fr/tools/avatar / Thanks to Pascal Sachs and Luka Malisa who built an earlier prototype of the system, and Lucian Cojocar for applying and extending AVATAR 2/24/14 33

  34. References • AVATAR web page: http://www.s3.eurecom.fr/tools/avatar/ • AVATAR: A Framework to Support Dynamic Security Analysis of Embedded Systems' Firmwares, Jonas Zaddach, Luca Bruno, Aurelien Francillon, Davide Balzarotti • Howard: a dynamic excavator for reverse engineering data structures, Asia Slowinska, Traian Stancescu, Herbert Bos • KLEE webpage: http://ccadar.github.io/klee/ • S2E webpage: https://s2e.epfl.ch/ • S2E: A Platform for In-Vivo Multi-Path Analysis of Software Systems, italy Chipounov, Volodymyr Kuznetsov, George Candea • The S2E Platform: Design, Implementation, and Applications, Vitaly Chipounov, Volodymyr Kuznetsov, George Candea • QEMU webpage: http://qemu.org • Dowsing for Overflows: A Guided Fuzzer to Find Buffer Boundary Violations, Istvan Haller, Asia Slowinska, Matthias Neugschwandtner, Herbert Bos 2/24/14 34

  35. Injecting a debugger • Requires writing and executing memory – Debug menus allow this sometimes – A code execution vulnerability can be used • Requires a communication channel – Serial port, GPIO, Power consumption, … – GPIO • Requires an unused memory location in the firmware – Stub is about 3k of code 2/24/14 35

  36. Full separation mode Device Emulator Avatar State State Register Memory 2/24/14 36

  37. Memory access optimization Device Emulator Avatar State State Register Memory IO Memory 2/24/14 37

  38. Transfer execution from emulator to device Device Emulator State State Register Memory 2/24/14 38

  39. Transfer execution from emulator to device Device Emulator Avatar State State Register Memory 2/24/14 39

  40. Transfer execution from device to emulator Device Emulator State State Register Memory 2/24/14 40

  41. Transfer execution from device to emulator Device Emulator Avatar State State Register Memory 2/24/14 41

  42. Software interrupts • Software Interrupts – Are issued by an interrupt instruction in the code • Can be entirely emulated – Qemu manages calling of software interrupt handlers http://home.netcom.com/~swansont/interrupt.jpg 2/24/14 42

  43. Task completion interrupts • Triggered by application requests – Responses aligned with firmware execution speed – E.g., signal that a requested DMA transfer has finished • Can be forwarded from the device to the emulator – A stub on the device traps interrupts and forwards them 2/24/14 43

  44. External event interrupts • Signals an external event – Events aligned to wall-clock instead of execution time – E.g., that a time span has elapsed • Solution depends – Controllable interrupts can be forwarded – Uncontrollable interrupts need to be synthesized • Original interrupts are suppressed • Emulated interrupts are inserted according to emulated execution speed 2/24/14 44

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend