Binary and Malware Analysis

Table of Contents

Dynamic Binary Instrumentation & Intel Pin

Full system emulation is powerful (full system visibility) but invasive (full system runs emulated).

Dynamic binary instrumentation (DBI) gives you binary-level visibility, and is efficient and self-contained.

Instrumentation: technique injecting code into binary to collect runtime info

Instrumentation is good

Two classes

Why binary instrumentation:

Intel Pin (website)

DBI framework, can insert arbitrary code in arbitrary places in executable.

Can examine any type of instruction, track function calls including library and syscalls, track application threads, etc.

Pin architecture diagram

Instrumentation vs analysis:

Using it:

  1. export PIN_HOME=/path/to/pin/directory && make
  2. pin -t /path/to/pin/code.so -- /path/to/binary

Reducing Pin overhead:

Debugging Pin:

  1. Run Pin with -appdebug
  2. Start GDB and run target remote :<number given by pin>
  3. Use GDB normally