• Malicious PDF analysis

    Part 3

    Extracting Javascript

    To extract javascript for object first we need to decompress the zlib compressed data, only then the javascript would make sense. Pdf-parser.py was used to decompress and extract the javascript code. The below screenshots show the pdf-parser otuput.



    Uploaded with ImageShack.us

    The below screenshot shows just the extracted javascript code. But again this code is obfuscated.



    Uploaded with ImageShack.us

    After beautifying the data, the output looks little better , but still obfuscated as show in the below screenshot, the obfuscation technique is used to confuse the analyts and to prevent the security devices from detecting.



    Uploaded with ImageShack.us

    When you look at the javascript code above you will find that all the text in blue (marked by /* and */) is a multiline comment in javascript, removing that will not affect the javascript code in anyway, this is just there to confuse the analysts. After deleting all the multiline comment you will find that the javascript now makes sense as shown in the below screenshost



    Uploaded with ImageShack.us

    now we have the javascript, executing this code with spidermonkey gives an error, as shown below: The reason for this is javascript is trying to access “this.creator” which is adobe specific object, In this case the attacker has split the javascript across multiple objects (multi stage), this is again another technique used to confuse the analysts, this.creator references the creator object (marked by /Creator tag in the pdf document). This /Creator tag usually contains the string which identifies the creator of the pdf document.



    Uploaded with ImageShack.us

    Continued
    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
    This article was originally published in forum thread: Malicious PDF analysis started by m0nna View original post
  • G4H Twitter

  • Latest Posts

    RahulB

    Hi D4rk357, Nice work. :) Though I didn't get...

    Hi D4rk357,

    Nice work. :)
    Though I didn't get the chance to actually use it 'coz it was asking for external parser in my case. Will install lxml/ html5lib later.
    You might want to check the code...

    RahulB Yesterday, 11:35 PM Go to last post
    Arunpreet Singh

    Selective Symbolic Execution(S2E)

    i was looking into some academic research papers ,found this interesting Project

    S2E: Selective Symbolic Execution - Dependable Systems Lab

    Course Related
    Syllabus - CS-617: Testing Software...

    Arunpreet Singh Yesterday, 08:33 AM Go to last post
    liyw

    Thank you Amol for sharing such resourceful...

    Thank you Amol for sharing such resourceful information. If you have any further update on this .. please share that too..

    liyw Yesterday, 12:29 AM Go to last post
    GroundZeroS

    Open challenge to Design the logo for Ground Zero Summit

    Hello All!

    The GroundZero Summit (G0S) is an international platform for Information Security professionals showcasing their research, products and case studies to industry leaders, policy makers,...

    GroundZeroS 05-24-2013, 12:26 PM Go to last post
    pragyaware

    Hi rohit nice to meet here!! I have also a keen...

    Hi rohit nice to meet here!! I have also a keen interest in this area. So i think i must gain some knowledge from you and you gain some knowledge from me regarding linux server

    pragyaware 05-23-2013, 11:47 AM Go to last post