Module 2 · Static Malware Analysis — Strings, Imports, YARA

Manish Garg
Manish Garg Associate of (ISC)² · RingSafe
May 14, 2026
3 min read
Read as
100% Free

No signup. No paywall. No catch. One of our 10 most-requested practitioner modules — published in full so anyone can learn for free. We earn through consulting, not by gating knowledge.

See all 10 free modules →

Why this module exists. Static analysis is the first pass on any malware sample — what you can learn without executing it. Strings, PE/ELF header inspection, imports, embedded resources, and YARA rules surface 70% of what the sample is going to do. This module is the operational workflow: tools, what to look for, and when to escalate to dynamic analysis.

Why this module exists. Running unknown malware on your laptop is how new IR responders become old IR responders. Static analysis is the lower-risk first cut: you learn whether the sample is interesting, what platform and architecture it targets, and what plausible behaviour it has — before you commit a sandbox to it.

The five-minute triage

# 1. What is it?
file sample.bin
# PE32+ executable (console) x86-64, for MS Windows
# OR
# ELF 64-bit LSB shared object, x86-64, dynamically linked

# 2. Hash it — match against VT, Hybrid Analysis, MalwareBazaar
sha256sum sample.bin
# Compare against public threat intel; known sample saves hours

# 3. Strings — interesting embedded text
strings -n 8 sample.bin | grep -iE 'http|\\.exe|cmd|powershell|c:\\\\|tmp|registry|admin'
# Look for: C2 URLs, dropper paths, command snippets, registry keys

# 4. Imports / exports
# Windows
pefile sample.bin --imports
# Linux
readelf -d sample.bin | grep NEEDED

# 5. Compile timestamp + sections
pefile sample.bin --time-date-stamp --sections

What the imports tell you

The Windows API functions a binary imports are the single highest-signal indicator of malicious capability:

Import Capability
CreateRemoteThread, VirtualAllocEx, WriteProcessMemory Process injection
InternetOpenUrl, WinHttpOpen, getaddrinfo Network communication (C2)
RegSetValueEx, RegCreateKey Registry persistence
CreateService, StartService Service-based persistence
CryptEncrypt, BCryptEncrypt Encryption (ransomware or C2 obfuscation)
SetWindowsHookEx Keylogging / input capture

A binary that imports nothing is highly suspicious — packers and shellcode loaders deliberately have minimal imports to evade signature matching. Conversely, a binary importing only kernel32.dll’s basic functions plus LoadLibrary and GetProcAddress is signalling dynamic API resolution — usually packer or anti-analysis.

YARA — the pattern-matching framework

YARA rules describe malware families by combinations of strings, hex patterns, and import sets. Apply public rule sets (YARA-Forge, Florian Roth’s signature-base, RustyYara, Neo23x0) before writing custom rules.

# Scan a single sample against community rules
yara -r ./signature-base/yara/ sample.bin

# Sample rule structure — illustrative
rule Cobalt_Strike_Beacon_v4 {
    meta:
        description = "Cobalt Strike Beacon v4 — partial signature"
        author = "Analyst"
    strings:
        $config_magic = { 00 01 00 01 00 02 ?? ?? ?? ?? }
        $http_get_template = "Mozilla/5.0 (compatible;"
        $beacon_str = "%s as %s\\%s: %d"
    condition:
        uint16(0) == 0x5A4D and 2 of them
}

A hit on a well-curated rule set is high-confidence attribution. A hit on a single overly-broad rule is a lead, not a conclusion.

PE-specific deep-dive — overlays, resources, certificates

  • Overlay. Data appended after the last PE section. Legitimate installers store payloads here; malware uses overlays for embedded second-stage. pefile sample.bin --overlay extracts it.
  • Resources. The .rsrc section can contain encoded payloads, configuration, or copyright strings. resource_hacker or pefile dumps them.
  • Authenticode signature. Signed binaries are not automatically clean — legitimate signing certificates get stolen routinely. But unsigned binaries from a vendor that normally signs is a strong anomaly.

The triage decision tree

  1. Hash match in public TI → known sample, skip to “what does the known family do” reference.
  2. Generic packer signature in YARA → escalate to unpacking workflow (Module 5).
  3. Suspicious imports + suspicious strings + uncommon file size → dynamic analysis in sandbox (Module 3).
  4. Nothing interesting in 30 minutes → probably PUA or false positive. Note and move on.

Common mistakes

  • Running strings on a packed binary and concluding “no strings, so harmless” — packed binaries have meaningful strings only after unpacking.
  • Treating high entropy as conclusive evidence of packing — encrypted overlays and legitimate compressed resources also raise entropy.
  • Skipping the compile timestamp — modern actors set it to zero or backdate it, but it is still a useful signal.

Key takeaways

  • Five-minute triage: file type, hash, strings, imports, sections.
  • Windows imports are the single best capability indicator.
  • YARA rule hits give family attribution; community rule sets first, custom rules second.
  • PE-specific: check overlay, resources, and Authenticode signature.
  • Decision tree pushes interesting samples to dynamic analysis; closes uninteresting ones quickly.
Worried about your exposure?

Get a free attack-surface review

We check what an attacker would see about your business — leaked credentials, exposed services, dark-web mentions. 30 minutes, no obligation.

Book exposure review Replies in 4 working hrs · India-only · Senior consultants