CTF Arsenal
DFIR/Malware Forensics

Safe Static Malware Analysis

Concept

Static analysis examines a malware sample without executing it: strings, hashes, embedded signatures (PE/ELF headers), and YARA rule matches. This is the safe default for CTF/lab analysis — dynamic (execution-based) analysis carries real risk and belongs only in an isolated, disposable sandbox, never on your host.

When to Use

  • Challenge provides a suspicious binary.
  • Always the first step before considering any dynamic analysis.

Workflow

  1. 1
    Hash the sample immediately

    Before any other action, for identification/IOC tracking.

  2. 2
    Identify the file type and format details

    file, PE-bear/Detect It Easy for PE; file/readelf for ELF.

  3. 3
    Extract strings

    Look for URLs, IPs, file paths, commands, readable constants.

  4. 4
    Run YARA rules if available

    Match against known malware-family signatures.

  5. 5
    Only consider dynamic analysis in an isolated sandbox (e.g. REMnux VM), never on your main system.

Commands

sha256sum FILE_PATH
sha256sum sample.exe

Computes a cryptographic hash to identify the sample uniquely and check it against threat-intel databases.

When to use: Always the very first command — before opening, extracting, or touching the file further.

Expected output:

e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b85  sample.exe

Look for: The hash itself — record it as an IOC regardless of other findings.

Next step: Optionally check the hash against local/offline threat intel if available (do not upload unknown samples to third-party cloud scanners without authorization, as that could leak evidence/IP).

strings -n 8 FILE_PATH
strings -n 8 sample.exe | less

Extracts printable character sequences of at least the given length from the binary.

  • -n 8 — Minimum string length to reduce noise from short, irrelevant sequences.

When to use: Standard first-look at any binary's embedded content.

Expected output:

http://evil-c2.example/beacon
C:\Users\victim\AppData\Roaming\malware.exe
cmd.exe /c

Look for: URLs/IPs (potential C2), file paths, registry keys, suspicious command strings, readable config blobs.

Next step: Treat any URL/IP as an IOC; cross-reference with network-forensics evidence if a pcap is also provided.

file FILE_PATH; readelf -h FILE_PATH (ELF) / use PE-bear or Detect It Easy (PE)
file sample; readelf -h sample

Identifies the binary's architecture, format, and header details without executing it.

When to use: To confirm architecture/compile target and spot anomalies (e.g. packed binary, unusual section names).

Expected output:

ELF 64-bit LSB executable, x86-64, dynamically linked

Look for: Statically linked vs dynamic (statically linked can hide more), unusual entry point, packed/obfuscated indicators.

Next step: If packed, note it as an anti-analysis indicator; consider Detect It Easy for packer identification.

yara RULES_FILE_PATH FILE_PATH
yara malware_rules.yar sample.exe

Matches the sample against a set of YARA pattern rules, flagging known malware-family characteristics.

When to use: When a relevant YARA ruleset is available (challenge-provided or a known public set).

Expected output:

Emotet_Generic sample.exe

Look for: Any rule match — treat as a strong lead, not absolute proof, and validate with other evidence.

Next step: Research the matched rule/family for known behavior to guide further analysis.

Tools

Strings / file

Baseline, zero-risk static inspection tools present on virtually every Linux system.

When to use: Always first.

strings -n 8 FILE_PATH

Example workflow: file for type -> strings for content leads -> deeper tools as needed.

YARA

Pattern-matching engine for identifying malware families/characteristics via rules.

When to use: When you have or can write rules describing known indicators.

sudo apt install yara
yara rules.yar FILE_PATH

Example workflow: Use public rule sets (offline copies) relevant to the challenge's apparent malware family.

capa

Automatically identifies capabilities (e.g. 'persists via registry run key', 'communicates over HTTP') from a binary's code, without running it.

When to use: To quickly summarize what a PE/ELF binary is capable of before manual reverse engineering.

pip install flare-capa (or use the standalone binary release)
capa FILE_PATH

Example workflow: Run capa first for a capability summary, then dig into specific functions with Ghidra.

Ghidra

Full disassembler/decompiler for deep static reverse engineering.

When to use: When strings/capa aren't enough and you need to read actual decompiled logic.

Open the binary in Ghidra's GUI, auto-analyze, browse functions.

Example workflow: Import -> auto-analyze -> inspect main/entry point -> follow suspicious function calls (network, file, registry APIs).

Findings & Interpretation

Interesting

  • Embedded C2 URLs/IPs
  • Hardcoded persistence mechanisms (registry keys, cron entries, service names)
  • Readable configuration blobs

Suspicious

  • High entropy sections suggesting packing/encryption
  • Imports limited to very generic APIs with no clear purpose matching the apparent function (obfuscation sign)

False Positives

  • Legitimate installer/packer use (e.g. UPX) doesn't automatically mean malicious — many legitimate tools are packed too

How to Validate

  • Corroborate strings/YARA findings against multiple independent indicators before concluding maliciousness or family attribution

Next Step

  • Extracted IOCs (hashes, URLs, IPs) feed Incident Response's IOC-extraction phase.
  • Only proceed to dynamic/behavioral analysis inside an isolated, disposable VM (e.g. REMnux, with network access disabled or routed through a fake-internet tool) — never on a host with real data or network access.

Troubleshooting

strings output is almost entirely noise/unreadable.

Likely cause: The binary is packed, encrypted, or obfuscated.

Verify: Check entropy/section anomalies with Detect It Easy or a packer-ID tool.

Fix: Identify the packer, then use the matching unpacking tool/technique, or analyze in a debugger up to the unpacking stub's completion (in an isolated VM only).

Recovery: Fall back to capa/Ghidra to extract capability information even through some obfuscation.

Avoid repeating: Don't skip the packed/obfuscated check — it changes the whole analysis plan.