0-Knowledge Fuzzing Vincenzo Iozzo - - PowerPoint PPT Presentation

0 knowledge fuzzing
SMART_READER_LITE
LIVE PREVIEW

0-Knowledge Fuzzing Vincenzo Iozzo - - PowerPoint PPT Presentation

0-Knowledge Fuzzing Vincenzo Iozzo vincenzo.iozzo@zynamics.com Disclaimer In this talk you wont see all those formulas, formal definiEon, code snippets and


slide-1
SLIDE 1

0-­‑Knowledge ¡Fuzzing ¡

Vincenzo ¡Iozzo ¡ vincenzo.iozzo@zynamics.com ¡

slide-2
SLIDE 2

Disclaimer ¡

You ¡don’t ¡want ¡slides ¡like ¡ this, ¡do ¡you? ¡

In ¡this ¡talk ¡you ¡won’t ¡see ¡all ¡those ¡formulas, ¡formal ¡definiEon, ¡code ¡snippets ¡ and ¡bullets. ¡ ¡ From ¡past ¡experiences ¡the ¡speaker ¡learned ¡that ¡all ¡the ¡aforemenEoned ¡ elements ¡are ¡no ¡useful ¡in ¡making ¡people ¡understand ¡your ¡idea. ¡ You ¡instead ¡will ¡see ¡a ¡lot ¡of ¡funny ¡pictures ¡which ¡the ¡speaker ¡hopes ¡will ¡ convey ¡beIer ¡the ¡understanding ¡of ¡the ¡ideas ¡explained ¡in ¡the ¡talk ¡

slide-3
SLIDE 3

MoEvaEons ¡

slide-4
SLIDE 4

QuesEons! ¡

slide-5
SLIDE 5

Fuzzing ¡

slide-6
SLIDE 6

How ¡it ¡used ¡to ¡be ¡

slide-7
SLIDE 7

How ¡it ¡is ¡today ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ (aka ¡the ¡reason ¡of ¡this ¡talk) ¡

slide-8
SLIDE 8

Dumb ¡fuzzing ¡

slide-9
SLIDE 9

Smart ¡Fuzzing ¡

slide-10
SLIDE 10

EvoluEonary ¡Based ¡Fuzzing ¡

slide-11
SLIDE 11

The ¡idea ¡

slide-12
SLIDE 12

The ¡surface ¡

slide-13
SLIDE 13

We ¡need ¡a ¡filter ¡

slide-14
SLIDE 14

CyclomaEc ¡complexity ¡

slide-15
SLIDE 15

This ¡one ¡

slide-16
SLIDE 16

Not ¡this ¡one ¡

slide-17
SLIDE 17

Original ¡formula ¡

¡ ¡ ¡ ¡M ¡= ¡E ¡– ¡N ¡+ ¡2P ¡

Number ¡of ¡edges ¡ Number ¡of ¡nodes ¡ Connected ¡ components ¡

slide-18
SLIDE 18

Why? ¡CyclomaEc ¡number ¡

¡ ¡ ¡ ¡M ¡= ¡E ¡– ¡N ¡+ ¡P ¡

slide-19
SLIDE 19

Simplify ¡

slide-20
SLIDE 20

Formula ¡

M ¡= ¡E ¡– ¡N ¡+ ¡2 ¡

slide-21
SLIDE 21

Problem ¡

slide-22
SLIDE 22

Loop ¡detecEon ¡

slide-23
SLIDE 23

Dominator ¡tree ¡

slide-24
SLIDE 24

Dominators ¡

slide-25
SLIDE 25

FuncEon ¡

slide-26
SLIDE 26

Dominator ¡tree ¡

slide-27
SLIDE 27

Dominators ¡

slide-28
SLIDE 28

Implicit ¡loops ¡

slide-29
SLIDE 29

REIL ¡

slide-30
SLIDE 30

This ¡one… ¡

slide-31
SLIDE 31

…to ¡this ¡one ¡

slide-32
SLIDE 32

Is ¡that ¡enough? ¡

slide-33
SLIDE 33

Not ¡enough ¡

Of ¡course ¡not, ¡more ¡heurisEcs ¡needed ¡

void *safe_strcpy(void *old_dest, void *src, int size){ void *dst = realloc(old_dest, size +1); strncpy(dst, src, size); return dst; } ¡

slide-34
SLIDE 34

Add ¡your ¡own ¡

For ¡staEc ¡analysis ¡we ¡use ¡

slide-35
SLIDE 35

DEMO ¡

slide-36
SLIDE 36

QuesEons! ¡

slide-37
SLIDE 37

Data ¡TainEng ¡

slide-38
SLIDE 38

Example ¡

Taint ¡ Source ¡

Taint ¡ mark ¡

movl 0x4[eax], ebx ¡

slide-39
SLIDE 39

Dytan ¡

slide-40
SLIDE 40

PIN ¡

slide-41
SLIDE 41

Taint ¡sources ¡

slide-42
SLIDE 42

Markings ¡granularity ¡

slide-43
SLIDE 43

PropagaEon ¡ ¡ add eax, ebx, edx ¡

slide-44
SLIDE 44

Output ¡

¡ ¡ ¡ ¡Registers ¡ ¡ ¡ ¡Memory ¡locaEons ¡

slide-45
SLIDE 45

DEMO ¡

slide-46
SLIDE 46

QuesEons! ¡

slide-47
SLIDE 47

In-­‑memory ¡fuzzing ¡

slide-48
SLIDE 48

Example ¡ rep movs esi ¡= ¡0x30f064 ¡ ¡ esi ¡= ¡0x30f0A4 ¡ ¡ Original ¡loc ¡ ¡ Fuzzed ¡loc ¡ ¡

slide-49
SLIDE 49

Why? ¡

slide-50
SLIDE 50

Problems ¡

slide-51
SLIDE 51

ExperEse ¡and ¡paEence ¡

slide-52
SLIDE 52

Memory ¡instability ¡

slide-53
SLIDE 53

False ¡posiEves ¡

slide-54
SLIDE 54

False ¡negaEves ¡

slide-55
SLIDE 55

MutaEon ¡loop ¡inserEon ¡

slide-56
SLIDE 56

Snapshot ¡mutaEon ¡restoraEon ¡

slide-57
SLIDE 57

What ¡do ¡we ¡do? ¡

  • Hook ¡image ¡
  • Hook ¡funcEons ¡
  • Hook ¡instrucEons ¡
  • Hook ¡ ¡
slide-58
SLIDE 58

First ¡approach ¡

slide-59
SLIDE 59

For ¡instance… ¡

30f064-­‑30f068 ¡ ¡ ¡ ¡ABCD ¡

¡0x8a ¡Y ¡0x00 ¡ K ¡

slide-60
SLIDE 60

Second ¡approach ¡

slide-61
SLIDE 61

Example ¡

30f064-­‑30f068 ¡ ¡ ¡ ¡ABCD ¡ 30f084-­‑30f098 ¡

0x89 ¡K ¡D ¡F ¡0x96 ¡ 0x00 ¡J ¡K ¡U ¡Y ¡W ¡0xA7 ¡ 0xB8 ¡0x00 ¡0x10 ¡A ¡T ¡N ¡ 0x00 ¡0xD3 ¡ ¡ ¡

slide-62
SLIDE 62

Code ¡coverage ¡

slide-63
SLIDE 63

Score ¡ BBexecuted/BBtotal ¡

Basic ¡Blocks ¡ executed ¡ Total ¡Basic ¡ Blocks ¡ ¡

slide-64
SLIDE 64

HalEng ¡

¡Cevil ¡= ¡Cgood ¡+ ¡t ¡ Code ¡coverage ¡ evil ¡sample ¡ Code ¡coverage ¡ good ¡sample ¡ User-­‑supplied ¡ threshold ¡

slide-65
SLIDE 65

How?? ¡

Good ¡sample ¡ Score ¡ ¡ Evil ¡sample ¡ Score ¡ ¡

Compare ¡

slide-66
SLIDE 66

What ¡do ¡we ¡use? ¡ Code ¡coverage ¡ Faults ¡monitor ¡

slide-67
SLIDE 67

DEMO ¡

slide-68
SLIDE 68

Future ¡– ¡A ¡reasoner ¡

slide-69
SLIDE 69

Thanks ¡

slide-70
SLIDE 70

QuesEons! ¡

slide-71
SLIDE 71

More ¡Info ¡

viozzo.wordpress.com ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡@_snagg ¡ ¡ ¡ ¡vincenzo.iozzo@zynamics.com ¡