TExcelTAD
Home › Malware Analysis, Digital Forensics & Incident Response › Mini Project: Investigate a Synthetic Incident End to End

Mini Project: Investigate a Synthetic Incident End to End

This project puts the whole course to work on one case. On Monday 2026-01-19 at 09:15 UTC, the mail gateway's retro-scan flags an attachment called invoice_viewer.exe that a user, Mai, received and opened about a quarter of an hour earlier on laptop lt-1042 (10.10.0.33). You receive an incident bundle: the file, a packet capture from the network sensor in front of her floor, and an export of Sysmon events from her laptop. Your job: triage the file, decode what it hides, write and test a YARA rule, analyse the traffic, build a timeline, list the indicators, advise on containment, and write the incident report.

Scope and safety. Everything is synthetic and benign. The "malware" is a byte blob that only looks like a dropper (an MZ header, an XOR-encoded configuration, a UTF-16 mutex name, random bytes); it contains no code and is never run. The capture and the events are generated by the session itself, with lab addresses (10.10.0.0/24, 203.0.113.0/24 from RFC 5737) and names under lab.test. The session has no network.

Part 1: the analysis session

The first block of the session builds the bundle (in a real case you would receive it); for the full exercise, skip reading the generator and start at "1. triage". Then it runs the analysis steps in order: integrity hashes of the evidence, file triage, configuration decoding, a YARA rule tested against the evidence and 1,712 goodware files, DNS and HTTP analysis with a beacon check, and a merged timeline.

bash · try it yourself
mkdir -p evidence work && python3 - <<'PY' 2>/dev/null
# ---- the incident bundle you receive (synthetic; built here so the session is self-contained) ----
import random, csv
from scapy.all import Ether, IP, UDP, TCP, DNS, DNSQR, DNSRR, Raw, wrpcap
r = random.Random(2026)
cfg = b"c2=sync.files-cdn.lab.test;path=/upload;ua=LabSync/2.3;interval=120"
f = (b"MZ" + bytes(62) + b"This program cannot be run in DOS mode.\r\n
quot; + r.randbytes(600) + b"LABSYNC-CFG\x03" + bytes(c ^ 0x37 for c in cfg) + b"\x37" + r.randbytes(64) + "Global\\LabSync-91".encode("utf-16-le") + b"\0\0" + r.randbytes(3000)) open("evidence/invoice_viewer.bin", "wb").write(f) T0, pk = 1768813200.0, [] # 2026-01-19 09:00:00 UTC E = Ether(src="02:00:00:0a:0a:21", dst="02:00:00:0a:0a:01") def add(p, t): p.time = T0 + t; pk.append(p) add(E/IP(src="10.10.0.33", dst="10.10.0.53")/UDP(sport=53111, dport=53)/DNS(id=0x5101, rd=1, qd=DNSQR(qname="sync.files-cdn.lab.test")), 125.0) add(E/IP(src="10.10.0.53", dst="10.10.0.33")/UDP(sport=53, dport=53111)/DNS(id=0x5101, qr=1, rd=1, ra=1, qd=DNSQR(qname="sync.files-cdn.lab.test"), an=DNSRR(rrname="sync.files-cdn.lab.test", ttl=300, rdata="203.0.113.80")), 125.002) def http(t, method, uri, body=b"", sport=50100): req = (f"{method} {uri} HTTP/1.1\r\nHost: sync.files-cdn.lab.test\r\nUser-Agent: LabSync/2.3\r\n" f"Content-Length: {len(body)}\r\n\r\n").encode() + body C, S = E/IP(src="10.10.0.33", dst="203.0.113.80"), E/IP(src="203.0.113.80", dst="10.10.0.33") add(C/TCP(sport=sport, dport=80, flags="S", seq=100), t); add(S/TCP(sport=80, dport=sport, flags="SA", seq=900, ack=101), t + 0.02) add(C/TCP(sport=sport, dport=80, flags="A", seq=101, ack=901), t + 0.04) add(C/TCP(sport=sport, dport=80, flags="PA", seq=101, ack=901)/Raw(req), t + 0.05) add(S/TCP(sport=80, dport=sport, flags="PA", seq=901, ack=101 + len(req))/Raw(b"HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nok"), t + 0.09) for i in range(6): http(126 + 120 * i + r.uniform(-2, 2), "GET", "/upload?h=lt-1042&s=0", sport=50100 + i) http(500.0, "POST", "/upload?h=lt-1042&s=1", body=bytes(r.randrange(256) for _ in range(1200)), sport=50200) pk.sort(key=lambda p: p.time); wrpcap("evidence/capture.pcap", pk) rows = [("2026-01-19 09:01:58", 1, "OUTLOOK.EXE", r"C:\Users\mai\AppData\Local\Microsoft\Windows\INetCache\Content.Outlook\Q7\invoice_viewer.exe", "user opened the mail attachment"), ("2026-01-19 09:02:01", 11, "invoice_viewer.exe", r"C:\Users\mai\AppData\Roaming\LabSync\labsync.exe", ""), ("2026-01-19 09:02:02", 13, "invoice_viewer.exe", r"HKU\S-1-5-21-1042\Software\Microsoft\Windows\CurrentVersion\Run\LabSync", r"C:\Users\mai\AppData\Roaming\LabSync\labsync.exe"), ("2026-01-19 09:02:04", 1, "invoice_viewer.exe", r"C:\Windows\System32\cmd.exe", "cmd.exe /c systeminfo"), ("2026-01-19 09:06:30", 11, "invoice_viewer.exe", r"C:\Users\mai\AppData\Local\Temp\q.zip", "")] with open("evidence/sysmon.csv", "w", newline="") as fh: w = csv.writer(fh); w.writerow(["utc", "event_id", "image", "target", "details"]); w.writerows(rows) PY cd evidence && sha256sum * > ../work/evidence.sha256 && cd .. && cut -c1-16,65- work/evidence.sha256 echo "== 1. triage of the file" file evidence/invoice_viewer.bin strings -n 8 evidence/invoice_viewer.bin | head -3 strings -e l -n 8 evidence/invoice_viewer.bin python3 - <<'PY' import math, re from collections import Counter d = open("evidence/invoice_viewer.bin", "rb").read() H = lambda b: -sum(c / len(b) * math.log2(c / len(b)) for c in Counter(b).values()) print(f"size {len(d)} entropy {H(d):.2f} last 3000 bytes {H(d[-3000:]):.2f}") i = d.index(b"LABSYNC-CFG") + 12 blob = d[i:i + 120] for k in range(1, 256): t = bytes(b ^ k for b in blob) m = re.match(rb"[\x20-\x7e]{20,}(?=\x00)", t) # a printable run ending in a zero byte if m and m.group().count(b"=") >= 2 and b";" in m.group(): print(f"config after marker, XOR key {k:#04x}: {m.group().decode()}") PY echo "== 2. YARA rule, tested on the evidence and on goodware" cat > work/labsync.yar <<'RULE' rule LabSync_dropper_config { meta: author = "analyst" description = "LabSync (synthetic lab family): config marker plus encoded C2 or mutex" date = "2026-01-19" strings: $marker = "LABSYNC-CFG" $c2 = "files-cdn.lab.test" xor(0x01-0xff) $mutex = "Global\\LabSync-" wide condition: uint16(0) == 0x5A4D and filesize < 1MB and $marker and ($c2 or $mutex) } RULE yara -s work/labsync.yar evidence/invoice_viewer.bin find /usr/bin /usr/lib/x86_64-linux-gnu -type f -size -20M > work/goodware.txt echo "goodware hits: $(yara --scan-list work/labsync.yar work/goodware.txt 2>/dev/null | wc -l) of $(wc -l < work/goodware.txt) files" echo "== 3. network" tshark -r evidence/capture.pcap -Y 'dns.flags.response == 1' -T fields -e dns.qry.name -e dns.a tshark -r evidence/capture.pcap -Y http.request -T fields -e frame.time_epoch -e http.request.method \ -e http.request.uri -e http.content_length -e http.user_agent > work/http.tsv python3 - <<'PY' import statistics as st, datetime as dt rows = [l.rstrip("\n").split("\t") for l in open("work/http.tsv")] for t, m, uri, length, ua in rows: print(f"{dt.datetime.fromtimestamp(float(t), dt.timezone.utc):%H:%M:%S} {m:<4} {uri:<24} body={length or 0:>5} {ua}") gets = [float(r[0]) for r in rows if r[1] == "GET"] gaps = [b - a for a, b in zip(gets, gets[1:])] print(f"GET interval mean {st.mean(gaps):.1f}s cv {st.pstdev(gaps) / st.mean(gaps):.3f}") PY echo "== 4. timeline (UTC)" python3 - <<'PY' import csv, datetime as dt ev = [(r["utc"], f"sysmon {r['event_id']:>2} {r['image']}: {r['target'].split(chr(92))[-1]} {r['details']}".rstrip()) for r in csv.DictReader(open("evidence/sysmon.csv"))] for l in open("work/http.tsv"): t, m, uri, length, ua = l.rstrip("\n").split("\t") ev.append((f"{dt.datetime.fromtimestamp(float(t), dt.timezone.utc):%Y-%m-%d %H:%M:%S}", f"proxy {m} {uri} ({length or 0} bytes)")) for t, e in sorted(ev): print(t[11:], e) PY
def8b65479db76a3  capture.pcap
ecd0d3f584176ef9  invoice_viewer.bin
6f778dbb24b905c0  sysmon.csv
== 1. triage of the file
evidence/invoice_viewer.bin: MS-DOS executable, MZ for MS-DOS
This program cannot be run in DOS mode.
LABSYNC-CFG
^YCREAV[
Global\LabSync-91
size 3886  entropy 7.91  last 3000 bytes 7.94
config after marker, XOR key 0x37: c2=sync.files-cdn.lab.test;path=/upload;ua=LabSync/2.3;interval=120
== 2. YARA rule, tested on the evidence and on goodware
LabSync_dropper_config evidence/invoice_viewer.bin
0x2c2:$marker: LABSYNC-CFG
0x2d6:$c2: Q^[RD\x1ATSY\x19[VU\x19CRDC
0x352:$mutex: G\x00l\x00o\x00b\x00a\x00l\x00\\x00L\x00a\x00b\x00S\x00y\x00n\x00c\x00-\x00
goodware hits: 0 of 1712 files
== 3. network
sync.files-cdn.lab.test	203.0.113.80
09:02:06  GET  /upload?h=lt-1042&s=0    body=    0  LabSync/2.3
09:04:04  GET  /upload?h=lt-1042&s=0    body=    0  LabSync/2.3
09:06:05  GET  /upload?h=lt-1042&s=0    body=    0  LabSync/2.3
09:08:07  GET  /upload?h=lt-1042&s=0    body=    0  LabSync/2.3
09:08:20  POST /upload?h=lt-1042&s=1    body= 1200  LabSync/2.3
09:10:05  GET  /upload?h=lt-1042&s=0    body=    0  LabSync/2.3
09:12:07  GET  /upload?h=lt-1042&s=0    body=    0  LabSync/2.3
GET interval mean 120.1s  cv 0.016
== 4. timeline (UTC)
09:01:58 sysmon  1  OUTLOOK.EXE: invoice_viewer.exe user opened the mail attachment
09:02:01 sysmon 11  invoice_viewer.exe: labsync.exe
09:02:02 sysmon 13  invoice_viewer.exe: LabSync C:\Users\mai\AppData\Roaming\LabSync\labsync.exe
09:02:04 sysmon  1  invoice_viewer.exe: cmd.exe cmd.exe /c systeminfo
09:02:06 proxy      GET /upload?h=lt-1042&s=0 (0 bytes)
09:04:04 proxy      GET /upload?h=lt-1042&s=0 (0 bytes)
09:06:05 proxy      GET /upload?h=lt-1042&s=0 (0 bytes)
09:06:30 sysmon 11  invoice_viewer.exe: q.zip
09:08:07 proxy      GET /upload?h=lt-1042&s=0 (0 bytes)
09:08:20 proxy      POST /upload?h=lt-1042&s=1 (1200 bytes)
09:10:05 proxy      GET /upload?h=lt-1042&s=0 (0 bytes)
09:12:07 proxy      GET /upload?h=lt-1042&s=0 (0 bytes)

Part 2: reading the results

Work through the output and write down your findings before reading on.

  1. Evidence integrity. The three SHA-256 values (first 16 hex digits shown) go into the chain-of-custody record before any analysis (chain of custody).
  2. File triage. file sees the MZ header. ASCII strings give only the DOS stub message, a marker LABSYNC-CFG and noise; the UTF-16 search finds a mutex name, Global\LabSync-91. Whole-file entropy 7.91 says most of the file is compressed or encrypted (entropy). No readable configuration: it must be encoded.
  3. Decoding. Right after the marker, single-byte XOR with key 0x37 yields a configuration terminated by a zero byte: server sync.files-cdn.lab.test, path /upload, user agent LabSync/2.3, interval 120 s (decoding).
  4. YARA. The rule matches the marker, the XOR-encoded domain fragment (found under key 0x37 without being told the key) and the wide mutex prefix, and matches none of 1,712 goodware files (YARA basics, testing). Remember the corpus limit: these are Linux files; test against Windows goodware before deployment.
  5. Network. The domain resolves to 203.0.113.80; six GETs with the decoded user agent at a mean interval of 120.1 s (cv 0.016: a timer, matching the configured interval), and one POST with a 1,200-byte body at 09:08:20 (network behaviour).
  6. Timeline. Mai opens the attachment from Outlook at 09:01:58; within six seconds the program copies itself to AppData\Roaming\LabSync\labsync.exe, sets a Run value pointing at the copy, and runs systeminfo; it beacons from 09:02:06; at 09:06:30 it writes q.zip in Temp; at 09:08:20 it POSTs data. The story: delivery by mail (T1566.001), user execution (T1204.002), persistence via the Run key (T1547.001), discovery (T1082), collection into an archive (T1560), web C2 (T1071.001) and exfiltration over it (T1041) (timelines, ATT&CK).

Part 3: indicators and containment

Type Indicator (defanged for this page) Pyramid level Use
SHA-256 ecd0d3f584176ef9… (full value from the session) hash EDR sweep, block
Domain sync[.]files-cdn[.]lab[.]test domain DNS/proxy block, retro-hunt
IP 203[.]0[.]113[.]80 IP firewall block with expiry
URL path + UA /upload?h=<host>&s= with LabSync/2.3 network artefact proxy search, Sigma/IDS rule
Mutex Global\LabSync-91 host artefact EDR query
File / Run value %APPDATA%\LabSync\labsync.exe, HKCU\…\Run\LabSync host artefact EDR query, eradication
Behaviour mail attachment → self-copy to AppData → Run value → 120 s HTTP beacon → zip in Temp → POST TTP Sigma rule, hunt

Containment advice (for the incident commander; detection and containment):

  1. Capture memory of lt-1042, then isolate it with EDR.
  2. Block the domain and IP at DNS and proxy; hunt all proxy and DNS logs back to the earliest date retained for the domain, the user agent and the URL pattern, and EDR for the hash, the mutex and the Run value. Every hit extends the scope.
  3. Treat Mai's credentials (and any tokens on the laptop) as compromised: reset and revoke.
  4. Find the mail in all mailboxes (same sender, subject or attachment hash) and remove it; block the sender.
  5. Assess the POST: 1,200 bytes left the network at 09:08:20 after q.zip was written. Which files went into it? (Recover q.zip from the laptop or its memory.) If personal data is involved, the data protection officer and legal counsel decide on notification; note the time of awareness (09:15 UTC) for the reporting clocks (ransomware playbook: reporting clocks).
  6. Eradicate by rebuilding the laptop; recover; lessons learned (eradication and recovery).

Part 4: the incident report

Use this template (from Communication and Incident Reports) and fill it from your findings. An example executive summary follows.

text
INCIDENT REPORT  INC-<id>   Version <n>   Classification: TLP:AMBER   Date: <UTC>
Author(s): <names>          Incident commander: <name>

1. Executive summary (5 sentences, for non-specialists)
2. Scope and method
   - Evidence: <items with IDs and SHA-256>   - Tools and versions: <...>   - Limitations: <...>
3. Timeline (UTC)
   | time | source | event | evidence ref |
4. Technical findings
   4.1 Delivery and execution   4.2 The file (triage, decoded configuration, YARA rule)
   4.3 Persistence              4.4 Network behaviour (beacon, exfiltration)
   4.5 ATT&CK mapping (version <x>)
5. Impact: systems, data (types, volume, personal data?), business, notifications made (to whom, when)
6. Response actions: containment, eradication, recovery (dates, owners)
7. Root cause and contributing factors
8. Lessons learned and actions (owner, due date)
Appendix A: indicators (machine-readable)   Appendix B: YARA / Sigma rules   Appendix C: evidence and custody log

Executive summary (example). On 19 January 2026 at 09:01 UTC an employee opened a malicious attachment disguised as an invoice viewer. The program installed itself to start automatically, collected system information and, at 09:08 UTC, sent about 1.2 KB of data to an external server; the content of that transfer is being determined. The mail gateway flagged the attachment at 09:15 UTC; the laptop was isolated and the server blocked within the hour, and no other device has contacted the server. The employee's credentials were reset, and the laptop is being rebuilt. To prevent a repeat, we will block executable attachments by file type at the mail gateway and stop programs from running out of user folders.

Extensions

  • Write a Sigma rule for the behaviour in the timeline (a process started by OUTLOOK.EXE from the Outlook attachment cache sets a Run value) and test it against the Sysmon CSV in Python (Sigma).
  • Express the indicators as a STIX 2.1 bundle with valid_until dates and TLP markings (STIX).
  • Add a fourth evidence source (DNS server log with ISO 8601 times) to the timeline.
  • Change the generator's jitter to ±40 s and the interval to 300 s; does your beacon check still flag it?

Test yourself

What should happen to the evidence files before any analysis?

  1. Rename them
  2. Hash them and record the values in the custody log
  3. Compress them
  4. Upload them to a public sandbox

Which observation suggests data left the network?

  1. The DNS answer
  2. The POST with a 1,200-byte body after q.zip was written
  3. The GET requests every 120 s
  4. The MZ header

Why did the YARA rule find the domain without being given the XOR key?

  1. The domain was in plain text
  2. The xor modifier tries every single-byte key in the range
  3. YARA decodes Base64 automatically
  4. The rule used the mutex instead

Which time starts the legal reporting clocks in this case?

  1. 09:01:58, when the attachment was opened
  2. 09:15, when the organisation became aware
  3. When the report is finished
  4. When the laptop is rebuilt