PDF File Format / MS Office Flashcards
Name two main tools used to analyse PDF Files?
- PDF-ID counts the occurance of certain keywords
- PDF-Parser actually understands the file format.
It can decode content with “-f” option (/FlateDecode = Zlib compression). Can search for strings in PDF file with “-s”.
Both of these are command-line Python scripts.
What does a JavaScript need to be executed in a PDF?
Javascript needs /OpenAction event to be executed.
What are PDF Filters?
PDF Filter are applied from right to left. I.e. first /FlateDecode and then /ASCIIHexDecode.
How can you get around JavaScript Obfuscation in PDF files?
- Add <scipt> tag and HTML</scipt>
- Tools like Malzilla or Revelo
What are ObjectStreams?
An ObjectStream (/ObjStm) is a special type of object. It is an object, that contains a stream, that itself includes other objects. The idea is that multiple objects can be placed in one stream, and the whole stream can be compressed. In practice a document will generally have several object streams, that keep related items together – e.g. All objects for page 1, page 2 etc – this allows for the PDF to still be random accessed easily.
Can be analyzed like this: pdf-parser.py –s ObjStm –f –w 10.pdf | pdfid.py -f
Which tool would be more useful in analyzing a PDF file – a Hex Editor or a Text Editor?
Text – it’s a text based file format
What are the main part of a PDF file?
- Header
- Objects
- Cross Reference (Points to each object)
- Trailer (EOF, Offset to XREF)
What are you looking for in MS Office documents?
- Dropped Files (via Macro or exploit)
- Shellcode (via a vulnerability)
- URL callouts (acting as downloader)
- Malicious Scripts (download / dropping a file)
What is the approach of analysing MS Office documents?
- Locate potentially malicious embedded code
- Extract suspicious code from the file
- If shellcode - disassemble / debug
- If other script - deobfuscate
- Figure out the end goal and next stage of infection chain
Name some tools to analyse MS Office documents?
- OfficeMalScanner
- OleDump
- OffVis
- python-oletools
How to run pdf-id?
python pdfid.py <filename></filename>
How to run pdf-parser?
python pdf-parser.py <filename></filename>
How to parse out (see content) individual objects from a PDF?
python pdf-parser.py -o 5 -c <pdffile></pdffile>
- -o : Object number
- -c : Prints out content
How to parse out individual objects from a PDF that is ASCII decoded?
python pdf-parser.py -o 5 -f <pdffile></pdffile>
- -o : Object number
- -f : Decodes filter
How can hackers use PDF to put in malicious code?
Obfuscation by using filters