Lion Cipher Lab

Triage a suspicious PDF safely with pdfid and pdf-parser

Why it matters

A PDF arrives as an email attachment and someone has to decide, fast, whether to open it. A PDF is not paper: it is an object graph that can carry an /OpenAction that runs /JavaScript the instant the file opens, a /Launch that starts a program, or an /EmbeddedFile it drops to disk. RFC 8118, the document that defines the application/pdf media type, warns in its security section that PDF supports JavaScript, launch actions and embedded files and that these are a route to malicious behaviour. The wrong move is to open the file to see what it does, because opening it is exactly what the attacker…

What you'll learn

Steps in this lab

  1. Why a PDF can act before you have read a word
  2. The defender's chair: triage on disk, never open the file
  3. Get the two tools (free, standalone Python scripts)
  4. Build your own demonstrator PDF and a clean control
  5. Count the keywords with pdfid (clean vs demonstrator)
  6. Follow /OpenAction with pdf-parser and READ the script
  7. The obfuscation: a FlateDecode stream a naive search misses
  8. The honest negatives: a count is not a verdict
  9. The pro flow: when to reach for this, and what comes next

Open the full interactive lab →