Malware = software or code built to damage systems, steal information, or give unauthorised access.
Business impact: financial loss · stolen data · disrupted services · reputational damage.
Why SOC cares about classification: the category decides the response: isolate the machine? reset credentials? investigate data theft? Wrong label = wrong playbook.
1. Malware Categories at a Glance
Category
Purpose
Typical behaviour
Example
Adware
Show unwanted ads
Pop-ups, browser hijacking
Fireball
Spyware
Secretly collect info
Tracks browsing, records keystrokes, captures data
Hermit, Pegasus
Ransomware
Extort money
Encrypts data, drops ransom note
WannaCry, Akira
Wiper
Destroy data/systems
Overwrites or deletes files permanently
PathWiper, Shamoon
C2 / RAT
Remote control by attacker
Connects to a server, receives commands
Emotet, QakBot
Data stealer
Steal sensitive info
Exfiltrates files, credentials, documents
Lumma Stealer, Agent Tesla
Keylogger
Record keystrokes
Captures everything typed
Zeus, RedLine
Cryptominer
Mine crypto on your hardware
High CPU, slow systems, network traffic
Coinhive
Telling look-alikes apart
Pair
The difference
Ransomware vs Wiper
Ransomware wants payment and (in theory) lets you recover. A wiper wants destruction, with no way back. Some wipers pose as ransomware to mislead.
Spyware vs Data stealer
Spyware watches over time (messages, mic, location). A stealer grabs and leaves (passwords, cookies, wallets).
Keylogger vs Stealer
A keylogger records input. A stealer takes stored data. Many modern stealers do both.
C2/RAT vs everything else
C2 is the remote-control channel. Other payloads often arrive through it.
Key reality: real families span several categories. QakBot started as a banking trojan, became a RAT, then a loader for ransomware. Classify by what it's doing now.
2. Spotting Each Type in an Organisation
Category
What users/SOC notice
First SOC priority
Adware
Pop-ups every few minutes even with no site open
Remove program, check how it got installed
Spyware
Personal emails accessed by someone else
Forensics on workstation, find the exfil destination
Ransomware
Ransom notes on many computers; often traced to an email attachment
Isolate immediately, stop spread
Wiper
Servers crash; files overwritten with random data
Isolate, restore from offline backups
C2
Endpoint contacts unfamiliar domains at odd hours
Isolate host, block domain, hunt for other infected hosts
Data stealer
Sensitive documents appear online
Scope what left, where to, from which machines
Keylogger
Unauthorised bank transfers; logger on the accountant's PC
Reset all typed credentials, review transactions
Cryptominer
Slow desktops, fans constantly running, high CPU
Remove, and ask how did it get in? Same door works for worse malware
Control (C2/RAT) → there's a human behind it, so find every infected host before cleanup tips them off.
3. Malware Families & Case Studies
Malware family = programs sharing the same origin or codebase and behaving similarly. Grouping by family lets teams reuse known detections, IOCs, and response steps.
Family
Category
How it spreads
What it does
MITRE tactics
Pegasus
Spyware
Crafted message or exploit, installs silently (often zero-click)
Reads texts, emails, location; records mic and camera. Victims: journalists, politicians, executives
Filename akira_readme.txt → a fixed IOC to search for across endpoints.
"Business-like" tone: offers a "security report," promises to be "negotiable."
Contact via Tor browser + a .onion chat + victim-specific login code.
Threatens to sell personal data, trade secrets, databases, source code if unpaid → data was exfiltrated before encryption. Treat as a data breach, not just an outage.
Stealer logs — where stolen data ends up
Underground forums sell/leak "stealer logs" in bulk, e.g. 355,472 lines in URL:LOGIN:PASS format, with a free sample and a paid set of 820K+.
One infected PC can leak credentials for every site saved in the browser, including corporate SSO, VPN, cloud consoles.
Stolen session cookies can bypass MFA.
That's why stealer infections are so dangerous: they feed initial access for later attacks (including ransomware).
4. Binary vs Script-Based Malware
Binary malware
Script-based malware
Form
Compiled: .exe, .dll
Interpreted: .js, .vbs, .bat, .ps1
Needs
Compatible OS/architecture
An interpreter (usually built-in)
Strengths
Stable, complex payloads; works where security tools are weak or outdated
Easy to modify, obfuscate, run in memory
Delivery
Attachments (invoice.pdf.exe), downloads, USB, dropped by other malware
C:\Users\Public\ → world-writable folder (Windows equivalent of /tmp)
start → execute the payload
Note: as printed, start sits outside the PowerShell string without a separator (; or &), so it likely wouldn't run as written. The pattern (download → save → execute) is what matters.
Lumma Stealer: popular stealer written in C, sold as MaaS (Malware-as-a-Service): criminals rent it rather than build it.
Structure of the obfuscated PowerShell
powershell
function Swvldsp2195 { # random function name $var1 = "var" + ([guid]::NewGuid().ToString('N').Substring(0,11)) # random var names … $qble51 = '$' + $var1 + ' = "TVqQAAMAAAAEAAAA//8AALgAAAA…"' # huge base64 blob … '$' + $var2 + ' = [Convert]::FromBase64String($' + $var1 + ');' + # decode '$' + $var3 + ' = [System.Reflection.Assembly]::Load($' + $var2 + ');' + # load in memory '$' + $var4 + ' = $' + $var3 + '.EntryPoint;' + # find Main() '$' + $var4 + '.Invoke($null, @());' # run it Invoke-Expression $qble51 # execute the built code}Swvldsp2195
Reading it step by step
Random names (Swvldsp2195, qble51) and variable names generated from new GUIDs on every run → text differs each execution → defeats simple string signatures.
Huge base64 blob → hides the real payload.
FromBase64String → decode the blob into bytes.
Reflection.Assembly::Load → load those bytes as a .NET program directly in memory.
.EntryPoint.Invoke → run its main function.
Invoke-Expression → executes the whole constructed script.
Result: the payload never touches disk → file-based AV may never scan it.
Analyst tricks hidden in this sample
TVqQAAMAAAAEAAAA at the start of a base64 blob = base64 of the MZ header → the blob is a Windows executable (PE file). Memorise TVqQ / TVoA: spotting it instantly tells you "there's an .exe hidden in here."
It's base64 decoding, not decryption. Base64 is encoding with no key; anyone can reverse it.
Assembly.Load only accepts .NET assemblies, so the embedded file is a .NET loader stage, even though Lumma's core is written in C.
Detection signals for this class of loader
Signal
Why
FromBase64String + Reflection.Assembly::Load
Reflective in-memory loading
Invoke-Expression / IEX
Executes dynamically built code
Very long base64 strings in scripts
Embedded payload
Base64 starting with TVqQ
Embedded Windows executable
Random-looking identifiers
Obfuscation
PowerShell launched by Office, browser, or script host
Unusual parent process
Defensive note: PowerShell Script Block Logging (Event ID 4104) records the de-obfuscated code as it runs, the Windows counterpart to auditd for this problem.
7. MITRE Tactics Mentioned
ID
Tactic
Seen in
TA0002
Execution
QakBot
TA0006
Credential Access
RedLine, QakBot
TA0009
Collection
Pegasus
TA0010
Exfiltration
Pegasus, Agent Tesla, RedLine
TA0011
Command and Control
Akira, QakBot
TA0040
Impact
Akira, Shamoon
8. One-Page Summary
Classify malware by purpose → it determines the response.
Goal: when a suspicious file or traffic shows up, reach an initial verdict (malicious or not, and roughly what it does) safely and methodically.
1. Who Analyses Malware, and Why
Team
Analyses malware to…
Security Operations (SOC)
Write detections for their network
Incident Response
Determine damage done, remediate and revert it
Threat Hunting
Extract IOCs to hunt for the malware across the network
Vendor malware researchers
Add detections to security products
OS vendor threat research (Microsoft, Google)
Find exploited vulnerabilities, add OS/app security features
Typical inputs: a PE file (Portable Executable, .exe/.dll, the most common) · a malicious document · a pcap (network capture).
2. Safety Rules (non-negotiable)
Malware is a loaded weapon. Before any analysis:
Dedicated machine only. Never analyse on a box with any other purpose.
Store samples in password-protected archives (zip/rar) when not analysing or when moving them. Prevents accidental double-click detonation and AV quarantine. Community convention password: infected.
Extract only inside the isolated lab, and only when analysing.
Use a VM with a clean snapshot.
Cut or monitor all internet connections.
Revert to the clean snapshot after every session so leftovers from one sample can't contaminate the next.
Shared folders are a hazard. A host↔VM shared directory that stays mounted while malware runs can be encrypted or infected. Disconnect it before detonation.
Static analysis is still done in the lab. You aren't running the file, but one mis-click or a vulnerable parsing tool can execute it.
REMnux (Reverse Engineering Malware Linux): Linux distro preloaded with analysis tools. A Windows PE can't run natively on Linux, which adds a safety layer for static work.
3. The Three Levels of Analysis
Static
Dynamic
Advanced
Runs the malware?
No
Yes, in a controlled VM/sandbox
Both
Examines
Strings, hashes, PE header, sections, imports, code
Processes, files, registry, network activity
Assembly instructions, memory, CPU state
Tools
file, strings, hash tools, pecheck, VirusTotal
Sandboxes, Procmon, Process Explorer, Regshot, Wireshark
Malware's dilemma: it can hide while sitting on disk, but to do its job it must run, and running code is observable. That's why dynamic analysis beats obfuscation.
Dynamic analysis advantage: in a lab, you control the noise (no real user, minimal services), so nearly everything you observe is the malware.
Malware's counter-move: detect the lab and take a benign code path → the sandbox reports "clean."
Order of work: basic static → basic dynamic → advanced (only if needed).
4. Basic Static Analysis
Purpose: size up the sample: what is it, what might it do, is it packed, how much effort will it take?
4a. True file type — file
bash
file wannacry# wannacry: PE32 executable (GUI) Intel 80386, for MS Windows
Output
Meaning
PE32
32-bit Windows executable (PE32+ = 64-bit)
(GUI)
Graphical program (vs console)
Intel 80386
Built for 32-bit x86 (the 386 started the x86 32-bit line)
file reads magic bytes (PE starts with MZ = 0x5A4D), so it ignores misleading extensions like invoice.pdf.
4b. Readable text — strings
bash
strings wannacry # dump printable stringsstrings wannacry > str # save to file for vim/grepstrings wannacry | more # page through (space = next page); `less` also works
Search the HASH. Don't upload the file by default.
Uploads are shared with the security community, including paying subscribers who can download your sample. Risks: leaking sensitive internal documents, and tipping off attackers that their custom malware has been found.
Tab
Shows
Detection
Verdicts from 60+ AV vendors (WannaCry: 61/66 + 5 sandboxes) and each vendor's name for it
Details
All hashes, file type, size, compile time, submission history (first seen, first/last submission)
Behavior
Sandbox results: IP traffic, domains, URLs in memory
Relations
Contacted domains and IPs, with their own detection scores
Community
Analyst comments and context
Reading tips:
Different vendor names for the same thing (WannaCryptor, WanaCry, Ransom.JB) are normal. Look for consensus.
Tags like self-delete, detect-debug-environment, long-sleeps, via-tor summarise behaviour quickly.
Relations noise:google.com, firefox.settings.services.mozilla.com, *.in-addr.arpa, Azure CDNs are sandbox background traffic, not IOCs. Prioritise contacts with detections (e.g. 131.188.40.189 5/90).
Compile timestamps can be faked. WannaCry shows a creation time of 2010-11-20, but it spread in 2017. Treat compile time as a hint, not a fact.
4e. The PE header
Metadata describing how Windows should load the file. Viewers: PE Tree (GUI), pecheck (CLI on REMnux), also pestudio/PE-bear.
Imports & exports
Imports = functions borrowed from Windows DLLs instead of re-implemented. Best static clue to behaviour.
Exports = functions offered to other programs. Normal for DLLs; many exports in an .exe is unusual.
API names are mostly self-explanatory; verify unfamiliar ones in Microsoft docs.
Import
Likely capability
InternetOpen, InternetOpenUrl
Internet communication
URLDownloadToFile
Download a file to disk
RegQueryValue, RegSetValueEx, RegCreateKey
Read/write registry (often persistence)
CreateService, OpenSCManager, StartService
Create/run Windows services (persistence)
CryptAcquireContext, CryptEncrypt
Cryptography → ransomware suspicion
CreateProcess, TerminateProcess
Launch/kill processes
LoadLibrary + GetProcAddress
Load APIs at runtime (hides real imports, common in packed malware)
WannaCry imports from ADVAPI32.dll: CreateServiceA, OpenServiceA, StartServiceA, OpenSCManagerA, registry functions, CryptReleaseContext → services + registry + crypto = consistent with ransomware that persists.
Note:TimeDateStamp: 0x0 in an import descriptor is normal for regular (unbound) imports. It's not the compile time and not suspicious.
Sections
Section
Contains
Normal permissions
.text
Executable code
Read + Execute
.rdata
Read-only data, often the import info
Read
.data
Global variables
Read + Write
.rsrc
Resources: icons, images, dialogs, embedded files
Read
Names vary by compiler/packer. Unusual names (.adata, UPX0, blank) are a clue.
Entropy (randomness, 0.0–8.0)
Range
Typical content
~0
Empty/zeroed (e.g. space reserved for unpacking)
~4–6.5
Normal code and data
> ~7.2
Compressed or encrypted → packed code, or an embedded archive
WannaCry: overall 7.995, .rsrc7.9998, .text 6.40, .data 4.46.
→ Code looks normal, but the resource section is near-maximum random: it holds an embedded compressed archive (matching the zlib/unzip strings). High entropy means "compressed/encrypted," not automatically "packed."
5. Basic Dynamic Analysis — Sandboxes
Sandbox (military term: a sand model of terrain for rehearsals) = isolated environment mimicking the malware's target, where you detonate it and observe.
What a good sandbox needs
Component
Examples / purpose
Lab machine mimicking the target
Same OS/apps the malware expects
Snapshots + revert
Clean slate each run
OS monitoring
Procmon (file/registry/process events), Process Explorer (process tree), Regshot (registry before/after diff)
Network monitoring
Wireshark, tcpdump
Controlled network
Dummy DNS + web server so malware "reaches" its server inside the lab (e.g. INetSim, FakeNet-NG)
Safe transfer in/out
Moving samples and logs without exposing the host. Beware shared folders
Sandbox options
Sandbox
Status / notes
Cuckoo
Best-known open-source (GSoC 2010), huge community signature set. Archived, no Python 3 → obsolete
CAPE
Cuckoo successor: adds debugging + memory dumping to unpack packed malware. Python 3, actively developed, community online version
The recovery-killer chain (MITRE T1490 Inhibit System Recovery), a near-certain ransomware signature:
Command
Destroys
vssadmin delete shadows /all /quiet
All Volume Shadow Copies
wmic shadowcopy delete
Same, via a second method (redundancy)
bcdedit … bootstatuspolicy ignoreallfailures
Suppresses boot-failure prompts
bcdedit … recoveryenabled no
Disables Windows Recovery
wbadmin delete catalog -quiet
Windows Backup catalog
Seeing any of these from a non-admin process = treat as active ransomware.
Network analysis
DNS: "No relevant DNS requests."
Contacted hosts: many IPs worldwide (DK, NL, DE, FR, US) on TCP 443 and 9001, all from taskhsvc.exe (PID 3356).
Port 9001 is Tor's default relay (ORPort); .onion addresses appeared in memory.
Why no DNS: Tor connects straight to relay IPs and resolves .onion inside the Tor network, so classic DNS monitoring sees nothing. Watch for traffic to known Tor relay IPs instead.
Extracted strings & files
Strings grouped per process/file (3,589 total), searchable, downloadable.
Recovered batch content:
text
echo SET ow = WScript.CreateObject("WScript.Shell")> m.vbsecho SET om = ow.CreateShortcut("C:\@WanaDecryptor@.lnk")>> m.vbsecho om.TargetPath = "C:\@WanaDecryptor@.exe">> m.vbsecho om.Save>> m.vbscscript.exe //nologo m.vbsdel m.vbs
→ builds a VBScript that creates a shortcut to the decryptor/ransom tool, runs it, then deletes the script to clean up.
2,000 extracted files, including Tor libraries (libevent, libeay32), tor.exe, screenshots, network.pcap.
Community comments at the end add context.
7. Anti-Analysis Techniques
7a. Packing & obfuscation (vs static analysis)
A packer compresses, encrypts, or obfuscates the real program. At runtime, a small stub unpacks the original code into memory and runs it.
Effect:strings shows garbage, imports reveal almost nothing.
Case: zmsuz3pinwl
bash
strings zmsuz3pinwl # DOS stub, RichH, .rsrc .data .adata, then junk (dApB, Qtq5…)pecheck zmsuz3pinwl
Indicator
Observed
Why it means "packed"
Overall entropy
7.978
Compressed/encrypted content
Section entropy
7.99 / 7.96 / 7.55, .data 7.87
Data shouldn't be this random
Blank section names
Several
Packer-generated sections
Entropy 0.0 sections (.adata)
Empty placeholders
Space reserved to unpack into
No .text section
Missing
Real code isn't there yet
WRITE + EXECUTE on sections 0–6
IMAGE_SCN_MEM_WRITE + IMAGE_SCN_MEM_EXECUTE
Stub must write decoded code then execute it. Normal programs keep code read+execute only
Imports
Few, "typical of packed executables"
Usually just LoadLibrary/GetProcAddress to rebuild imports later
Next step:unpack first (advanced topic), or let a sandbox like CAPE dump the unpacked code from memory.
7b. Sandbox evasion (vs dynamic analysis)
Technique
How it works
Why it beats sandboxes
Long sleep calls
Do nothing for minutes or hours
Sandboxes run for a limited time, then report "nothing happened"
User activity detection
Wait for mouse movement/keystrokes; advanced samples spot robotic mouse patterns
Automated sandboxes have no real user
Footprinting user activity
Check Office recent files, browser history, etc.
A pristine machine with no history looks like a lab → quit
VM detection
Look for VMware/VirtualBox drivers, tools, registry keys, MAC prefixes
VM present → assume sandbox → terminate or act benign
Also common: checking CPU core count, RAM/disk size, uptime, and debugger presence (WannaCry queried kernel debugger info).
Defender takeaway: a clean sandbox result is not proof of safety. Look at long-sleeps / detect-debug-environment tags, and lab realism (fake user files, history, hidden VM artefacts) matters.