Skip to content
Buy me a coffee

Confirming a file type

tag: file-typestag: triage
  1. Don’t double-click. Work on a copy, inside your lab.
  2. Get its hash and look it up. Someone may already know what it is.
  3. Ask the file command (macOS, Linux, REMnux): file FILE. It reads the magic number and more.
  4. Look at the first bytes yourself: xxd FILE | head (see Reading hex).
  5. Ask Detect It Easy for the details: compiler, packer, installer type.
  6. Compare with the name. A mismatch between the extension and the real type is a finding in itself.
Tool What it tells you Where
file File type from its signature and structure Built into macOS and Linux
Detect It Easy (DiE) Type, compiler, packer, protector Windows, Linux, macOS
TrID Ranked guesses from a large signature database Windows, Linux
CyberChef “Detect File Type” Type of data pasted or dropped in your browser Any browser
A hex editor The raw bytes, when the tools disagree See Reading hex
  • Double extensions: invoice.pdf.exe, photo.jpg.lnk.
  • A program wearing a document’s icon. Icons are just resources inside the file.
  • A container inside a container: an ISO inside a ZIP, a script inside a shortcut. Each layer can hide the next from a scanner.
  • Right-to-left override: a hidden Unicode character can make invoice_fdp.exe display as invoice_exe.pdf.

Common file formats: what each format is, and why attackers pick it.

One Reverse Look

"A little learning is a dangerous thing." ~ A. Pope

One Reverse Look · Made with ❤ · Your friendly knowledge seeker