everyday is zero day, today is flash player

37
1 By Lucas Leong

Upload: lucas-leong

Post on 29-Nov-2014

414 views

Category:

Engineering


4 download

DESCRIPTION

My HITCON 2014 Presentation Slide

TRANSCRIPT

Page 1: Everyday is Zero Day, Today is Flash Player

1

By Lucas Leong

Page 2: Everyday is Zero Day, Today is Flash Player

• NCTU Software Quality Lab

• Trend Micro

• Focus on…

• Document exploit

• Antivirus engine

• CTF

2

Page 3: Everyday is Zero Day, Today is Flash Player

• A journey for a complete zero-day exploit nowadays

• Crash it

• How is the birth of a Flash Player zero-day exploit

• Exploit it

• How to take control of it

• Bypass it

• How many and how to overcome exploit mitigations

nowadays

3

Page 4: Everyday is Zero Day, Today is Flash Player

4

Page 5: Everyday is Zero Day, Today is Flash Player

• Part of my daily work is to review new CVE and

enhance antivirus engine.

• HTML, PDF, Office, Flash …

• Most of Flash Player CVE relate to ActionScript

• Flash Player’s regular expression CVE in 2014 H1

• CVE-2014-0498

• CVE-2014-0499

• CVE-2014-0502

5

Page 6: Everyday is Zero Day, Today is Flash Player

• Easy to implement RE fuzzer

• RE syntax is less diverse

• Hard to implement RE engine

• RE semantic is complicated

• RE engine == RE compiler

• Flash player maintains a modified-PCRE

6

Page 7: Everyday is Zero Day, Today is Flash Player

7

• List all PCRE syntax

Page 8: Everyday is Zero Day, Today is Flash Player

• Fuzzer in Actionscript

8

while (true) {

valid_syntax_re = random_generate();

re = new RegExp(valid_syntax_re, “”);

“WMLIANG”.match(re);

}

Page 9: Everyday is Zero Day, Today is Flash Player

9

Page 10: Everyday is Zero Day, Today is Flash Player

10

Page 11: Everyday is Zero Day, Today is Flash Player

11

• Generated a set of crashes ideally

• Figure out the root cause manually

Page 12: Everyday is Zero Day, Today is Flash Player

12

Page 13: Everyday is Zero Day, Today is Flash Player

• In PCRE compiler

13

function pcre_compile() {

int length;

// first-phase for estimating the length of compiled RE

compile_regex(NULL, &size);

re = malloc(size);

// second-phase for compiling RE actually

compile_regex(re, NULL);

}

Page 14: Everyday is Zero Day, Today is Flash Player

• In PCRE compiler

14

function pcre_compile() {

int size;

compile_regex(NULL, &size); // return size = 0xA0 bytes

re = malloc(size);

compile_regex(re, NULL); // but overwrite > 0xA0 bytes

}

Page 15: Everyday is Zero Day, Today is Flash Player

15

Page 16: Everyday is Zero Day, Today is Flash Player

16

V V V V V V V V

V V V V V V V V

V V V V V V V V

V V V V V V V V

V V V V V V V V

V V V V V V V V

• Allocate Vector objects in memory

a Vector object with 0xA0 bytes

Vector length

Page 17: Everyday is Zero Day, Today is Flash Player

17

V V Free V V V Free V

V V Free V V V Free V

V V Free V V V Free V

V V Free V V V Free V

V V Free V V V Free V

V V Free V V V Free V

• Free some of them

a Vector object with 0xA0 bytes

Vector length

Page 18: Everyday is Zero Day, Today is Flash Player

18

V V Free V V V Free V

V V Free V V V Free V

V V Free V V V Free V

V V Free V V V Free V

V V Free V V V Free V

V V RE V V V Free V

• Allocate malicious RE object and trigger the overflow

a Vector object with 0xA0 bytes

Vector length

Page 19: Everyday is Zero Day, Today is Flash Player

19

Page 20: Everyday is Zero Day, Today is Flash Player

20

Page 21: Everyday is Zero Day, Today is Flash Player

21

Page 22: Everyday is Zero Day, Today is Flash Player

22

Page 23: Everyday is Zero Day, Today is Flash Player

23

Page 24: Everyday is Zero Day, Today is Flash Player

24

Page 25: Everyday is Zero Day, Today is Flash Player

• If you ignore EMET and Browser sandbox…

1. Locate the base address of DLLs

2. Build ROP

3. Execute shellcode

4.

25

Page 26: Everyday is Zero Day, Today is Flash Player

• Platform-dependent

• Easily detected (eg. EMET)

• Cost of time

• Continuous execution

26

Page 27: Everyday is Zero Day, Today is Flash Player

27

Page 28: Everyday is Zero Day, Today is Flash Player

28

Page 29: Everyday is Zero Day, Today is Flash Player

29

Let’s change to calc.exe,

but read-only …

Page 30: Everyday is Zero Day, Today is Flash Player

30

Let’s change to read-write

Page 31: Everyday is Zero Day, Today is Flash Player

1. Prepare the arguments

2. Call Function2 -> VirtualProtect()

3. Change to “calc.exe”

4. Call Function1 -> CreateProcess()

5.

31

Page 32: Everyday is Zero Day, Today is Flash Player

32

Page 33: Everyday is Zero Day, Today is Flash Player

• Platform-dependent

• Easily detected (eg. EMET)

• Cost of time

• Continuous execution

33

Page 34: Everyday is Zero Day, Today is Flash Player

34

Page 36: Everyday is Zero Day, Today is Flash Player

36

[1] Haifei Li, "Smashing the Heap with Vector: Advanced

Exploitation Technique in Recent Flash Zero-day Attack"

Page 37: Everyday is Zero Day, Today is Flash Player

37

Email: [email protected]

Twitter: @_wmliang_