CTF Steganography
Do not write a new extractor. The project already ships the standard battery;
run it, read the output, then get specific.
Step 1: the preset (always first)
# Media presets: pick the one that matches the file (run these before the sweep if the file is a video, GIF, image with LSB, QR, or audio)
docker exec ctf-solver python3 /app/presets/frame_diff.py /app/workspaces/<chal>/<video-or-gif>
docker exec ctf-solver python3 /app/presets/lsb_extract.py /app/workspaces/<chal>/<image>
docker exec ctf-solver python3 /app/presets/qr_decode.py /app/workspaces/<chal>/<image>
docker exec ctf-solver python3 /app/presets/audio_spectrum.py /app/workspaces/<chal>/<audio>
docker exec ctf-solver python3 /app/presets/gif_frames.py /app/workspaces/<chal>/<gif> --x X --y Y --hi H --lo L
scripts/ctf.sh py scripts/stego/sweep.py ctf-solver/workspaces/<chal>/<file>
scripts/ctf.sh py scripts/stego/sweep.py <file> --fast # skip binwalk
scripts/ctf.sh py scripts/stego/sweep.py <jpg> --wordlist /usr/share/wordlists/rockyou.txt
scripts/ctf.sh run zsteg -a /app/workspaces/<chal>/<file> # raw tool output if needed
sweep.py reports, in order: identity (type, size, entropy), metadata
(exiftool/identify/pngcheck comments and profiles), embedded data (binwalk,
printable runs, appended bytes after PNG IEND / JPEG EOI / GIF trailer, saved
to *.appended), known-tool scanners (zsteg -a, zbarimg, steghide info,
stegseek), the filter sweep, derived images, media branches, and a final
flag-candidate list with the filter that produced each hit.
Filter library, usable alone: scripts/ctf.sh py scripts/stego/filters.py <file> --derived out/.
Step 2: what the filter sweep already covers
| Variant |
Why it exists |
| Channel × bit plane 0–7 × row/column × big/little bit order |
The zsteg -a matrix, in Python — catches plane 1–7 and MSB-first payloads that plane-0 LSB misses |
| RGB / BGR per-pixel interleave (planes 0–2) |
Classic 3-bit-per-pixel encoding |
R^G, G^B, R^B, ` |
R-G |
| Palette index plane 0 (GIF/P mode) |
Palette stego |
| Alpha plane (included in RGBA) |
Payload in transparency |
| Derived PNGs (planes + channel maps) |
Visual stego: text that only appears in one plane |
A hit needs either a flag regex or ≥92% printable bytes, so noise does not flood
the report. If nothing hits, the payload is not in the pixels — move on.
Step 3: structured checks the sweep does not replace
Use the stego MCP (128 tools) for: img_chi_square, img_lsb_detect
(statistical presence), img_known_tools, jpeg_structure, gif_*
(palette/LZW/appext), video_* (frame LSB, inter-frame, EOF data), audio_*
(LSB, spectrum), text_zwc_detect / text_invisible_scan / text_homoglyph,
file_appended / file_polyglot / file_identify, doc_pdf_streams, qr_*.
Step 4: by media type
- PNG/BMP: sweep → zsteg -a → check
tEXt/zTXt/iTXt chunks → palette/alpha. Recompress to BMP3 before steghide (convert in.png BMP3:out.bmp) — steghide rejects ImageMagick's default BMP.
- JPEG: steghide (needs a passphrase →
stegseek with a wordlist), outguess detection, DCT-coefficient tools, EXIF comments.
- Audio: spectrogram is generated by the sweep (
-x 2048 -y 1025 high-res too); look for text, SSTV, Morse (channel separation), DTMF. Deeper DSP: ../ctf-misc/audio.md.
- Video: frames extracted at 1 fps; check frame LSB and inter-frame differences; audio track separately.
- GIF: palette LSB, comment/application extensions, per-frame delays.
- PDF/DOCX:
doc_pdf_streams, hidden text layers, white-on-white text, ZIP members.
- Text: zero-width characters, Unicode tags (U+E0000–E007F, subtract 0xE0000), variation selectors, homoglyphs.
When to pivot
- The recovered data is encrypted or needs RSA/AES work →
/ctf-crypto
- The file is a firmware image or a logic capture →
/ctf-hardware
- The challenge is a disk/memory/PCAP artifact →
/ctf-forensics
- The media hides an encoder binary or VM →
/ctf-reverse
- Pure encoding layers (base64 chains, esolangs) →
/ctf-misc
Verify
scripts/ctf.sh run zsteg --version
scripts/ctf.sh py scripts/stego/sweep.py --help
Report the filter that produced a flag, not just the flag — a write-up needs the
reproduction step.
1---2name: ctf-stego3description: Front-loads steganography triage for CTF files. Use when an image, audio file, video, GIF, PDF or text file is described as containing something hidden, or when a challenge gives media with no obvious purpose, "stego", LSB, bit plane, palette, spectrogram, QR or metadata hints. Runs the project's preset sweep and filter library first instead of re-deriving extraction code, then routes to the stego MCP for structured checks. Do not use it for pure disk/memory/network forensics, for crypto on recovered data, or for reversing an encoder binary.4license: MIT5compatibility: Requires the ctf-solver container (`scripts/ctf.sh`) with /opt/venv/bin/python, PIL, numpy and the stego CLI tools.6allowed-tools: Bash Read Write Edit Glob Grep Task WebFetch WebSearch Skill7metadata:8 source: https://skillmd.com/skills/jiayaoqijia/ctf-stego9 user-invocable: "true"10 argument-hint: "[media file]"11---1213# CTF Steganography1415Do not write a new extractor. The project already ships the standard battery;16run it, read the output, then get specific.1718## Step 1: the preset (always first)1920```bash21# Media presets: pick the one that matches the file (run these before the sweep if the file is a video, GIF, image with LSB, QR, or audio)22docker exec ctf-solver python3 /app/presets/frame_diff.py /app/workspaces/<chal>/<video-or-gif>23docker exec ctf-solver python3 /app/presets/lsb_extract.py /app/workspaces/<chal>/<image>24docker exec ctf-solver python3 /app/presets/qr_decode.py /app/workspaces/<chal>/<image>25docker exec ctf-solver python3 /app/presets/audio_spectrum.py /app/workspaces/<chal>/<audio>26docker exec ctf-solver python3 /app/presets/gif_frames.py /app/workspaces/<chal>/<gif> --x X --y Y --hi H --lo L27scripts/ctf.sh py scripts/stego/sweep.py ctf-solver/workspaces/<chal>/<file>28scripts/ctf.sh py scripts/stego/sweep.py <file> --fast # skip binwalk29scripts/ctf.sh py scripts/stego/sweep.py <jpg> --wordlist /usr/share/wordlists/rockyou.txt30scripts/ctf.sh run zsteg -a /app/workspaces/<chal>/<file> # raw tool output if needed31```3233`sweep.py` reports, in order: identity (type, size, entropy), metadata34(exiftool/identify/pngcheck comments and profiles), embedded data (binwalk,35printable runs, **appended bytes after PNG IEND / JPEG EOI / GIF trailer**, saved36to `*.appended`), known-tool scanners (zsteg -a, zbarimg, steghide info,37stegseek), the **filter sweep**, derived images, media branches, and a final38flag-candidate list with the filter that produced each hit.3940Filter library, usable alone: `scripts/ctf.sh py scripts/stego/filters.py <file> --derived out/`.4142## Step 2: what the filter sweep already covers4344| Variant | Why it exists |45|---|---|46| Channel × bit plane 0–7 × row/column × big/little bit order | The `zsteg -a` matrix, in Python — catches plane 1–7 and MSB-first payloads that plane-0 LSB misses |47| RGB / BGR per-pixel interleave (planes 0–2) | Classic 3-bit-per-pixel encoding |48| `R^G`, `G^B`, `R^B`, `|R-G|`, `|G-B|` planes 0–3 | XOR/difference stego, where no single channel is readable |49| Palette index plane 0 (GIF/P mode) | Palette stego |50| Alpha plane (included in RGBA) | Payload in transparency |51| Derived PNGs (planes + channel maps) | Visual stego: text that only appears in one plane |5253A hit needs either a flag regex or ≥92% printable bytes, so noise does not flood54the report. If nothing hits, the payload is not in the pixels — move on.5556## Step 3: structured checks the sweep does not replace5758Use the **`stego` MCP** (128 tools) for: `img_chi_square`, `img_lsb_detect`59(statistical presence), `img_known_tools`, `jpeg_structure`, `gif_*`60(palette/LZW/appext), `video_*` (frame LSB, inter-frame, EOF data), `audio_*`61(LSB, spectrum), `text_zwc_detect` / `text_invisible_scan` / `text_homoglyph`,62`file_appended` / `file_polyglot` / `file_identify`, `doc_pdf_streams`, `qr_*`.6364## Step 4: by media type6566- **PNG/BMP**: sweep → zsteg -a → check `tEXt`/`zTXt`/`iTXt` chunks → palette/alpha. Recompress to BMP3 before steghide (`convert in.png BMP3:out.bmp`) — steghide rejects ImageMagick's default BMP.67- **JPEG**: steghide (needs a passphrase → `stegseek` with a wordlist), outguess detection, DCT-coefficient tools, EXIF comments.68- **Audio**: spectrogram is generated by the sweep (`-x 2048 -y 1025` high-res too); look for text, SSTV, Morse (channel separation), DTMF. Deeper DSP: [../ctf-misc/audio.md](../ctf-misc/audio.md).69- **Video**: frames extracted at 1 fps; check frame LSB and inter-frame differences; audio track separately.70- **GIF**: palette LSB, comment/application extensions, per-frame delays.71- **PDF/DOCX**: `doc_pdf_streams`, hidden text layers, white-on-white text, ZIP members.72- **Text**: zero-width characters, Unicode tags (U+E0000–E007F, subtract 0xE0000), variation selectors, homoglyphs.7374## When to pivot7576- The recovered data is encrypted or needs RSA/AES work → `/ctf-crypto`77- The file is a firmware image or a logic capture → `/ctf-hardware`78- The challenge is a disk/memory/PCAP artifact → `/ctf-forensics`79- The media hides an encoder binary or VM → `/ctf-reverse`80- Pure encoding layers (base64 chains, esolangs) → `/ctf-misc`8182## Verify8384```bash85scripts/ctf.sh run zsteg --version86scripts/ctf.sh py scripts/stego/sweep.py --help87```8889Report the filter that produced a flag, not just the flag — a write-up needs the90reproduction step.