Code
Messages hidden in plain sight, in words, invisible characters, pixels, sound, printed dots, stacked transparencies, DNA and the bytes of files, and the analyses that find them.
File Forensics
Reads a file’s bytes rather than its name: the type from its signature; the structure of PNG, JPEG, GIF, ZIP, PDF, RIFF and ELF files and ID3 tags, a PDF’s earlier versions; Exif metadata with any GPS position, comments and text chunks; data after the format’s end; files embedded at any offset, ZIP entries unpacked; printable strings; and entropy along the file. The file never leaves the browser.
Terms
History, how it works, how it was checked, limits
History
Most file formats announce themselves in their first bytes, and Gary Kessler’s File Signatures Table gathers such marks. Many also define their end — PNG’s IEND chunk, JPEG’s end-of-image marker, a ZIP’s end record (PKWARE’s APPNOTE 6.3.10), a PDF’s %%EOF (ISO 32000-1) — and Exif 2.32 (CIPA DC-008-2019) carries camera, owner and GPS fields in images.
How it works
The file is read in the browser, never uploaded. Its type comes from its leading bytes, matched against 43 signatures of 40 kinds, and is checked against its name’s extension. Readers walk PNG (CRCs checked, unknown chunks flagged), JPEG, GIF, ZIP, PDF (JavaScript, actions, embedded files, each save’s Info), RIFF, BMP, ELF’s headers and sections and an MP3’s ID3v2 tag; Exif gives GPS, owner and thumbnail. A Word document or a PDF is read for text a reader does not see: hidden, white, tiny, off the page, deleted or in comments. The file is drawn as one bar its length: its format’s parts, what follows its end in gold, files inside marked, and each block’s entropy under it; a part or a block opens its bytes. Strings lists runs of ASCII and UTF-16LE.
How it was checked
The fixtures’ images, ZIP and sound are written by Pillow and Python’s zipfile and wave, the three-save PDF by ReportLab and pypdf; In a PNG, a ZIP after IEND is found and unpacked, three kinds of text chunk are read and a private chunk is flagged. Unveil’s own Word and PDF fixtures give each hidden piece, and pdftotext reads the PDF’s alike. A PDF saved three times is cut into its versions, each with its own title and date, and a %%EOF inside a stream is not taken for a save. FFmpeg’s ID3 tag reads as ffprobe reads it. None of 300 truncated or corrupted copies makes the report fail.
The tests hold 82 checks of this tool; 4 rest on outside material:
- A standard’s own vectors CRC-32 check value (ISO 3309: "123456789" → CBF43926)
- A standard’s own vectors A Word document’s text a reader does not see, by ISO/IEC 29500-1: a run hidden by vanish, white text, text of one point, a deletion kept as a tracked change with its author, a comment with its author, and a hidden run in a header
- Another’s computation FFmpeg’s ffprobe on an MP3 it tagged: the same title, artist, album, year, encoder, and the two user-defined texts, one of them in UTF-16 with a byte order mark
- A print’s own example A PDF’s text a reader does not see, by ISO 32000-1: text in rendering mode 3 (Table 106), white text, text half a point high, text begun outside the MediaBox, and on a page kept in an object stream invisible text read through its font’s ToUnicode map
Limits
Only the first 64 MB are inspected, and inflation stops at 32 MB. Hidden text by a Word style, or in a PDF’s forms and annotations, is not found. Encrypted ZIP entries, and any packed by a method other than stored or deflate, stay shut. A PDF’s features and saves are read from its raw text, missing keys inside compressed object streams; the hidden-text search does inflate FlateDecode streams. A signature inside a file says where another may begin, not that it is whole, and high entropy says compressed or encrypted, not which.
- Gary C. Kessler, File Signatures Table
- CIPA DC-008-2019, Exchangeable image file format for digital still cameras: Exif Version 2.32
- W3C, Portable Network Graphics (PNG) Specification (Third Edition)
- PKWARE, APPNOTE.TXT — .ZIP File Format Specification 6.3.10
- System V Application Binary Interface, gABI 4+, chapters 4 and 5: the ELF header, sections and program headers
- M. Nilsson, ID3 tag version 2.3.0 (1999) and ID3 tag version 2.4.0, Main Structure and Native Frames (2000)