pentesting, updated
Inspect PDF structure and metadata
Walk a PDF's object tree and metadata to spot anything that does not belong in a normal document.
Goal
Confirm whether a PDF is malicious before opening it in a full reader, by reading its raw objects instead of rendering it.
How to test
Never open a suspect PDF in a viewer first — use a static inspector.
pdfid.py suspect.pdf # counts of /JS, /OpenAction, /ObjStm etc.
pdf-parser.py -a suspect.pdf # list every object by type
pdf-parser.py -o 12 suspect.pdf # dump one specific object
exiftool suspect.pdf # author, producer, creation tool
binwalk also works here for a quick embedded-file sweep — see binwalk.
What to look for
A nonzero /JS or /OpenAction count, /ObjStm (object streams, often used to hide content from naive scanners), multiple /Launch actions, or a producer/creator field that does not match the claimed authoring tool.
Notes
Compressed streams (/Filter /FlateDecode) hide content from a plain-text grep — always decompress with pdf-parser.py or peepdf before concluding a PDF is clean.