Beginner's Guide to Static & Dynamic Binary Analysis

Started by Error0 replies8 views

Beginner's Guide to Static & Dynamic Binary Analysis
A complete step-by-step introduction to reverse engineering compiled executables.



1. Overview
Reverse engineering allows you to understand how a program works without having access to its original source code. By combining Static Analysis (inspecting the file without running it) and Dynamic Analysis (observing the program while it executes), you can uncover hidden logic, bypass checks, or analyze malware safely.



2. Essential Tools
Before diving into the assembly code, make sure you have the right environment set up:
  • Detect It Easy (DIE): Identifies compilers, packers, and obfuscators used on the binary.
  • Ghidra / IDA Free: Disassemblers and decompilers for deep static code inspection.
  • x64dbg: An open-source debugger for Windows binaries (32-bit and 64-bit).
  • Strings / Binwalk: Quick command-line utilities to extract readable text and embedded files.



3. Step-by-Step Workflow

Step 1: Reconnaissance (Triage)
Never run an unknown binary immediately. Drag the file into Detect It Easy to check its architecture (x86 vs x64) and see if it is packed (e.g., UPX). Run a string search to spot interesting error messages, URLs, or function names.

Step 2: Static Analysis
Load the binary into Ghidra and let the auto-analysis finish. Navigate to the Defined Strings window, find a relevant text reference (such as "Invalid Password"), and trace its XREFs (Cross-References) to locate the exact validation function in the decompiler view.

Step 3: Dynamic Analysis & Patching
Open the executable in x64dbg and set a breakpoint at the memory address you found in Ghidra. Step through the instructions using F7 (Step Into) and F8 (Step Over). Look for conditional jumps like
Code
JZ
(Jump if Zero) or
Code
JNZ
(Jump if Not Zero) that control the execution flow, and modify the flags or patch the bytes to test your hypothesis.



4. Safety Best Practices
  • Use a Virtual Machine: Always analyze untrusted binaries inside an isolated VM (VMware or VirtualBox) with snapshots enabled.
  • Disable Network Access: Keep your VM set to Host-Only or disconnected when testing unknown executables.



by Error
Like1

You must log in or register to reply here.

Back to Reverse Engineering