weizz automatic grey box fuzzing for structured binary
play

WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats - PowerPoint PPT Presentation

WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats Andrea Fioraldi , Daniele Cono DElia and Emilio Coppa @andreafioraldi andreafioraldi@gmail.com Format-aware Fuzzing Input Input Program Crashes Format Generation Under


  1. WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats Andrea Fioraldi , Daniele Cono D’Elia and Emilio Coppa @andreafioraldi andreafioraldi@gmail.com

  2. Format-aware Fuzzing Input Input Program Crashes Format Generation Under Test Model 2 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  3. Format-aware Fuzzing ● LangFuzz ● Peach ● Spike ● CSmith ● ... 3 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  4. Problems ● Impossible if the input structure is unknown 4 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  5. Problems ● Impossible if the input structure is unknown ● May fail to find bugs related to syntactically invalid inputs in parsers 5 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  6. Problems ● Impossible if the input structure is unknown ● May fail to find bugs related to syntactically invalid inputs in parsers ● Parser implementations do not always closely mirror format specifications 6 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  7. Problems ● Impossible if the input structure is unknown ● May fail to find bugs related to syntactically invalid inputs in parsers ● Parser implementations do not always closely mirror format specifications ● Models take some time to be written by a human (and contains simplifications) 7 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  8. Problems ● Impossible if the input structure is unknown ● May fail to find bugs related to syntactically invalid inputs in parsers ● Parser implementations do not always closely mirror format specifications ● Models take some time to be written by a human (and contain simplifications) ● Wrong models make fuzzing ineffective 8 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  9. Solutions? ● Automatically learn the model from the actual implementation of the parser 9 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  10. Solutions? ● Automatically learn the model from the actual implementation of the parser ● Generate not always syntactically valid inputs 10 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  11. Solutions? ● Automatically learn the model from the actual implementation of the parser ○ (Approximation of) Taint Tracking ■ [Tupni] [Autogram] [Polyglot] [Grimoire] ○ Machine Learning ■ [Learn&Fuzz] [REINAM] ○ Oracle based ■ [GLADE] ● Generate not always syntactically valid inputs 11 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  12. Coverage-guided Fuzzing Coverage Corpus Input Program Mutation Under Test Crashes 12 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  13. Problems ● Fail to explore deep paths behind parsers 13 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  14. Problems ● Fail to explore deep paths behind parsers ● Affected by roadblocks (multi-byte comparisons, checksums, hashes, … ) if (hash(input[0:8]) != input[8:12]) exit(1) if (input[12:16] == 0xABADCAFE) bug() 14 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  15. Structured Fuzzing Corpus Coverage Input Program Input Mutation Under Test Format Model Crashes 15 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  16. Structured Fuzzing ● AFLSmart ● Nautilus ● Superion ● Libprotobuf-Mutator ● Zest ● ... 16 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  17. Bypass Roadblocks ● Concolic Fuzzing ○ [Driller] [QSYM] [Eclipser] ● (Approximation of) Taint Tracking ○ [TaintScope] [Vuzzer] [Angora] [Redqueen ] ● Sensitive feedbacks ○ [LAF-Intel] [CompareCoverage] [FuzzFactory] [IJON] 17 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  18. Bypass Roadblocks ● Concolic Fuzzing ○ [Driller] [QSYM] [Eclipser] ● (Approximation of) Taint Tracking ○ [TaintScope] [Vuzzer] [Angora] [Redqueen ] ● Sensitive feedbacks ○ [LAF-Intel] [CompareCoverage] [FuzzFactory] [IJON] 18 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  19. Idea #1 ● Reuse expensive analysis to bypass roadblocks previously explored in past works to enable Structure-aware mutations 19 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  20. Bypass Roadblocks [Redqueen] ● Mutations targeting magic byte comparisons (Input-To-State) 20 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  21. Bypass Roadblocks [Redqueen] ● Mutations targeting magic byte comparisons (Input-To-State) input: AAAABBBBCCCCBBBB cmp eax, FFFF → eax = BBBB 21 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  22. Bypass Roadblocks [Redqueen] ● Mutations targeting magic byte comparisons (Input-To-State) input: AAAABBBBDDCCDDCC (equivalent in coverage) cmp eax, FFFF → eax = BBBB 22 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  23. Bypass Roadblocks [Redqueen] ● Mutations targeting magic byte comparisons (Input-To-State) input: AAAABBBBDDCCDDCC (equivalent in coverage) cmp eax, FFFF → eax = BBBB new input: AAAAFFFFDDCCDDCC 23 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  24. Bypass Roadblocks [Redqueen] ● Mutations targeting magic byte comparisons (Input-To-State) ● Patch out checksum checks 24 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  25. Formats as an AST [Grimoire] + / 5 = 12 3 25 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  26. Not all formats are parsed into an AST 26 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  27. Comparisons for validation if (chunk->size_field > SIZE_MAX) error(“Invalid Chunk Size”); 27 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  28. Idea #2 ● Instead of using memory accesses to reconstruct the format ([Tupni] [Autogram]) use the comparisons instructions that are likely validation checks 28 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  29. Idea #3 ● Don’t learn a model and use it to guide the fuzzer, but reconstruct each time the structure and apply mutations. This avoids the problem of having errors in the learning process. 29 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  30. Weizz ● Based on AFL 2.52b ● Binary-only (QEMU) ● Approximate Taint to bypass Roadblocks and learn information about validation checks ● Structural mutations based on that information (inspired by [AFLSmart]) 30 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  31. Architecture 31 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  32. Architecture 32 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  33. Architecture 33 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  34. GetDeps: Approximating Taint Tracking Input: AAAABBBBCCCCDDDD cmp eax, FFFF → eax = AAAA 34 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  35. GetDeps: Approximating Taint Tracking Input: AAAABBBBCCCCDDDD cmp eax, FFFF → eax = AAAA Bitflip #1: BAAABBBBCCCCDDDD cmp eax, FFFF → eax = BAAA 35 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  36. Detect Checksum Checks ● One operand is I2S ● The other operand is not I2S and GetDeps revealed dependencies on some input bytes ● The sets of their byte dependencies are disjoint 36 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  37. Input Tags ● Comparison ID ● Timestamp ● Parent ID ● Number of tags with the same ID ● The Comparison ID of the inner checksum that guard this byte ● Flags (which CMP operand, if this is a checksum field, … ) 37 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  38. Many Comparisons affected by the same byte 1. Prioritize Checksum fields 38 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  39. Many Comparisons affected by the same byte 1. Prioritize Checksum fields 2. Prioritize comparisons appeared earlier in time (possible validation checks) 39 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  40. Many Comparisons affected by the same byte 1. Prioritize Checksum fields 2. Prioritize comparisons appeared earlier in time (possible validation checks) 3. Prioritize if the number of bytes influencing the comparison are low 40 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  41. Fixing Checksum ● Late-stage repair ● Topological Sort (Tags have the info for this) ● Unpatch false positives 41 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  42. Locating Fields 42 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  43. Locating Chunks struct { int type; int x , y; int cksm; }; 43 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  44. Locating Chunks struct { 1. Pick a tag type int type; int x , y; int cksm; }; 44 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

  45. Locating Chunks struct { 1. Pick a tag type int type; 2. Recurse if next Timestamp (ts) > current int x , y; int cksm; }; 45 WEIZZ: Automatic Grey-Box Fuzzing for Structured Binary Formats

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend