Перейти к основному содержимому
File Signatures, Metadata (EXIF) & Steganography Triage
Урок 5 из 12

File Signatures, Metadata (EXIF) & Steganography Triage

Identify disguised files using magic bytes, extract investigative clues from EXIF metadata, carve appended archives with binwalk, and triage images for hidden steganographic payloads.

Средний 28 мин Форензика и IR
Этого урока пока нет на выбранном языке — показана версия на другом языке. Перевод готовится.

Цели обучения

  • Identify true file formats from raw magic bytes regardless of file extension
  • Extract and interpret EXIF, XMP, and comment metadata using ExifTool
  • Detect and extract embedded or appended files using binwalk
  • Select the appropriate steganography triage tool (zsteg or steghide) based on image format

Рекомендуется заранее: Disk & Deleted-File Forensics with Autopsy & Sleuth Kit

#Why this matters

When recovering files from disk images or triage captures, filenames cannot be trusted. An insider or challenge author can rename a ZIP archive to avatar.jpg, leave sensitive coordinates inside EXIF metadata, or append a secret file past a PNG's end marker. Triage from the outer container inward saves hours by checking signatures, metadata, and appended archives before touching pixel-level steganography.

#Magic bytes and file signatures

Extensions such as .png, .docx, or .txt are only OS naming hints. Parsers inspect magic bytes at fixed offsets (usually byte 0) and footer markers at the end.

Format Header magic bytes (hex) ASCII / pattern Footer / end marker
PNG 89 50 4E 47 0D 0A 1A 0A .PNG.... IEND (49 45 4E 44 AE 42 60 82)
JPEG FF D8 FF SOI + marker (E0/E1) FF D9 (EOI)
ZIP / DOCX 50 4B 03 04 PK.. End of central directory (50 4B 05 06)
PDF 25 50 44 46 2D %PDF- %%EOF
ELF binary 7F 45 4C 46 .ELF Section headers

Run file to match magic bytes against a signature database, and xxd to view raw hex and ASCII side by side.

#Reading EXIF and embedded metadata

Cameras, phones, and editors embed EXIF, IPTC, and XMP tags inside media files. ExifTool reads these tags safely without executing scripts:

  • Timeline: DateTimeOriginal, CreateDate, ModifyDate.
  • Origin: Make, Model, Software (such as GIMP), Artist.
  • Location: GPSLatitude, GPSLongitude, GPSAltitude.
  • Custom notes: Comment, UserComment, ImageDescription.
Triaging an image header, metadata, and embedded payloads
$ file photo.jpg
photo.jpg: PNG image data, 800 x 600, 8-bit/color RGBA, non-interlaced
$ xxd -l 16 photo.jpg
00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452  .PNG........IHDR
$ exiftool photo.jpg | grep -E "File Type|Software|Comment"
File Type                       : PNG
Software                        : LabExporter 2.1
Comment                         : case=lab-04; pass=northgate
$ binwalk photo.jpg

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             PNG image, 800 x 600, 8-bit/color RGBA, non-interlaced
41            0x29            Zlib compressed data, default compression
18422         0x47F6          Zip archive data, at least v2.0 to extract, name: notes.txt

Here photo.jpg actually uses PNG magic bytes (89 50 4E 47), stores a clue in Comment, and hides a ZIP archive at offset 18422 past IEND.

#Carving appended data with binwalk

Viewers stop parsing at the end-of-file marker (FF D9 for JPEG, IEND for PNG) and ignore trailing bytes. Running binwalk -e suspect.png extracts recognized streams into _suspect.png.extracted. Check exiftool and strings first in case an extracted archive requires a passphrase.

#Steganography triage: LSB and DCT

Check pixel or frequency steganography only after inspecting magic bytes, metadata, and appended archives:

  1. file & xxdConfirm true format vs extension
  2. exiftool & stringsExtract metadata and readable hints
  3. binwalkDetect and carve appended archives
  4. zsteg (PNG/BMP)Probe LSB pixel bit-planes
  5. steghide (JPEG/WAV)Check DCT / passphrase embedding

Match the tool to the container format:

  • Lossless (PNG, BMP): Exact pixel bits allow Least Significant Bit (LSB) embedding across RGB/Alpha channels. zsteg -a image.png tests common channel orders and bit depths automatically.
  • Lossy (JPEG): Quantized Discrete Cosine Transform (DCT) compression destroys spatial LSB bits, so tools such as steghide modify DCT coefficients instead. Run steghide info image.jpg to check for embedded data and steghide extract -sf image.jpg with a passphrase.

#Defending and common mistakes

  • Strip metadata on public uploads: Remove EXIF GPS and device tags from user uploads before publishing.
  • Validate magic bytes: Inspect file signatures server-side (and re-encode untrusted images in a sandbox) instead of trusting filenames.
  • Wrong tool for the format: Running steghide on a PNG fails because steghide supports JPEG, BMP, WAV, and AU, not PNG.
  • Misreading Zlib streams: A Zlib stream inside PNG IDAT chunks is normal image compression, not an appended archive; look for distinct headers past IEND.

#Summary

  • Verify real file types with magic bytes (file, xxd) rather than trusting extensions.
  • Run exiftool early for timestamps, GPS, software tags, and comment clues.
  • Carve appended archives past EOF markers (IEND, FF D9) with binwalk -e.
  • Match steganography tools to format: zsteg for PNG/BMP LSBs, and steghide for JPEG DCT payloads.

Проверка знаний

Войдите, чтобы проходить тест, завершать уроки и сохранять прогресс. Войти в систему

Практика: проверьте свои знания