Skip to content
Pwnversity
REV-STATICintermediate · 5 min · upd. 2026-10

Static Analysis

Static analysis examines a binary without running it: you disassemble and decompile the code to read its logic, inspect the strings, imports, structure, and data. It’s the basis of reversing because it gives you the full program map safely (you don’t run malware) and reproducibly. The star tool is the decompiler, which reconstructs readable pseudo-C from machine code.

“Static” means you don’t run the program: you work on the file’s bytes. You analyze headers (ELF/PE), sections, the symbol table, imports/exports, strings, and the disassembled code itself. It’s the safest approach for malware and the most complete for mapping a binary, at the cost of being more laborious than running and observing.

flowchart TD
    A["binary"] --> B["headers: file / rabin2 -I / checksec"]
    A --> C["strings: messages, paths, keys"]
    A --> D["symbols and imports: nm / readelf -s / objdump -T"]
    A --> E["disassemble + decompile: Ghidra / IDA / r2"]
    D --> F["imports betray the behavior"]
    C --> G["xrefs from a string → the logic that uses it"]
    E --> H["readable pseudo-C → reconstruct the logic"]
    F --> H
    G --> H
  • General info: file, rabin2 -I, checksec — architecture, format, stripped, mitigations.
  • Readable content: strings — messages, paths, URLs, keys, hints.
  • Symbols and imports: nm, readelf -s (functions if not stripped), objdump -T / rabin2 -i (imports).
  • Disassemble/decompile: Ghidra / IDA / radare2 — assembly + pseudo-C.

Imports are very revealing: socket/connect → it does networking; CreateFileW/RegSetValueEx → touches files/registry; VirtualAlloc/WriteProcessMemory → probably injects code (malware).

  1. Import the binary and run the auto-analysis.
  2. Symbol Tree / Functions → locate main (or entry).
  3. Decompiler window → read each function’s pseudo-C.
  4. Rename variables/functions as you understand them (key to not getting lost).
  5. Follow cross-references (xrefs): who calls what, who uses a variable/string.
  6. Annotate and reconstruct the logic until you answer the question (how does it validate? what does it do?).

The decompiler doesn’t give perfect code, but it’s understandable: renaming and commenting as you go turns a confusing dump into clear logic.

Exploitation (lab): locate the check via xrefs

Section titled “Exploitation (lab): locate the check via xrefs”

In a crackme, the fastest route is usually to start from a string and follow its xrefs to the comparison:

Ventana de terminal
# 1) what strings are there?
strings -n 6 crackme | grep -iE 'wrong|correct|flag|pass'
# 2) in Ghidra: find the "Wrong password!" string and follow its xref
# -> lands in the validation function, right after the strcmp/memcmp
# 3) read what it compares: the expected key appears as a literal or is computed

This avoids reading the whole binary: the error message is a direct anchor to the relevant logic.

  • xrefs: find where a string/function is used; follow the chain from an interesting string to the logic.
  • Identify known algorithms: crypto constants (AES S-box, MD5 init) with FindCrypt / signsrch.
  • Recognize structures/classes (C++), vtables.
  • Compare binaries (bindiff) to find what changed between versions (patches → 1-day).
  • Obfuscated code: control flow flattening, encrypted strings, packing → the pseudo-C is unreadable; combine with Dynamic Analysis.
  • Packers: the executable is compressed/encrypted and the real code only exists at runtime → unpack (dynamic) then analyze the dump.
  • Stripped binaries: no function names, more reconstruction work.

Static analysis is safe because you don’t run the code: ideal as a first step with malware. Even so, opening the file in tools inside an isolated VM is good practice. For whatever is encrypted/packed you’ll need dynamic analysis, and there you must maximize isolation.

Mitigations / Blue Team (hindering static analysis)

Section titled “Mitigations / Blue Team (hindering static analysis)”

From the viewpoint of someone protecting their software (or the malware sample resisting analysis):

  • Symbol stripping, code obfuscation, and string encryption (decrypted at runtime).
  • Packers/commercial protectors (UPX, VMProtect, Themida).
  • Integrity checks.

All of this raises the cost of static analysis, it doesn’t prevent it (see Anti-debugging and Anti-analysis).

  • file/checksec/strings/imports as the first mapping
  • Locate main/entry and the relevant logic in Ghidra
  • Read the pseudo-C and rename variables/functions
  • Use xrefs to follow strings/functions to the logic
  • Recognize algorithms/constants (crypto: FindCrypt)
  • Identify whether there’s obfuscation/packing (switch to dynamic?)
  • Reconstruct the logic and answer the challenge’s question
  • Combine with dynamic if static stalls