An Introduction To Dynamic Analysis For R.E. (2020) PDF
An Introduction To Dynamic Analysis For R.E. (2020) PDF
○ Analyzing and reasoning with properties and behaviors of a computer program, in order to gain
a deeper intrinsic understanding
■ Often times with compiled programs, we are stuck without source!
Step Through si or ni or c si
Program
https://github.com/osirislab/Hack-Night/blob/master/Rev/dynamic/license_validator/
Other Notable Debugging Tools
● strace / ltrace
○ Run a program, get every system call (strace) and library call (ltrace)
made during its execution
● Valgrind
○ Run a program and check for memory violations
● exploitable
○ GDB plugin that can determine possible exploit primitives during
runtime
● rr (record-replay)
○ Tool with GDB extensions that allow one to record and replay snapshots
of a program being run
Dynamic Analysis Techniques
● Fuzzing
● Symbolic Execution
Fuzzing - The “Dumb” Method*
● Throw garbage at a program, and
see what crashes we can get
○ (Hopefully they are exploitable!)
● Mutational vs Generational fuzzing
● *Dumb, but surprisingly effective.
Inputs Program
Fuzzing
Inputs Program
Possibly
H! found a
R AS bug!
C
Inputs Program
Su Exit
cce s
ssf Program
ully
works!
Fuzzing
Fuzzer
Coverage-based
feedback
Mutates
Inputs Program
● What are testing? Serialization
and deserialization for a parser
library
○ We want to find inputs that
make our library crash.
○ Crashes may mean edge
cases that the library did
not account for.
https://github.com/osirislab/Hack-Night/blob/master/Rev/dynamic/heartbleed_fuzz/
Symbolic Execution - The “Smarter” Method
● Can we automatically generate all
possible input test cases that can reach state_0
this point of program execution?
● Analyzing a program under a symbolic if (..) else
(..)
model / representation to logically
reason about execution fork!
○ We represent conditional forks as path
constraints using a logical representation state_1 state_2
called SMT (Satisfiability Modulo Theorem)
○ Find solutions and generating interesting
inputs == solving path constraints
Symbolic Representation
π := T
x := α
y := β
Symbolic Representation
π := T
x := α
y := β
π := T
z := x + y
z := α + β
Symbolic Representation
π := T
x := α
y := β
π := T
z := x + y
z := α + β
π := α < 5 ∧ β < π := α ≥ 5 ∧ β ≥ 5
5
Fail branch! Success branch!
Symbolic Representation
π := T
x := α
y := β
π := T
z := x + y
z := α + β
π := α < 5 ∧ β < π := α ≥ 5 ∧ β ≥ 5
5
Fail branch! Success branch!
https://github.com/osirislab/Hack-Night/blob/master/Rev/dynamic/license_validator
Other Cool Tools and Platforms
● radare2
● Microsoft Security Risk Detection (SAGE)
○ https://www.microsoft.com/en-us/security-risk-detection/
● BAP (CMU’s Binary Analysis Platform)
○ https://github.com/BinaryAnalysisPlatform/bap
● PANDA (NYU/MIT/NU’s whole-system malware analysis sandbox)
○ https://github.com/panda-re/panda
● Cyber Reasoning Systems (CRSes)
○ Mechanical Phish - https://github.com/mechaphish
Other Resources
● awesome-dynamic-analysis
○ https://github.com/analysis-tools-dev/dynamic-analysis
● /r/ReverseEngineering
○ https://www.reddit.com/r/ReverseEngineering/
● Google’s work in fuzzing
○ https://github.com/google/fuzzing
● Andriesse, Dennis. Practical Binary Analysis
○ https://nostarch.com/binaryanalysis
● Related Concentration: Malware Analysis
Closing Thoughts
● Other dynamic analysis techniques to explore:
○ Dynamic taint analysis (DTA)
○ Program slicing
○ Dynamic binary instrumentation (DBI)
○ … and so on!
● Use in tandem with static analysis tools and plugins for effective analyses!
● Program analysis R&D is valuable to industry!
Questions?