Fuzz Testing for Fun and Profit Presented by: - - PDF document

fuzz testing for fun and profit
SMART_READER_LITE
LIVE PREVIEW

Fuzz Testing for Fun and Profit Presented by: - - PDF document

W3 Testing at Scale Wednesday, October 2nd, 2019 11:30 AM Fuzz Testing for Fun and Profit Presented by: Melissa Benua


slide-1
SLIDE 1

¡ ¡ W3 ¡

Testing ¡at ¡Scale ¡ Wednesday, ¡October ¡2nd, ¡2019 ¡11:30 ¡AM ¡ ¡ ¡ ¡ ¡

Fuzz ¡Testing ¡for ¡Fun ¡and ¡Profit ¡ ¡

Presented ¡by: ¡ ¡ ¡

¡ Melissa ¡Benua ¡

¡ mParticle ¡ ¡

Brought ¡to ¡you ¡by: ¡ ¡ ¡ ¡

¡

¡

¡ ¡

888-­‑-­‑-­‑268-­‑-­‑-­‑8770 ¡·√·√ ¡904-­‑-­‑-­‑278-­‑-­‑-­‑0524 ¡-­‑ ¡info@techwell.com ¡-­‑ ¡http://www.starwest.techwell.com/ ¡ ¡ ¡

¡

¡ ¡ ¡

¡

slide-2
SLIDE 2

Melissa ¡Benua ¡

¡ In ¡her ¡career ¡at ¡companies ¡from ¡large ¡to ¡small, ¡Melissa ¡Benua ¡has ¡worked ¡in ¡nearly ¡ every ¡software ¡development ¡role ¡-­‑ ¡engineer, ¡test, ¡DevOps, ¡and ¡program ¡

  • management. ¡She's ¡created ¡and ¡run ¡high-­‑availability, ¡high-­‑quality ¡services ¡at ¡Boeing ¡

and ¡Microsoft ¡on ¡products ¡such ¡as ¡Bing, ¡Cortana, ¡and ¡Xbox ¡One. ¡Melissa ¡discovered ¡ her ¡love ¡of ¡massively-­‑scaled ¡systems ¡while ¡working ¡on ¡the ¡Bing ¡backend, ¡where ¡she ¡ honed ¡the ¡art ¡of ¡keeping ¡highly-­‑available ¡complex ¡systems ¡up ¡while ¡undergoing ¡ massive ¡code ¡churn. ¡Now ¡a ¡senior ¡engineer ¡and ¡manager ¡at ¡the ¡disruptive ¡gaming ¡ startup ¡PlayFab, ¡Melissa ¡isn’t ¡afraid ¡to ¡mix ¡traditional ¡approaches ¡with ¡bold ¡new ¡ ideas ¡to ¡make ¡her ¡products ¡better, ¡faster, ¡and ¡more ¡reliable. ¡She’s ¡passionate ¡not ¡

  • nly ¡about ¡maximizing ¡efficiency ¡both ¡in ¡her ¡product ¡code ¡and ¡in ¡her ¡developer ¡

tools ¡but ¡also ¡about ¡sharing ¡best ¡practices ¡among ¡colleagues ¡and ¡the ¡tech ¡world ¡at ¡ large! ¡ ¡

slide-3
SLIDE 3

9/27/19 1 Melissa Benua / Senior Engineering Manager

Fuzz Testing for Fun and Profit!!

STARWEST 2019

ABOUT ME

Melissa Benua

Senior Engineering Manager mParticle

Get in touch!

mbenua@gmail.com @queenofcode

Follow my work!

https://www.linkedin.com/in/mbenua/ https://www.slideshare.net/MelissaBenua/ https://github.com/queen-of-code/ https://queenofcode.net

slide-4
SLIDE 4

9/27/19 2

Request Forking Service

AKA T’ed Traffic Performance Environment

Optimized for driving out performance issues and doing perf testing

Release Candidate B

More new code!

Parallel Prod

Production, but with additional debugging

  • ptions

Release Candidate A

New code!

PRODUCTIO N ENV

Fuzz Testing

  • generating random

input to explore the bounds of a system under test

Attack

  • data meant to drive
  • ut a specific class of

bug

Manipulation

  • combination of an

input and an attack

Creation Manipulation

  • substituting in a de

novo generated input from an attack

Insertion Manipulation

  • modifying a known

input to include an attack

Generational Manipulation

  • successively modifying

an input based on system behavior

Key Definitions

slide-5
SLIDE 5

9/27/19 3

Keys to Successful Fuzzing

Model Attack Set Plan PROFIT!!

Defining the Data Model

GET https://www.bing.com/search?q=ponies&qs=n&form=QBRE HTTP/1.1 User-Agent: Fiddler/4.6.20171.9220 (.NET 4.6.2) Host: www.bing.com Accept-Language: en-US Accept-Encoding: gzip, deflate, br Accept: text/html,application/xhtml+xml Pragma: no-cache Cookie: DUP=Q=N51ltffjRFaNUXQ2&T=69727&A=1&IG=140419BB6CF3209258263; SRCHS=PC=U316; SRCHD=AF=CHROMN; SRCHUID=V=2&GUID= 2222333DDDD3333C0C0C0C0F00D33227 &dmnchg=1; _EDGE_V=1; MUID=2222333DDDD3333C0C0C0C0F00D33227; _ITAB=STAB=REC;

Method URI Version Headers Header Values Cookie Values Query Params

slide-6
SLIDE 6

9/27/19 4

JSON-based HTTP Request Fuzzing

POST https://s2s.mparticle.com/v2/events HTTP/1.1 Host: s2s.mparticle.com Authorization: Basic ZXhhbXBsZS1hcGkta2V5OmV4YW1wbGUtYXBpLXNlYAAAAA== { "events" : [ { "data" : { "timestamp_unixtime_ms" : 1402521613976, "event_name" : "click“ }, "event_type" : "custom_event" } ], "device_info" : { "brand": "iPhone6,1", "ios_advertising_id": "613ff528-afd1-4c1b-9628-e6ed25ece9c0“ }, "user_identities" : { "customerid": "1234", "other" : “helpers@mparticle.com” }, "schema_version": 2, "environment": “development" }

Method URI Version JSON POST Body Headers Array Object Random String

  • aaaaaaaaaa

SQL Injection

  • ' select * from

information_schema.tables-- Control Characters

  • Powerًررُبّصلُلُبّصُلُل ॣ ॣh ॣ ॣ冗

XSS

  • firefoxurl:test|"%20-new-window

%20javascript:alert(\'Cross %2520Browser%!\’);” Integer Overflow

  • 0xffffffff

Redirects

  • /cgi-bin/redirect.cgi?{targetUrl}

Attack Selection

slide-7
SLIDE 7

9/27/19 5

Bad Sample Fuzzed HTTP Request

GEAAT https://www.bi%20ng.com/(oNcliCk=alert())?q=ponies HTTP/1.1 User-Agent: /cgi-bin/redirect.cgi?www.google.com Host: www.bing.com AAAAccept-Language: 0xFFFFFFF NULL: text/html,application/xhtml+xml Pragma: no-cache “”: DUP=Q=N51ltffjRFaNUXQ2&T=69727&A=1&IG=140419BB6CF3209258263; SRCHS=PC=U316; C:/boot.ini=AF=CHROMN; SRCHUID=V=2&GUID= 2222333DDDD3333C0C0C0C0F00D33227 &dmnchg=1; _EDGE_V=1; MUID=2222333DDDD3333C0C0C0C0F00D33227; _ITAB=STAB=REC;

Making A Plan

<Request MaxAttacks=“3”> <Method AttackSet=“AttacksA” Probability=“5%” MaxAttacks=“1”/> <URI> <Host Probability=“0%” /> <Path AttackSet=“AttackSetPath” Probability=“10%” MaxAttacks=“2”/> <QueryLine AttackSet=“Values” Probability=“50%” MaxAttacks=“2”/> </URI> <Headers KeyChance=“2%” KeyAttacks=“AttacksA” ValueChance=“25%” ValueAttacks=“Values” > <Authorization KeyChance=“0%” ValueChance=“10%” /> </Headers> <Cookie KeyChance=“2%” KeyAttacks=“AttacksA” ValueChance=“25%” ValueAttacks=“Values” /> </Request>

slide-8
SLIDE 8

9/27/19 6

Good Sample Fuzzed HTTP Request

GET https://www.bing.com/search?q=AAAAAA%20&qs=n&form=QBRE HTTP/1.1 User-Agent: Fiddler/4.6.20171.9220 (.NET 4.6.2) Host: www.bing.com Accept-Language: en-US Accept-Encoding: gzip, deflate, br Accept: text/html,application/xhtml+xml Pragma: no-cache Cookie: DUP=Q=N51ltffjRFaNUXQ2&T=69727&A=1&IG=140419BB6CF3209258263; SRCHS=PC=U316; SRCHD=AF=CHROMN; SRCHUID=V=2&GUID= 2222333DDDD3333C0C0C0C0F00D33227 &dmnchg=1; _EDGE_V=1; MUID=(oNcliCk=alert()); _ITAB=STAB=REC;

Also Good Sample Fuzzed HTTP Request

POST https://s2s.mparticle.com/v2/events HTTP/1.1 Host: s2s.mparticle.com Authorization: Basic ZXhhbXBsZS1hcGkta2V5OmV4YW1wbGUtYXBpLXNlYAAAAA== { "events" : [ { "data" : { "timestamp_unixtime_ms" : 0xFFFFFFFF, "event_name" : "click“ }, "event_type" : "custom_event" } ], "device_info" : { "brand": "iPhone6,1", "ios_advertising_id": "613ff528-afd1-4c1b-9628-e6ed25ece9c0“ }, "user_identities" : { "customerid": ";alert(\'Cross%2520Browser%!\’);", "other" : "helpers@mparticle.com" } }

slide-9
SLIDE 9

9/27/19 7

What can you find?

Crashes

Buffer Overflow Exceptions

Memory Problems

Leaks Thread Contamination

Exploits

SQL Injection XSS Code Execution

How do you know you found a problem?

Metrics Logs Core Dumps Side Effects

slide-10
SLIDE 10

9/27/19 8

Want To Explore Further?

If you:

  • Like dotnet core
  • Want to use something lightweight

Try out:

  • https://github.com/queen-of-code/DotnetModelFuzzing

References & Further Reading

  • Fuzzing Book - https://www.fuzzingbook.org/ - From

introduction to deep dive; uses Python as an example for crafting in-depth fuzzing runs

  • AFL (American Fuzzy Lop) -

https://github.com/google/AFL - Security-focused fuzzer utilizing code coverage to guide genetic algorithms

  • FuzzDB - https://github.com/fuzzdb-project/fuzzdb –

Dictionary of useful attacks for use in fuzzing

  • BlackArch Fuzz Listing -

https://www.blackarch.org/fuzzer.html – A (non-exhaustive but good) list of fuzzers across platforms and models

slide-11
SLIDE 11

9/27/19 9

Thank you!

GET IN TOUCH!

Learn more Melissa Benua Senior Engineering Manager mbenua@gmail.com @queenofcode