Live lesson · progress saved to your account

Malware Analysis Fundamentals

Turn one infection into detections that protect everyone. Build a safe analysis lab, triage a sample statically (hashes, strings, PE headers, imports, packers and entropy), detonate it in a sandbox, map its behaviour to MITRE ATT&CK, and write a YARA rule that catches the whole family without false positives.

advanced140 minwalkthrough

Anyone can read this lesson. To submit answers and earn XP, create a free account.

TASK 01Mission briefing: the 'salary revision' attachment

EMAIL · from "HR Payroll" payroll@aushadh-hr-portal.example · to 63 employees Subject: Revised salary structure FY 2026-27: please acknowledge "Dear colleague, please find your revised salary letter attached. Acknowledge before Friday." Attachment: Salary_Revision_2026.pdf

Aushadh Pharma (fictional) makes generic medicines in Hyderabad. The email gateway let this through to 63 people, and four of them opened it. The SOC pulled the attachment from quarantine. It isn't a PDF:

What the employee saw vs what it really is extensions hidden

File Explorer · Downloads

PDF

Salary_Revision_2026.pdf

Type: (icon says PDF) · 214 KB

first bytes (hex)

4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF

a real PDF starts with

25 50 44 46 (%PDF)

Magic bytes don't lie (Room 02).

Windows hides known file extensions by default, so Salary_Revision_2026.pdf.exe shows up as Salary_Revision_2026.pdf, with a PDF icon embedded by the attacker. One double-click runs a program.

Your job as malware analyst: work out what it does, safely, and turn that into things defenders can use: indicators of compromise (IOCs), an ATT&CK mapping, and a YARA rule that catches this sample and its siblings. Everything in this room uses a harmless training sample in a simulated lab.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 02Lab safety: never analyse malware on your laptop

Malware is built to spread, steal and destroy. Analysis happens only in a lab designed to contain it:

Build a safe analysis lab, then detonate risk 100%
  • Isolated virtual machines (for example a Windows analysis VM such as FLARE-VM, and a Linux VM such as REMnux), on a host-only or internal network, never bridged to the office LAN.
  • Snapshots: take a clean snapshot before each detonation and revert afterwards.
  • No shared folders, shared clipboard or drag-and-drop between guest and host. They are bridges for malware too.
  • Simulated internet: tools like INetSim or FakeNet-NG answer DNS and HTTP requests so the sample "talks" without reaching the real attacker.
  • Transfer samples in password-protected archives (the convention is the password infected) and defang IOCs in reports: hxxp://evil[.]example.
  • Some malware detects VMs and sandboxes and behaves innocently; note it, don't fight it on day one.

Be aware: uploading a sample to a public multi-scanner shares it with everyone, including the attacker, who may be watching for their file to appear. Search by hash first.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 03Static analysis: hashes, strings and PE anatomy

Static analysis examines the file without running it.

  1. Hashes: MD5, SHA-1 and SHA-256 identify the exact file. Search them in threat intel before anything else. A changed byte means a new hash, so hashes catch this file, not its siblings.
  2. Strings: readable text inside the binary. URLs, domains, IPs, registry paths, mutex names, error messages and user agents are gold.
  3. PE structure: Windows executables use the Portable Executable format:
PE anatomy: Salary_Revision_2026.pdf.exe unfolded click a part

DOS header

e_magic = 'MZ' (4D 5A)

e_lfanew = 0x000000F8 → PE header

  • DOS header starting with MZ, whose e_lfanew field points to the PE signature PE\0\0.
  • File header: target machine, number of sections and a compile timestamp (easy to fake).
  • Optional header: the entry point address and preferred image base.
  • Section table: .text (code), .rdata (read-only data and imports), .data, .rsrc (resources such as icons).
  • Import table: the Windows API functions the program calls. VirtualAllocEx + WriteProcessMemory + CreateRemoteThread together are the classic process injection trio.

Packers compress or encrypt the real code so strings and imports disappear. Clues: section names like UPX0/UPX1, very few imports, and high entropy (close to the maximum of 8 bits per byte):

Entropy: spotting a packed binary UPX packed
0.00
UPX0
7.93
UPX1
3.90
.rsrc
7.2+ ≈ compressed/encrypted

Imports: 6 functions (LoadLibraryA, GetProcAddress, VirtualProtect…)

Interesting strings: almost none

Real code is compressed inside UPX1; a tiny stub unpacks it in memory at runtime.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 04Dynamic analysis: detonate in the glass box

Dynamic analysis runs the sample in the isolated lab and watches everything it touches:

Sandbox detonation: the glass box 0/8 events
analysis VM · host-only
WatchTools (examples)
Processes created, injected intoProcess Explorer, Process Hacker / System Informer
File and registry activityProcmon (Process Monitor), Regshot before/after
NetworkWireshark, FakeNet-NG, INetSim logs
Everything at once, automaticallySandboxes such as CAPE or commercial equivalents

Things to look for: dropped files (especially in %APPDATA% and %TEMP%), persistence (Run keys, scheduled tasks, services), injection into other processes, mutexes (a named object malware creates so it runs only once; a great IOC), DNS lookups and HTTP beacons.

Dynamic analysis is fast but shallow: you only see the paths the sample took this time. Malware may sleep for hours, check for a debugger (IsDebuggerPresent) or refuse to run in a VM. Combine it with static findings.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 05Behaviour and ATT&CK mapping

Raw events ("wrote a registry value") become useful when you describe them as behaviours in a shared language: MITRE ATT&CK (Room 18). Mapping lets the SOC check "can we detect this technique?", and lets you compare families.

From raw behaviour to ATT&CK technique click a behaviour

T1566.001

Phishing: Spearphishing Attachment

Tactic: Initial Access

Evidence: Email attachment sent to 63 staff

The chain from this sample (a fictional family nicknamed DhanLoader), as ATT&CK sees it:

  • T1566.001 Phishing: Spearphishing Attachment → T1204.002 User Execution: Malicious File
  • T1036.007 Masquerading: Double File Extension
  • T1027.002 Obfuscated Files or Information: Software Packing
  • T1547.001 Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder
  • T1055 Process Injection
  • T1071.001 Application Layer Protocol: Web Protocols (C2 over HTTP)

Write the mapping at the most specific level the evidence supports, and keep the evidence next to each technique: "T1547.001 because Procmon shows RegSetValue HKCU...\Run\OneDriveSync".

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 06IOCs, the Pyramid of Pain and YARA

Not all indicators are equal. David Bianco's Pyramid of Pain ranks them by how much it hurts the attacker when you block them:

Pyramid of Pain: how much does blocking it hurt them? Trivial

Hash values · Trivial

SHA-256 a3f19c07…

Attacker changes this in minutes.

A new hash costs the attacker one recompile; a new C2 domain costs a few rupees; but changing TTPs (how they operate) means retooling and retraining. Good analysts deliver the whole stack.

YARA is the pattern-matching language analysts use to describe a malware family rather than one file. A rule has meta, strings (text, hex with ?? wildcards, or regex) and a condition:

YARA rule anatomy and a test scan scanning dhan_a.exe
rule DhanLoader_Family {  meta:    author = "Aushadh SOC"    description = "DhanLoader training family"  strings:    $m = "DhanL0ader_" ascii    $u = "/api/v2/beat" ascii    $x = { 8A 04 ?? 34 5C 88 04 ?? }  condition:    uint16(0) == 0x5A4D and filesize < 500KB    and 2 of them}

dhan_a.exe…

notepad.exe…

dhan_b.exe…

putty.exe…

report.pdf…

dhan_c.exe…

report.pdf mentions the strings but isn't MZ, so it stays clean.

The same rule runs on endpoints, mail gateways and sample repositories.

Good rules combine a cheap file check (uint16(0) == 0x5A4D means "starts with MZ"), a size limit, and several unique strings, so they catch variants but not innocent software. Every rule is tested against a goodware set before it ships.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 07Hands-on: static triage of the sample

You're on a REMnux-style analysis VM (simulated) with the training sample in ~/case-ASH-17/. Triage it statically: identify it, detect and remove the packer, and pull out the indicators.

Lab · Static triage of the sample 0/5 goals
analysis VM · network: none
remnux@ash-lab:~/case-ASH-17$ training sample loaded (harmless) · type 'help'
$

Goals

Hash the sample (SHA-256)

Identify the packer from sections and entropy

Unpack to a new file (keep the original)

Review the unpacked imports

Extract strings from the unpacked file

Hints: file, sha256sum, pe-info (sections, entropy, imports), strings -n 6 FILE | grep ..., and upx -d FILE -o unpacked.exe. Type help for the full list.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+30 XP

TASK 08Hands-on: dynamic analysis in the sandbox

Now detonate it. The sandbox VM is on a host-only network with FakeNet-NG answering. Snapshot first, run the sample, then sort the signal from the noise: Windows is busy even when nothing malicious happens.

Lab · Detonate and tag the malicious events not run

Tag only the events caused by the sample. Background noise from Windows Update, Defender and the browser must stay untagged.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+30 XP

TASK 09Hands-on: write a YARA rule for the family

Threat intel found two more samples of the same family on a malware-sharing feed: dhan_b.exe and dhan_c.exe. Write one rule that matches all three family samples and none of the goodware set: a legitimate heartbeat monitor, a backup agent, PuTTY, Notepad, and a threat-intel PDF that mentions the family's strings.

Lab · Write a YARA rule for the family edit, then scan
dhanloader.yar

Test set (click to inspect)

Supported: text strings with nocase, wide, ascii; hex strings with ??; conditions with and, or, not, parentheses, any of them, all of them, N of ($a*), uint16(0) == 0x5A4D and filesize < 500KB. Click a sample to see its strings.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+30 XP

TASK 10Final mission: the malware analysis report

Aushadh's SOC, the email team and CERT-In's sharing partners all need your findings in one report: a behaviour summary, defanged IOCs ranked by the Pyramid of Pain, and an ATT&CK mapping with evidence.

Final mission · Malware analysis report detect · block · hunt

1. Behaviour summary

2. IOCs to share (defanged; choose only real indicators)

3. ATT&CK mapping

A good report lets a SOC analyst who never saw the sample detect it, block it and hunt for it within the hour.

Complete the mission for the Reverser badge and the room's XP.

Answer the questions

+10 XP

+10 XP

+10 XP

+30 XP