sum total of isa sum total of isa knowledge knowledge
play

Sum Total of ISA Sum Total of ISA Knowledge Knowledge Analyzing - PowerPoint PPT Presentation

Sum Total of ISA Sum Total of ISA Knowledge Knowledge Analyzing Your Static Analysis Tools Analyzing Your Static Analysis Tools @alexkropivny Unsolicited Firmware Unsolicited Firmware Archeology and You Archeology and You "I bet I


  1. Sum Total of ISA Sum Total of ISA Knowledge Knowledge Analyzing Your Static Analysis Tools Analyzing Your Static Analysis Tools @alexkropivny

  2. Unsolicited Firmware Unsolicited Firmware Archeology and You Archeology and You

  3. "I bet I can hack this"

  4. References References - full work�ow example VMU hackery - long-term toolchain example Nexmon Tools to assist static portion of work�ow: angr (obfuscated interpreters?) Triton or (pure Python) miasm2 amoco (if you have source) KLEE bincat / BAP / Manticore / ...

  5. Manual Static Manual Static Analysis Analysis Automation Automation

  6. Types of Failures Types of Failures 1. False positives discovering more false positives (sev: high) 2. Underapproximations makes you re-visit code (sev: annoying) 3. Script stomped over manually-entered markup (sev: only happens once)

  7. Useful Automation Useful Automation Instruction length disassembler All control �ow e�ects Constant propagation (sometimes)

  8. Useful Automation Useful Automation Command/state machine tables (fancy switches)

  9. Lifter Problems: System Code Lifter Problems: System Code Uncommon instruction classes Once-per-boot setup features Shared memory bus: FIFOs, control �ags, DMA

  10. Lifter Problems: Abstractions Lifter Problems: Abstractions Flattening memory spaces Aliasing with registers (or other memory) Inter- vs intra-procedural analysis C memory and stack model

  11. Examples Examples

  12. Examples Examples

  13. Examples Examples

  14. Examples Examples

  15. Examples Examples

  16. Examples Examples

  17. Examples Examples

  18. Planned Work�ow Planned Work�ow

  19. QA by Concrete Execution QA by Concrete Execution

  20. Sources of Information Sources of Information Emulators! Hacker tools

  21. Emulator Architecture Emulator Architecture

  22. Emulator Architecture Emulator Architecture

  23. Fuzzing A vs B Fuzzing A vs B explore on commonly-occuring instructions bin di�erences on instruction opcodes prioritize on registers a�ected

  24. QA by Symbolic Execution QA by Symbolic Execution

  25. ii = lift.instruction_at(bv, here) # 'swap' MCS-51 instructi emu = lift.function(current_function) # 'swap_a' function on ARM s = ii.solver() emu.constrain(s) s.add(z3.And(ii['A'][0] == emu['mem'][0][0x1ef2608], ii['A'][-1] != emu['mem'][-1][0x1ef2608])) print s.check() # sat print s.model()[x['A'][0]].sexpr(), ':', print s.model()[x['A'][-1]].sexpr()

  26. x = lift.function(current_function) summary = x['Y4'][-1] != x['Y4'][0] & x['Y0'][0] s = x.solver() s.assert_and_track(summary, 'not-equivalent') print s.check() # unsat s.unsat_core() # [not-equivalent]

  27. Program Analysis is a Search Problem Program Analysis is a Search Problem Fast backtracking vs slow complex search Specialized algorithms vs generic solver Heuristics compensating for generic solver Checking results of search vs search ∃ ∀ Approximating state coverage via path coverage

  28. Work�ow and Correctness Work�ow and Correctness

  29. References References - comparison of several major lifters in F# MeanDi� - ambitious academic work Automatic Generation of Peephole Superoptimizers - equivalence checking experiments Fuzzing and Patch Analysis: SAGEly Advice - emulator comparison (would AFL do better?) Hi-Fi Tests for Lo-Fi Emulators Literature reviews to pull terminology from: A Survey of Symbolic Execution Techniques A Vocabulary of Program Slicing-Based Techniques Mechanizing Proof: Computing, Risk, and Trust for a fun historical perspective

  30. What Went Right & What Went Right & What Went Wrong What Went Wrong

  31. 1. Approximations: acceptable, but validate major assumptions 2. Partial lifting: acceptable and commonplace 3. Emulator-as-oracle: less partial, needs a map to lifted model 4. Full equivalence checking versus emulator: hampered by 2 and 3, but sometimes works

  32. Example Tools Example Tools i8051 - minimum viable processor module for 8051 STC - (WIP) attempt at generic lifter analysis tools slides ( PDF render, reveal.js with notes)

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