67
0Knowledge Fuzzing Vincenzo Iozzo [email protected]

0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

0‐Knowledge FuzzingVincenzo Iozzo

[email protected]

Page 2: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

DisclaimerDisclaimerIn this talk you won’t see all those formulas, formal definition, code snippets 

and bulletsand bullets. From past experiences the speaker learned that all the aforementioned 

elements are no useful in making people understand your idea.You instead will see a lot of funny pictures which the speaker hopes will y p p p

convey better the understanding of the ideas explained in the talk

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

Page 3: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

MotivationsMotivations

Page 4: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Questions!Questions!

Page 5: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

FuzzingFuzzing

Page 6: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

How it used to beHow it used to be

Page 7: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

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

Page 8: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Dumb fuzzingDumb fuzzing

Page 9: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Smart FuzzingSmart Fuzzing

Page 10: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Evolutionary Based FuzzingEvolutionary Based Fuzzing

Page 11: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

The ideaThe idea

Page 12: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

The surfaceThe surface

Page 13: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

We need a filterWe need a filter

Page 14: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Cyclomatic complexityy p y

Page 15: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

This oneThis one

Page 16: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Not this oneNot this one

Page 17: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Original formulaOriginal formula

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

Number of edges Number of nodes Connected components

Page 18: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Why? Cyclomatic numberWhy? Cyclomatic number

M = E – N + P

Page 19: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

SimplifySimplify

Page 20: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

FormulaFormula

M = E – N + 2

Page 21: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

ProblemProblem

Page 22: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Loop detectionLoop detection

Page 23: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Dominator treeDominator tree

Page 24: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

DominatorsDominators

Page 25: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

FunctionFunction

Page 26: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Dominator treeDominator tree

Page 27: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

DominatorsDominators

Page 28: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Implicit loopsImplicit loops

Page 29: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

REILREIL

Page 30: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Is that enough?Is that enough?

Page 31: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Not enoughNot enough

Of course not more heuristics neededOf course not, more heuristics needed

void *safe_strcpy(void *old_dest, void *src, int size){

void *dst = realloc(old dest size +1);void dst realloc(old_dest, size +1); strncpy(dst, src, size); return dst;

}}

Page 32: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Add your ownAdd your own

For static analysis we use

Page 33: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

DEMODEMO

Page 34: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Questions!Questions!

Page 35: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Data TaintingData Tainting

Page 36: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

DytanDytan

Page 37: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

PINPIN

Page 38: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Taint sourcesTaint sources

Page 39: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Markings granularityMarkings granularity

Page 40: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

PropagationPropagation 

add eax, ebx, edx, ,

Page 41: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

OutputOutput

R i tRegisters

Memory locationsMemory locations

Page 42: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

DEMODEMO

Page 43: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Questions!Questions!

Page 44: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

In‐memory fuzzingIn memory fuzzing

Page 45: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Why?Why?

Page 46: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

ProblemsProblems

Page 47: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Expertise and patienceExpertise and patience

Page 48: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Memory instability

Page 49: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

False positivesFalse positives

Page 50: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

False negativesFalse negatives

Page 51: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Mutation loop insertionMutation loop insertion

Page 52: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Snapshot mutation restorationSnapshot mutation restoration

Page 53: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

What do we do?What do we do?

• Hook imageHook image

• Hook functions

k i i• Hook instructions

• Hook 

Page 54: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

First approachFirst approach

Page 55: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

For instance…For instance…

30f064‐30f06730f064 30f067

ABCD 0x8a Y 0x00ABCD 0x8a Y 0x00 K

Page 56: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Second approachSecond approach

Page 57: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

ExampleExample

30f064‐30f067 30f084‐30f09730f064 30f067 30f084 30f097

ABCD0x89 K D F 0x960x00 J K U Y W 0xA70xB8 0x00 0x10 A T N0x00 0xD3

Page 58: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Code coverageCode coverage

Page 59: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

How??How??

Good sample Evil sampleGood sample Evil sample

Score  Score Compare

Page 60: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

ScoreScore

BBexecuted/BBtotal

Basic Blocks t d

Total Basic executed Blocks 

Page 61: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

HaltingHalting

C C tCgood = Cevil + t

Code coverage  Code coverage  User‐supplied good sample evil sample threshold

Page 62: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

What do we use?What do we use?

Code coverage Faults monitor

Page 63: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

DEMODEMO

Page 64: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Future – A reasonerFuture  A reasoner

Page 65: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

ThanksThanks

Page 66: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

Questions!Questions!

Page 67: 0knowfuzz.pptx [Read-Only] - Black Hat Briefings...Title Microsoft PowerPoint - 0knowfuzz.pptx [Read-Only] Author travis Created Date 1/30/2010 1:30:15 PM

More InfoMore Info

viozzo wordpress comviozzo.wordpress.com

@@_snagg

[email protected]