Binary File CarvingRutvij Khatri•9 min read•Published 2026-10-14

ZIP in a JPEG: How Appended Data Carving Uncovers Hidden Archives and CTF Flags

Learn how threat actors and CTF creators concatenate ZIP archives onto the end of JPEG files (after the FFD9 EOI marker), and how to carve them out.

Executive Verdict & Direct Answer
✓ 100% Client-Side In-Browser Engine

Learn how threat actors and CTF creators concatenate ZIP archives onto the end of JPEG files (after the FFD9 EOI marker), and how to carve them out. Image parsers terminate rendering at the JPEG EOI marker (FF D9). Any data appended after FF D9 is ignored by viewers but easily carved by binary scanners.

The Mechanics of File Concatenation and EOF Markers

In computer file systems, different file formats define distinct end-of-file (EOF) boundaries. A JPEG file always begins with the Start of Image (SOI) magic bytes `FF D8` and terminates with the End of Image (EOI) marker `FF D9`.

Standard image viewers and web browsers parse JPEG bytes sequentially from `FF D8`. Once the parser encounters the `FF D9` marker, it stops reading and renders the image on screen. Any bytes appended past `FF D9` are completely ignored by the image rendering engine.

Threat actors and CTF steganographers exploit this architectural behavior using simple binary concatenation (e.g. `cat photo.jpg secret.zip > combined.jpg`). The resulting file renders as a completely normal photo, yet contains an uncorrupted, extractable ZIP archive appended to its tail.

Key Investigative Takeaway

Image parsers terminate rendering at the JPEG EOI marker (FF D9). Any data appended after FF D9 is ignored by viewers but easily carved by binary scanners.

Locating the Appended ZIP Container (PK Magic Bytes)

A standard ZIP archive begins with the magic bytes `50 4B 03 04` (ASCII "PK") representing the local file header. It terminates with the End of Central Directory (EOCD) record starting with `50 4B 05 06`.

When auditing an image for appended archives, examiners inspect the byte stream immediately following `FF D9`. If `50 4B 03 04` is detected, the investigator can calculate the byte offset and slice the file into two valid standalone files: the pristine JPEG photo and the uncompressed ZIP archive.

Automated Carving with OverlayCheck

OverlayCheck’s Binary File Carver scans uploaded files for structural markers. If trailing bytes exist past the official image EOI marker, the tool flags the anomaly, displays the byte offset, identifies embedded file signatures (ZIP, RAR, 7z, PDF, PNG), and provides a one-click download for each carved artifact.

File Carving Suites: OverlayCheck vs. Linux CLI Tools

Evaluating ease of use, cross-platform availability, and signature parsing.

Feature / DimensionOverlayCheck (Client-Side)Binwalk (Linux CLI)Foremost / Scalpel
Zero Installation (Browser-Native)
100% In-Browser (Mac, Windows, Linux, iOS)
Requires Linux or WSL installationRequires Linux command-line tools
Visual Hex Inspection with Carve Boundary
Interactive split-view hex inspector
Terminal text output onlyBatch folder output only

Command-Line Automation & CLI Workflows

For security engineers and forensic examiners automating pipelines or conducting terminal audits, the equivalent low-level commands can be executed natively:

Detect and Extract Appended ZIP using Binwalk
bash
binwalk -e suspect.jpg
Technical Breakdown: Scans the image for internal file signatures and automatically extracts any embedded ZIP or archive containers into a carved folder.

Frequently Asked Technical Questions

Q1:Can Windows open an appended JPEG-ZIP file as an archive?

Yes! Simply renaming suspect.jpg to suspect.zip allows Windows Explorer, WinRAR, or 7-Zip to open and extract the appended ZIP archive, because archive tools read the central directory from the end of the file.

#zip in a jpeg#append data to image#carve zip from jpg#cat image zip#binwalk file carving online
RK
Rutvij KhatriSecurity Analyst & Aspiring Security Engineer

Security Analyst and Aspiring Security Engineer passionate about client-side media verification, binary parsing, web application security auditing, CTF steganography challenges, and zero-knowledge privacy architecture.

Connect on LinkedIn

Companion Verification & Privacy Toolkits

Cross-Cluster Workflows

Related Deep Dives in Binary File Carving