CTF forensics and stego
When it applies
The handout is an artifact to investigate: a packet capture, memory dump, disk image, or an
innocent-looking media file. This skill is the CTF quick-win battery — the 80% of challenges that
fall to standard tooling run in the right order. For real-IR depth (timelines, root cause,
attacker methodology) defer to defense-dfir-triage, defense-malware-triage,
defense-log-analysis; here the only objective is finding the flag in the haystack.
Why it works
CTF forensics artifacts are constructed, not organic: the flag was placed by an author using a
standard technique (appended data, an HTTP download, a deleted file, an LSB embedding), and each
technique has a canonical tool. Running the standard battery in order surfaces the planted
artifact faster than clever hypotheses, because the author used the same tools you have.
Method
- Universal first pass (every file, 2 minutes).
file <f>; exiftool <f>; strings -n 8 <f> | grep -iE 'flag|pass|key|{' ; binwalk <f>
file lying about the type (wrong extension/magic) is itself a classic stage one. Metadata
(exiftool) hides flags in comment/author/GPS fields. binwalk -eM extracts embedded archives
recursively — appended zip-after-image is the most common stage one of all.
- pcap (.pcap/.pcapng).
- Open in Wireshark; check Protocol Hierarchy and Conversations first — the odd protocol
or the one giant stream is the lead.
- Export objects: File → Export Objects → HTTP/SMB/TFTP — downloaded files (exfil zips,
images) come out whole.
- Follow TCP streams; flag-in-cleartext-chat is common.
tshark -r cap.pcap -Y 'http' -T fields -e http.request.uri for quick scripting.
- Exfil channels: DNS (long encoded subdomains — decode base32/64/hex of the labels), ICMP
payload bytes, TLS where a
keys.log/RSA key is provided (set the key log in preferences).
- USB pcaps:
usb.capdata keystroke/mouse reconstruction (map HID codes back to characters).
- Memory dumps (.mem/.raw/.vmem) — Volatility 3, the five that solve most:
vol -f dump.mem windows.info # profile/OS
vol -f dump.mem windows.pslist # the odd process (notepad, mspaint, truecrypt)
vol -f dump.mem windows.cmdline # commands with passwords/flags as args
vol -f dump.mem windows.filescan | grep -iE 'flag|secret|\.zip|\.png'
vol -f dump.mem windows.dumpfiles --physaddr <addr> # carve the file out
Then per the story: hashdump (crack the SAM), malfind, clipboard/notepad plugins, browser
history plugins. And the cheap shot first: strings dump.mem | grep flag{.
- Disk images (.dd/.img/.E01). Mount or autopsy-free carve:
fls -r <img> / icat (Sleuth Kit) — list and read files; deleted files (fls -rd)
are where flags hide; recover by inode with icat.
foremost -i <img> -o out/ or photorec — carve by signature when the filesystem is
damaged or the challenge is raw.
bulk_extractor <img> — one-shot sweep of URLs, emails, credit cards, keys; grep its output.
- Check slack/unallocated space and alternate partitions (
mmls shows the layout; a hidden
second partition is a classic).
- Stego battery (images/audio) — run all, not one.
- PNG:
zsteg -a img.png (LSB and friends, automatic); pngcheck -v for odd chunks.
- JPEG:
steghide extract -sf img.jpg (try empty passphrase first, then challenge title /
description words); stegseek for fast passphrase cracks; outguess; check DCT with
stegoveritas which runs the whole battery at once.
- Any image: inspect the planes visually (StegSolve-style: bit-plane views reveal QR codes and
text), compare against an original if the challenge gives one (diff = the payload).
- Audio: open in Audacity — spectrogram view shows drawn text/QR; morse in the waveform;
reversed audio; DTMF tones (decode with a dial-tone decoder).
- Whitespace/zero-width text in provided .txt files;
snow for whitespace stego.
- Chain the stages. CTF forensics is layered: binwalk gives a password-protected zip → the
password is in pcap stream 7 → the zip has a QR image → zsteg on the QR. When a stage yields a
password/key, apply it to every locked artifact you already hold.
Gotchas
- Wrong file magic is stage one, not a broken download — fix the header (
file says data but
binwalk sees a zip at offset 0x100 → carve from there).
binwalk -e without -M misses nested archives — always recurse; also watch for
false-positive signatures at huge offsets.
- Volatility profile mismatches fail silently — if
pslist looks empty/garbage, the image is
a different OS build or it's a Linux dump (needs a custom profile / linux.* plugins).
- Steghide passphrases come from the challenge text — title, description, lyrics of the
linked song. Try them before brute-forcing.
- Encrypted volumes (VeraCrypt) in disk images — the password is elsewhere in the challenge
(memory dump, deleted note); don't brute a VeraCrypt container, hunt the hint.
- Corrupted-by-author files (QR with wrong alignment patterns, PNG with bad CRC) — repair
tools (
pcrt, online QR fixers) beat redrawing by hand.
Verify success
A flag in the event format extracted from the artifact, with a reproducible extraction path (the
exact tool chain and parameters) written down — other players' flags differ, so "found a string"
must survive re-running the battery from the original handout file.
References
Volatility 3 docs; Sleuth Kit (fls/icat/mmls); Wireshark object export; stegoveritas,
zsteg, stegseek. IR-grade methodology: defense-dfir-triage, defense-malware-triage.
Triage via ctf-methodology.
1---2name: ctf-forensics3description: >4 CTF forensics playbook — quick wins on pcaps, memory dumps, disk images, and stego files:5 binwalk carving, Wireshark object export, Volatility's five commands that solve most memory6 challenges, steghide/zsteg/exiftool stego battery. Load when the handout is a capture, image, or7 dump file. Signals: "forensics"/"stego" category, .pcap/.pcapng, .mem/.raw/.vmem, .dd/.img/.E01,8 a lone .png/.jpg/.wav, "incident", "suspicious traffic".9domain: ctf10type: technique11stability: learning12modes: [pentest, defense]13severity: medium14cwe: []15tools: [wireshark, tshark, binwalk, foremost, volatility3, exiftool, steghide, zsteg, strings, bulk_extractor]16schema_version: 117metadata:18 source: https://skillmd.com/skills/noorqureshi/ctf-forensics19---2021# CTF forensics and stego2223## When it applies24The handout is an artifact to investigate: a packet capture, memory dump, disk image, or an25innocent-looking media file. This skill is the CTF quick-win battery — the 80% of challenges that26fall to standard tooling run in the right order. For real-IR depth (timelines, root cause,27attacker methodology) defer to `defense-dfir-triage`, `defense-malware-triage`,28`defense-log-analysis`; here the only objective is finding the flag in the haystack.2930## Why it works31CTF forensics artifacts are constructed, not organic: the flag was placed by an author using a32standard technique (appended data, an HTTP download, a deleted file, an LSB embedding), and each33technique has a canonical tool. Running the *standard battery in order* surfaces the planted34artifact faster than clever hypotheses, because the author used the same tools you have.3536## Method371. **Universal first pass (every file, 2 minutes).**38 ```39 file <f>; exiftool <f>; strings -n 8 <f> | grep -iE 'flag|pass|key|{' ; binwalk <f>40 ```41 `file` lying about the type (wrong extension/magic) is itself a classic stage one. Metadata42 (exiftool) hides flags in comment/author/GPS fields. `binwalk -eM` extracts embedded archives43 recursively — appended zip-after-image is the most common stage one of all.442. **pcap (.pcap/.pcapng).**45 - Open in Wireshark; check *Protocol Hierarchy* and *Conversations* first — the odd protocol46 or the one giant stream is the lead.47 - Export objects: *File → Export Objects → HTTP/SMB/TFTP* — downloaded files (exfil zips,48 images) come out whole.49 - Follow TCP streams; flag-in-cleartext-chat is common. `tshark -r cap.pcap -Y 'http' -T fields50 -e http.request.uri` for quick scripting.51 - Exfil channels: DNS (long encoded subdomains — decode base32/64/hex of the labels), ICMP52 payload bytes, TLS where a `keys.log`/RSA key is provided (set the key log in preferences).53 - USB pcaps: `usb.capdata` keystroke/mouse reconstruction (map HID codes back to characters).543. **Memory dumps (.mem/.raw/.vmem) — Volatility 3, the five that solve most:**55 ```56 vol -f dump.mem windows.info # profile/OS57 vol -f dump.mem windows.pslist # the odd process (notepad, mspaint, truecrypt)58 vol -f dump.mem windows.cmdline # commands with passwords/flags as args59 vol -f dump.mem windows.filescan | grep -iE 'flag|secret|\.zip|\.png'60 vol -f dump.mem windows.dumpfiles --physaddr <addr> # carve the file out61 ```62 Then per the story: `hashdump` (crack the SAM), `malfind`, clipboard/notepad plugins, browser63 history plugins. And the cheap shot first: `strings dump.mem | grep flag{`.644. **Disk images (.dd/.img/.E01).** Mount or autopsy-free carve:65 - `fls -r <img>` / `icat` (Sleuth Kit) — list and read files; **deleted files** (`fls -rd`)66 are where flags hide; recover by inode with `icat`.67 - `foremost -i <img> -o out/` or `photorec` — carve by signature when the filesystem is68 damaged or the challenge is raw.69 - `bulk_extractor <img>` — one-shot sweep of URLs, emails, credit cards, keys; grep its output.70 - Check slack/unallocated space and alternate partitions (`mmls` shows the layout; a hidden71 second partition is a classic).725. **Stego battery (images/audio) — run all, not one.**73 - PNG: `zsteg -a img.png` (LSB and friends, automatic); `pngcheck -v` for odd chunks.74 - JPEG: `steghide extract -sf img.jpg` (try empty passphrase first, then challenge title /75 description words); `stegseek` for fast passphrase cracks; `outguess`; check DCT with76 `stegoveritas` which runs the whole battery at once.77 - Any image: inspect the planes visually (StegSolve-style: bit-plane views reveal QR codes and78 text), compare against an original if the challenge gives one (diff = the payload).79 - Audio: open in Audacity — spectrogram view shows drawn text/QR; morse in the waveform;80 reversed audio; DTMF tones (decode with a dial-tone decoder).81 - Whitespace/zero-width text in provided .txt files; `snow` for whitespace stego.826. **Chain the stages.** CTF forensics is layered: binwalk gives a password-protected zip → the83 password is in pcap stream 7 → the zip has a QR image → zsteg on the QR. When a stage yields a84 password/key, apply it to every locked artifact you already hold.8586## Gotchas87- **Wrong file magic is stage one, not a broken download** — fix the header (`file` says data but88 binwalk sees a zip at offset 0x100 → carve from there).89- **`binwalk -e` without `-M`** misses nested archives — always recurse; also watch for90 false-positive signatures at huge offsets.91- **Volatility profile mismatches fail silently** — if `pslist` looks empty/garbage, the image is92 a different OS build or it's a Linux dump (needs a custom profile / `linux.*` plugins).93- **Steghide passphrases come from the challenge text** — title, description, lyrics of the94 linked song. Try them before brute-forcing.95- **Encrypted volumes (VeraCrypt) in disk images** — the password is elsewhere in the challenge96 (memory dump, deleted note); don't brute a VeraCrypt container, hunt the hint.97- **Corrupted-by-author files** (QR with wrong alignment patterns, PNG with bad CRC) — repair98 tools (`pcrt`, online QR fixers) beat redrawing by hand.99100## Verify success101A flag in the event format extracted from the artifact, with a reproducible extraction path (the102exact tool chain and parameters) written down — other players' flags differ, so "found a string"103must survive re-running the battery from the original handout file.104105## References106Volatility 3 docs; Sleuth Kit (`fls`/`icat`/`mmls`); Wireshark object export; stegoveritas,107zsteg, stegseek. IR-grade methodology: `defense-dfir-triage`, `defense-malware-triage`.108Triage via `ctf-methodology`.