TExcelTAD
Home › Malware Analysis, Digital Forensics & Incident Response › Malware Analysis and DFIR Exercises

Malware Analysis and DFIR Exercises

These exercises cover the whole course. Try each one before opening the answer; the links lead back to the lesson that teaches it. Everything uses synthetic data, lab addresses (10.10.0.0/24, RFC 5737 ranges) and names under lab.test.

Lab and handling

1. A colleague's analysis VM has a NAT adapter "for updates", a shared folder with the host and no snapshot. List the risks and the fixes.

NAT gives samples the Internet (reporting the victim, downloading payloads, attacking others): use host-only plus a fake Internet (INetSim/FakeNet). The shared folder lets a sample read or encrypt host files: remove it and transfer samples via a read-only ISO or an archive copied in. No snapshot means infections persist between runs: take a clean snapshot and revert after every run. See The Analysis Lab.

2. Defang http://198.51.100.23:8443/gate.php and ops@files.lab.test for a ticket.

hxxp://198[.]51[.]100[.]23:8443/gate[.]php and ops[@]files[.]lab[.]test. Keep the real values in machine-readable feeds only (Handling Samples).

Classification and static analysis

3. A sample collects saved browser passwords, uploads them once, and exits. Name the family of behaviour, two ATT&CK techniques and the first response step.

Infostealer. T1555.003 Credentials from Web Browsers and T1041 Exfiltration Over C2 Channel (or T1567 to a web service). First step: reset the affected credentials and revoke sessions and tokens (families, ATT&CK).

4. Two samples have different SHA-256 values, the same imphash and an ssdeep score of 88. What do you conclude, and what would you check before calling them one family?

They are probably builds of the same code (same import table, very similar content). Check that the similarity isn't just a shared packer, installer or runtime: compare strings, configuration format and behaviour, and the unpacked code (hashes, fuzzy hashing, PE triage).

5. A 2 MB file has whole-file entropy 6.9; its 4 KiB blocks alternate between about 4.5 and 7.98. What does it suggest?

Intermittent encryption of a text-like file (ransomware that encrypts every other block), or a container that interleaves compressed and plain parts. Check the header, the file type, and whether other files on the share show the same pattern (Entropy Profiles).

6. A lab blob was XOR-encoded with one byte and stored as hex. Decode it: run the code below.
python · try it yourself
blob = bytes.fromhex("2c2928723a3f2b2e3b2a612d2a2e2c202161232e2d613b2a3c3b")
for key in range(256):
    text = bytes(b ^ key for b in blob)
    if all(32 <= c < 127 for c in text) and b".test" in text:
        print(hex(key), text.decode())
0x4f cfg=update.beacon.lab.test

The scoring idea from Decoding XOR: keep only printable candidates that contain an expected token.

Behaviour

7. A process started from %TEMP% writes HKCU\Software\Microsoft\Windows\CurrentVersion\Run\Updater and starts cmd.exe /c whoami. Which Sysmon events record this, and which rule would you write?

Event 1 (process creation, with the parent and its path), event 13 (registry value set). Rule: a process whose image is in a user-writable temporary or download folder sets a value under a Run key, and/or starts a shell with discovery commands (Procmon and Sysmon, Sigma).

8. Connection intervals from one host to one domain: 300, 297, 305, 299, 301, 298 seconds. Compute the coefficient of variation and judge it.

Mean 300 s; the population standard deviation is about 2.58 s; cv ≈ 0.009. Extremely regular: beacon-like. Check the process, the domain's age and rarity, and whether it is known software (Network Behaviour).

Indicators and rules

9. Sort by the pyramid of pain, bottom to top: a JA4 fingerprint, a SHA-256, a domain, "dumps LSASS with a renamed system tool, then moves laterally with remote services", an IP address.

SHA-256, IP address, domain, JA4 fingerprint (network artefact of the tool), the behaviour description (TTPs) (pyramid).

10. Find the three mistakes in this rule: rule x { strings: $a = "cmd" $b = { 4D 5A } condition: any of them }

"cmd" is a short, common string (matches countless legitimate files); { 4D 5A } is two bytes that occur everywhere (and the MZ check belongs at offset 0 as uint16(0) == 0x5A4D); any of them lets either weak string match alone. There's also no meta, and it was evidently never tested against goodware (YARA basics, testing).

11. Write a YARA condition: a PE file with at most 3 imports in total and a section with entropy above 7.2.
text
import "pe"
import "math"
rule few_imports_high_entropy {
    condition:
        pe.is_pe and pe.number_of_imported_functions <= 3 and
        for any s in pe.sections : ( math.entropy(s.raw_data_offset, s.raw_data_size) > 7.2 )
}

pe.number_of_imported_functions exists in YARA 4.x; check field names with yara -D (YARA modules).

Forensics and response

12. In what order do you collect: the SIEM's proxy logs (retention: 3 days, incident started 2 days ago), a memory image, a disk image, the ARP cache?

ARP cache and memory first (most volatile), the proxy logs in parallel by a second person (they're at risk of deletion within a day), then the disk image (order of volatility).

13. $SI created 2020-03-01 00:00:00.000000, $FN created 2026-01-15 10:40:55.120334, for a DLL in System32. Interpret.

The file was created on this volume on 2026-01-15; its $SI times were set back to a whole-second 2020 value: timestomping. Correlate with the USN journal, EDR and Sysmon event 11 at 10:40:55 (MACB).

14. A deleted ZIP's FAT entry survives with first byte 0xE5; the disk is an SSD with TRIM. Can you recover it?

Maybe not: the entry gives start and size, but TRIM may already have erased the clusters (reads return zeros). Try, then look for other copies: shadow copies, backups, the cloud-sync history, proxy logs of the upload (carving).

15. In a memory image, svchost.exe (PID 3100) has parent explorer.exe and runs from C:\ProgramData\. What two checks did it fail, and what next?

Wrong parent (should be services.exe) and wrong path (should be C:\Windows\System32). Next: windows.cmdline, windows.netscan and windows.malfind for that PID, dump it, and YARA-scan it (memory forensics).

16. Ransomware notes were found at 01:10 UTC on a Saturday. The organisation is subject to NIS2 and the incident is significant. When are the early warning and the incident notification due?

Early warning by Sunday 01:10 UTC (24 h), incident notification by Tuesday 01:10 UTC (72 h), each "without undue delay" (ransomware playbook, UK and EU law).

17. Which backup do you restore: Friday 22:00 (tested), Saturday 22:00 (tested), Sunday 22:00 (untested)? The intrusion began Saturday 14:00; encryption ran Sunday 23:00.

Friday 22:00: the only tested backup from before the intrusion began. Saturday's was taken during the dwell time and may contain the attacker's tools and persistence (eradication and recovery).

Test yourself

Which indicator is hardest for an attacker to change?

  1. File hash
  2. IP address
  3. Domain
  4. TTPs

What does Volatility's psscan find that pslist may miss?

  1. Deleted files
  2. Processes unlinked from the active process list
  3. Registry keys
  4. Network shares

Which NIST SP 800-61 Rev. 3 Function covers restoring systems?

  1. Detect
  2. Respond
  3. Recover
  4. Protect

Why is a file whose M time is earlier than its B time not automatically suspicious?

  1. It is always suspicious
  2. Copies and archive extractions keep the source's modified time and get a new creation time
  3. NTFS has no B time
  4. M is always earlier

Which YARA modifier finds a string encoded with every single-byte XOR key?

  1. wide
  2. nocase
  3. xor
  4. fullword