Skip to content
~/ahmedeaygoren.dev
← Back to Projects
2026-10-26

Stegsolve

Asynchronous CTF triage and steganography automation workbench (Python, FastAPI, OpenCV, Tesseract OCR)—battle-tested at TEKNOFEST HackMasters to solve 4–5 challenges in one click.

PythonFastAPIOpenCVNumPyTesseract OCRDocker

Overview & Motivation

Under live competition pressure, traditional steganography triage forces analysts to chain legacy Java Stegsolve GUIs with disconnected CLI passes (zsteg, binwalk, exiftool, steghide). That manual loop breaks down quickly when flags are hidden inside pixel-stepped LSB intervals (step=2..4), concealed behind truncated JPEG/PNG dimensions, or buried in localized entropy anomalies.

Stegsolve eliminates that bottleneck by uniting automated multi-vector detection, live Server-Sent Events (SSE) progress streaming, an interactive browser lab, and reproducible reporting into a single asynchronous Python engine.

Competition Impact — TEKNOFEST HackMasters

During TEKNOFEST HackMasters, Stegsolve automated the full forensic triage pass across complex image and audio artifacts—solving 4–5 challenges in one click / a single automated run and directly saving critical competition time as team 1481 Legacy (Gebze Technical University) secured 3rd Place in Turkey.

Automated Triage Pipeline

INPUT Input Artifact PNG · JPEG · WAV ORCHESTRATION FastAPI + Async Worker Non-root · 15s Timeout Header & Entropy SOF0/OCR · IHDR CRC32 · 16x16 Heatmap Bit & Signal Stepped LSB 1..4 · 33-Plane QR · DTMF Decoders & Wrappers Base64/Hex/ROT13 · zsteg · binwalk DELIVERABLES SSE Live Stream + Web Lab Auto-Writeup HTML · MD · JSON

Core Capabilities

Module Technique & Automated Detection
analyzers/jpeg.py Detects JPEG SOF0 (0xFFC0) height tampering via djpeg -v DCT anomalies, runs binary search over 8-pixel MCU boundaries, and executes Tesseract OCR + Otsu binarization on recovered strips.
analyzers/png.py Brute-forces PNG IHDR CRC32 dimension mismatches in milliseconds and carves trailing archives or payloads appended after IEND.
analyzers/lsb.py & wav_lsb.py Extracts pixel-stepped LSB channels (step=1..4) skipped by standard tools, parses length-prefixed buffers, and inspects WAV audio LSB planes.
analyzers/heatmap.py Computes spatial Shannon entropy across 16x16 pixel blocks and generates an OpenCV JET colormap overlay pinpointing injected data regions.
analyzers/visual.py & audio.py Scans all 33 bit planes with OpenCV QRCodeDetector and extracts FFmpeg frequency spectrograms alongside DTMF audio tone decoding.
analyzers/decoder.py & external.py Runs an automatic de-obfuscation pipeline (Base64, Base32, Hex, ROT13, Binary, Reverse) and wraps zsteg, steghide, binwalk, and exiftool.
lab/extractor.py & combiner.py Powers an interactive browser lab with a 15x 0–7 bit-plane viewer, Custom Data Extractor (channel, order, MSB/LSB, step, offset, .bin export), and bitwise Image Combiner (XOR, DIFF, SUB, ADD, AND, OR).
report/builder.py & writeup.py Generates report_summary.json, a standalone offline HTML dashboard, and an auto-formatted Markdown CTF write-up documenting findings and reproduction steps.

Hardened Runtime & Usage

Built on Python 3.11, FastAPI/Uvicorn, OpenCV, NumPy, and Pillow, the backend executes analysis jobs in an asyncio worker with buffered Server-Sent Events (SSE) replay. The container runs as an unprivileged appuser (uid=1000) with strict 15-second subprocess timeouts and includes a pytest regression suite covering JPEG SOF0 recovery, stepped LSB extraction, overlay carving, QR scanning, and FastAPI endpoints.

# Build and launch the FastAPI web workbench on port 8000
docker compose up -d --build

# Run the automated pytest regression suite inside the container
docker exec stegsolve-web pytest -v tests/