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.
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 / Dimension | OverlayCheck (Client-Side) | Binwalk (Linux CLI) | Foremost / Scalpel |
|---|---|---|---|
| Zero Installation (Browser-Native) | 100% In-Browser (Mac, Windows, Linux, iOS) | Requires Linux or WSL installation | Requires Linux command-line tools |
| Visual Hex Inspection with Carve Boundary | Interactive split-view hex inspector | Terminal text output only | Batch 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:
binwalk -e suspect.jpgFrequently 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.