MISSION WRITEUP ID: cylab-corrupted-filePublished: 2026-08-18 by AUKA
Corrupted File: Restoring JPEG Magic Bytes
Inspecting broken file headers with xxd and restoring corrupt JPEG magic bytes (FF D8 FF E0) to render the flag image.
Target Mission Dossier
ForensicsEasy
Target Host / IP
Offline Challenge File
Operating System
Linux / Windows
Architecture
N/A
Primary Vulnerability
Corrupted File Header
Exposed Services:Binary Carving & Header Repair
Attack Kill Chain Progress1 / 3 Steps
01
Phase 1: Hexdump Inspection & Signature Analysis
We are given a file named `file` which fails to open in image viewers. Inspecting the first few bytes with `xxd` reveals that the header magic bytes have been modified or zeroed out:
studio@pwnbox:~/cylab-corrupted-file$
02
Phase 2: Repairing the JPEG Header with Python
A standard JPEG image begins with the 4-byte signature `FF D8 FF E0` (or `FF D8 FF E1` for Exif). We replace the corrupt first 4 bytes with `ÿØÿà` to restore header integrity.
studio@pwnbox:~/cylab-corrupted-file$
03
Phase 3: Viewing Restored Image & Flag Capture
Opening `fixed_img.jpg` displays the valid image containing the flag text.
studio@pwnbox:~/cylab-corrupted-file$
studio@pwnbox:~/cylab-corrupted-file$
Final Target Proof of Compromise
Target Root Capture Flag
STUDIO{pwn3d_fl4g_h1dd3n_h3x_00000}