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
- 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.
How it works
Why and where analysis is done
| Goal | Example output |
|---|---|
| Identify the family | Known banking trojan or ransomware strain |
| Find IoCs | File hashes, command and control domains, mutex names |
| Understand impact | Data stolen, files encrypted, credentials harvested |
| Improve detection | New 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
| Technique | What it reveals | Example tools |
|---|---|---|
| File fingerprinting | MD5, SHA-1 or SHA-256 hash to identify the sample | Hashing utilities |
| Reputation scanning | Whether antivirus engines and intelligence know the hash | VirusTotal |
| File type check | Real type regardless of extension, using magic bytes | File identification tools |
| String search | Embedded URLs, IPs, file paths, commands, messages | Strings, BinText |
| Packing and obfuscation detection | Whether the code is compressed or encrypted to hide it | PEiD, Detect It Easy, entropy checks |
| PE structure analysis | Headers, sections, compile time, resources | PE viewers |
| Imports and dependencies | Windows API functions and DLLs the file uses | Dependency viewers |
| Disassembly | The code logic without running it | IDA, 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
| What to monitor | What it reveals | Example tools |
|---|---|---|
| Processes | New processes, injection, child processes | Process Explorer, Process Monitor |
| File system | Files created, changed, deleted or encrypted | Process Monitor |
| Registry | Run keys and other persistence entries | Regshot (before and after snapshot), Process Monitor |
| Services and scheduled tasks | New persistence mechanisms | Autoruns |
| Network | DNS lookups, connections, downloads, beacons | Wireshark, TCPView |
| Simulated internet | Captures command and control requests safely | INetSim, 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
| Point | Static | Dynamic |
|---|---|---|
| Runs the sample | No | Yes, in isolation |
| Speed | Fast for basic checks | Slower, needs a lab or sandbox |
| Risk | Very low | Higher, needs strict isolation |
| Defeated by | Packing and obfuscation | Sandbox detection and delayed execution |
| Best for | Quick triage, hashes, strings, imports | Real 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.
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.