Forensics Investigation and Malware Analysis · Topic 3 of 3

Malware Analysis, Static and Dynamic

Learn why SOCs analyze malware, how static analysis reads a file without running it and how dynamic analysis watches it run in a sandbox, for CSA 312-39.

  • 5 min
In a nutshell
  • Static analysis does not run the file; dynamic analysis runs it in an isolated sandbox.
  • Hashes identify a sample; strings, PE sections and imports hint at its purpose.
  • Packing hides code from static analysis; dynamic analysis reveals behavior.

What it is

Malware analysis is the study of a malicious file to learn what it does, how it persists, what it connects to and how to detect and remove it. For the SOC, the main output is indicators of compromise (IoCs): hashes, domains, IP addresses, file names, registry keys and behaviors to block and hunt for.

Static analysis examines the file without running it. Dynamic analysis runs it in an isolated environment and watches what it does.

Samplefrom EDR or emailStatichash, strings, PE infoDynamicsandbox runIoCshashes, domains, keysBlock and hunt

How it works

Why and where analysis is done

GoalExample output
Identify the familyKnown banking trojan or ransomware strain
Find IoCsFile hashes, command and control domains, mutex names
Understand impactData stolen, files encrypted, credentials harvested
Improve detectionNew SIEM rules, YARA rules, EDR blocklists

Analysis happens in a sandbox or a dedicated lab: virtual machines isolated from the production network, with snapshots to roll back after each run. Malware may detect virtual machines and change behavior, so analysts make the lab look like a real system.

Static analysis techniques

TechniqueWhat it revealsExample tools
File fingerprintingMD5, SHA-1 or SHA-256 hash to identify the sampleHashing utilities
Reputation scanningWhether antivirus engines and intelligence know the hashVirusTotal
File type checkReal type regardless of extension, using magic bytesFile identification tools
String searchEmbedded URLs, IPs, file paths, commands, messagesStrings, BinText
Packing and obfuscation detectionWhether the code is compressed or encrypted to hide itPEiD, Detect It Easy, entropy checks
PE structure analysisHeaders, sections, compile time, resourcesPE viewers
Imports and dependenciesWindows API functions and DLLs the file usesDependency viewers
DisassemblyThe code logic without running itIDA, Ghidra

Windows executables use the Portable Executable (PE) format. Common sections include .text (code), .data (initialized data), .rdata (read only data) and .rsrc (resources). Imports such as networking or process injection functions hint at capabilities.

High entropy and very few readable strings usually mean the file is packed. A packed sample often needs dynamic analysis to see its real behavior.

YARA rules from static findings

A YARA rule describes a malware family by strings or byte patterns and a condition. It is valid syntax like this:

rule Example_Dropper
{
    strings:
        $a = "evil-c2.example" ascii
        $b = { 4D 5A }
    condition:
        $b at 0 and $a
}

Here 4D 5A is the "MZ" header of a PE file at offset 0, and the rule matches when that header and the domain string are both present. SOCs use YARA rules to scan endpoints and file stores for the same family.

Dynamic analysis techniques

Baselineclean snapshotRun sampleisolated sandboxMonitorprocesses, files, registry, networkComparewith baselineReportbehavior and IoCs
What to monitorWhat it revealsExample tools
ProcessesNew processes, injection, child processesProcess Explorer, Process Monitor
File systemFiles created, changed, deleted or encryptedProcess Monitor
RegistryRun keys and other persistence entriesRegshot (before and after snapshot), Process Monitor
Services and scheduled tasksNew persistence mechanismsAutoruns
NetworkDNS lookups, connections, downloads, beaconsWireshark, TCPView
Simulated internetCaptures command and control requests safelyINetSim, FakeNet

Automated sandboxes such as Cuckoo Sandbox (open source) and online services like ANY.RUN or Joe Sandbox run the sample and produce a behavior report. Analysts still review the report, because evasive malware may sleep or check for a virtual machine first.

Static versus dynamic

PointStaticDynamic
Runs the sampleNoYes, in isolation
SpeedFast for basic checksSlower, needs a lab or sandbox
RiskVery lowHigher, needs strict isolation
Defeated byPacking and obfuscationSandbox detection and delayed execution
Best forQuick triage, hashes, strings, importsReal behavior, network IoCs, persistence

Most analysis uses both: static first for quick facts, then dynamic to confirm behavior.

A worked example

EDR quarantines an invoice attachment. The analyst hashes it, finds no match in reputation services and sees high entropy with few strings, suggesting packing.

In a sandbox the sample unpacks, writes itself to a user folder, adds a Run registry key and beacons to a domain every five minutes. The SOC blocks the hash and domain, writes a YARA rule and hunts for the registry key on all endpoints.

How the exam asks about this

  • "Which analysis type examines a file's hash, strings and imports without executing it?" → Static analysis.
  • "A sample shows high entropy and almost no readable strings. What is the likely reason?" → It is packed or obfuscated.
  • "Which tool compares registry snapshots taken before and after running a sample?" → Regshot.

What to remember for the exam

  • Static analysis does not run the file; dynamic analysis runs it in an isolated sandbox.
  • Hashes identify a sample; strings, PE sections and imports hint at its purpose.
  • Packing hides code from static analysis; dynamic analysis reveals behavior.
  • Monitor processes, files, registry, services and network, compared to a clean baseline.
  • The SOC output is IoCs and detection rules such as YARA.
Watch out

Never run a malware sample on a production network or your own workstation. Use an isolated sandbox with snapshots and no route to real systems.

Common mistakes

Trusting a clean reputation result. A new or modified sample may not be known yet, so a zero detection score is not proof of safety.

Relying only on the file extension. Malware often hides behind document or image extensions; check magic bytes.

Taking the sandbox report as complete. Evasive malware can stay quiet in a sandbox, so short runs can miss behavior.

Check yourself

  • What is the main advantage of static analysis?

    It is fast and safe because the sample is never executed.

  • Why might a sandbox show no malicious activity for a real malware sample?

    The malware may detect the virtual machine or delay execution to evade analysis.

  • What does a YARA rule do?

    It describes strings or byte patterns with a condition so files belonging to a malware family can be matched.

Topic 3 of 3 in Forensics Investigation and Malware Analysis

Test yourself on Forensics Investigation and Malware Analysis

The full EC-Council 312-39 question bank has 700 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by EC-Council. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.