• No results found

US 13 Esparza PDF Attack A journey from the Exploit Kit Slides pdf

N/A
N/A
Protected

Academic year: 2020

Share "US 13 Esparza PDF Attack A journey from the Exploit Kit Slides pdf"

Copied!
49
0
0

Loading.... (view fulltext now)

Full text

(1)

PDF ATTACK

A Journey from the Exploit Kit to the Shellcode

(2)

Jose Miguel Esparza

Senior Cybercrime Analyst at Fox-IT

– Malware, Botnets, C&Cs, Exploit Kits, …

Security Researcher at Home ;p

– PDF, NFC, …

http://eternal-todo.com

@EternalTodo

on Twitter

(3)

Jose Miguel Esparza @EternalTodo

A Journey from the Exploit Kit to the Shellcode

– Exploit Kits: the source of evil

– PDF basics

– Some basic peepdf commands

– Analyzing PDF exploits

• Extracting and analyzing shellcodes – Obfuscation of PDF files

(4)

Jose Miguel Esparza @EternalTodo

Linux distribution

– Libemu / Pylibemu

– V8 / PyV8

Last peepdf version

– Checkout from the repository or update!

Samples

– http://eternal-todo.com/eternal_files/pdf-attack.zip

(5)

Jose Miguel Esparza @peepdf

Best way to infect a computer

Effective and fresh exploits

– IE

– Java

– PDF

– Flash

– …

Average of 6-7 exploits

(6)
(7)

Jose Miguel Esparza @EternalTodo

Exploit Kits: the source of evil

Java 7u11

Java Byte Verify

Java CMM

(8)

Most used nowadays

– BlackHole

– Neutrino

– RedKit

– CoolPack

– Styx

– Nuclear

– …

Exploit Kits: the source of evil

(9)

Jose Miguel Esparza @peepdf

Infection steps

– Visit injected website / Click SPAM link

– Redirection (maybe more than one)

– Obfuscated Javascript

– Plugin detection

– Trying exploits

– Done!

(10)

Jose Miguel Esparza @peepdf

Traffic Distribution Systems (TDS)

– Country specific attacks

– TDS + Exploit Kits = WIN!

(11)

Jose Miguel Esparza @EternalTodo

Analyzing exploit kits

– Avoiding researchers

• Filtering by User-Agent and/or Referer

• Blocking IPs

• One-time infections

• Country filters

(12)

Jose Miguel Esparza @EternalTodo

Analyzing obfuscated Javascript code

– The “easy” way

• Automatic tools

– Online services » Wepawet » JSUNPACK

– Low-interaction honeyclient » Thug

• You can miss some info

(13)

Jose Miguel Esparza @EternalTodo

Analyzing obfuscated Javascript code

– The traditional way

• Executing different stages of JS code

– Beautify the code

– Looking for the eval function » s/eval/print/

– Hooking the eval function with Javascript engines

• Looking for exploits / shellcodes

• You cannot miss any detail

(14)

Jose Miguel Esparza @peepdf

Analyzing obfuscated Javascript code

– The traditional way

• Let’s play ;)

(15)

Jose Miguel Esparza @peepdf

PDF format?

PDF structure?

Objects?

Filters?

(16)

Jose Miguel Esparza @EternalTodo

Header

Body

Cross reference table

(17)

Jose Miguel Esparza @peepdf

• Body

– Sequence of objects

– Object types

• Boolean: true false

• Numbers: 123 -98 4. -.002 123.6 • Strings: (hola) <686f6c61>

68 (h) 6f (o) 6c (l) 61 (a)

• Names: /Type /Filter

• Dictionaries: << /Type /Catalog /Root 1 0 R >>

• Arrays: [ 1.0 (test) <</Length 273>> ]

• Streams

(18)
(19)

Jose Miguel Esparza @peepdf

Object types

– Indirect objects

(20)

Jose Miguel Esparza @EternalTodo

Object types

– Indirect objects

(21)

Jose Miguel Esparza @peepdf

• Tree structure  References

• Root node

– /Catalog

• If an element isn’t in the downward path from the /Catalog DOES NOT EXIST

(22)

Jose Miguel Esparza @EternalTodo • You can use just a text editor!!

(23)

Jose Miguel Esparza @EternalTodo

“peepdf sounds like the Swiss army knife of

PDF security apps”

peepdf

(24)

Jose Miguel Esparza @EternalTodo

Characteristics

– Python

– Command line

– Interactive console (colorized)

– Included in REMnux and BackTrack / Kali Linux

peepdf

(25)

Jose Miguel Esparza @EternalTodo

peepdf

(26)

Jose Miguel Esparza @EternalTodo

Characteristics

– Command file option

• Batch / Automation – XML output

– Easily updated from repository

peepdf

(27)

Jose Miguel Esparza @peepdf

Why peepdf?

– Support for:

• Encryption

• Object Streams (compressed objects)

• Most used filters

• FlateDecode / LZWDecode Parameters – Javascript Analysis

– Shellcode emulation

(28)

Jose Miguel Esparza @peepdf

Why peepdf?

– Shows Suspicious Elements

– Shows potential Vulnerabilities

– Powerful Interactive Console

– Easy extraction of objects / JS code / shellcode

– PDF Obfuscation

– Alive project!!

(29)

Jose Miguel Esparza @peepdf

Recent commits

– s/Spidermonkey/PyV8/g

(30)

Jose Miguel Esparza @peepdf

Recent commits

– vtcheck

(31)

Jose Miguel Esparza @peepdf

Commands

– Console

• help

• log

• open

• reset

• quit

• exit

(32)

Jose Miguel Esparza @peepdf

Commands

– Showing information

(33)

Jose Miguel Esparza @peepdf

Commands

– Showing information

• Objects

– object – rawobject – stream – rawstream – references – hash

(34)

Jose Miguel Esparza @peepdf

Commands

– Extracting information

• Output redirection is possible

– set

» set output file path_to_my_file

» set output variable myVar

(35)

Jose Miguel Esparza @peepdf

Commands

– Extracting information

• Shell redirection is easier ;)

– Files

» stream 6 > stream6_file

» js_code 12 >> pdf_js_code_file – Variables

» js_unescape variable myVar $> unescaped_sh » rawstream 5 $>> all_my_rawstreams_var

(36)

Jose Miguel Esparza @peepdf

Commands

– Javascript functions

• js_code

• js_eval

• js_analyse

• js_unescape

• js_join

(37)

Jose Miguel Esparza @peepdf

Commands

– Shellcode emulation

• sctest

– pylibemu: libemu wrapper for Python

(38)

Jose Miguel Esparza @peepdf

Commands

– Modification / Creation

(39)

Jose Miguel Esparza @peepdf

Commands

– Misc

• set

• search

• show

• xor

• xor_search

(40)

Jose Miguel Esparza @EternalTodo

How to identify malicious files

– Suspicious elements

• /Action • /OpenAction • /AA • /AcroForm • /Names • /JavaScript • /EmbeddedFile

• Known vulnerabilities

(41)

Jose Miguel Esparza @peepdf

Most used vulnerabilities

– LibTiff (TIFF images)

– Collab.collectEmailInfo

– Collab.getIcon

– Doc.media.newPlayer

– …

(42)

Jose Miguel Esparza @peepdf

How to identify malicious files

– Obfuscation

• Strange codification in objects

• Encryption

• Malformed objects

• Embeded PDFs

• Javascript

(43)

Jose Miguel Esparza @EternalTodo

How to identify malicious files

– Patterns

• One page without content

• Big objects

• Gaps between objects (offsets)

• Strange structure

• Characteristic strings

– Metadata – Tools

(44)

Jose Miguel Esparza @EternalTodo

How to identify malicious files

– Malformed documents

• Headers

• Objects Tags

(45)

Jose Miguel Esparza @EternalTodo

Practicing all the theory

Not a sample exploit, a real one

Extracting the interesting parts

Extracting the shellcode

Analyzing the shellcode

(46)

Jose Miguel Esparza @peepdf

Playing with real exploits

(47)

Jose Miguel Esparza @peepdf

Some developments based on peepdf

– SWF Mastah (Brandon Dixon)

(48)

Jose Miguel Esparza @peepdf

Remove characteristic strings

Split up Javascript code (/Names)

If the code is in:

– String octal encoding (\143\172)

– Stream filters (not usual, parameters)

Compress (object streams)

Encrypt (default password)

Malform (endobj, header)

Nest PDFs

(49)

THANKS!!

Jose Miguel Esparza

jesparza AT eternal-todo.com http://eternal-todo.com

References

Related documents

Abstract Background/purpose: The aims of this cross-sectional study were to determine the possible risk factors of caries development in children with early childhood caries (ECC)

It reports on: two octogenarian mathematics teachers in South Africa - against the backdrop that during the dark era in that country, the apartheid government had decreed

gem eente uitgevoer word, kan hulle uitgenooi word na die Nagmaal in ’n ander..

In the crystal, classical O—H N hydrogen bonds, weak C— H O and C—H Cl hydrogen bonds (Table 1) link the chains into a three-dimensional supramolecular architecture.. –

This paper will show a possibility that Finite Difference Method (FDM) is also helpful rather the Finite Elements Method to track the interface in the simulation with an

In contrast to the large size distortions of the asymptotic tests, our proposed bootstrap method (last column in Tables 1 and 2) controls the size of the unit root test with

Formulation 1 and formulation 7 with high milk substitution in butter cake helped to enhance the development of gluten and gelatinisation of starch in the flour, thus,

Near National Super Regional Strategic Subsidiary Strategic Subsidiary Coverage Specialist Coverage Specialist States &gt; 34 Meritplan Insurance Co. Strategic Subsidiary Super