This post contains the analysis that i carried out on a malicious pdf file, exploiting a stack based overflow vulnerablity in the adobe acrobat reader. Before analyzing the malicious pdf, it is necessary to understand the structure of the pdf file, so before getting into the analysis i would like to explain the structure of pdf document. Also the PDF document can include images, fonts, text, javascript, flash and other content to dispay the document.
PDF document structure
In this document i'l not explain the full pdf structure, but i'l be explaining the parts that is required for the analysis. The pdf document starts with a header which looks like this %PDF-a.b.c.d, this is the version of the pdf language. Without this header the pdf readers will not accept it.
The pdf document also consists of multiple indirect objects, an example of an indirect object is shown below, the indirect objects have an object id (1 in the below example) and version number (0 in the below example) follwed by the keyword obj, endobj marks the end of the object.
%PDF-1.1 <------ PDF header 1 0 obj <-------- Indirect object, 1 is the object id and 0 is the version number ........ ..... endobj <------ This marks the end of object 1
Also there are different types of tags, for example: /JS and /javascript indicates javascript
/Richmedia indicates flash,
/AA, /OpenAction indicates an automatic action to be performed when the document is viewed.
7 0 obj <---- object 7 << /Type /Action /S /JavaScript <---- javascript tag /JS <javascript code> <---- javascript content ............... ............. >> endobj obj 31 0 <----- object 31 Type: Referencing: 34 0 R [(2, '<<'), (2, '/S'), (2, '/JavaScript'), (2, '/JS'), (1, ' '), (3, '34'), (1, ' '), (3, '0'), (1, ' '), (3, 'R'), (2, '>>'), (1, '\r')] << /S /JavaScript /JS 34 0 R <------ reference to a javascript object, in this case object 34 >> endobj 34 0 obj<</Subtype/Type1C/Length 5416/Filter/FlateDecode >>stream <--- stream object H‰|T}T#W#Ÿ!d&"FI#ʼnNFW#åC <---- compressed stream content, in this case zlib compressed data indicated by /FlatDecode … endstream endobj
Malicious PDF analysis Tutorial Part 1
Malicious PDF analysis Tutorial Part 2
Malicious PDF analysis Tutorial Part 3 Extracting Javascript
Malicious PDF analysis Tutorial Part 4
Part 5 Malicious PDF analysis Tutorial Shellcode analysis



Menu
Recent Blog Posts





Reply

DEP ASLR bypass without ROP JIT : CanSecWest2013 Slides and Analysis
I have my own talk from CanSecwest to blog about but this one is more interesting and the most...
fb1h2s 03-08-2013 05:03 AM