Fuzz Week Day 1: An Intro
Channel: gamozolabs
Date: 19/07/2020

In this intro video we start off by writing a very simple Python-based fuzzer, followed by an early interruption power outage :(

Thanks Jimmy Jimbo for the timestamps:

0:00 Start
2:55 Welcome to Fuzz Week Day 1
3:20 Look at blog post
3:50 Winging it
4:20 Security Research is failing continuously
4:50 Assumptions of public fuzzing research 
6:44 Q: Can you keep the whole corpus in ram?
7:20 Overview of weekly schedule
7:50 Research papers vs state of modern fuzzing
9:50 Q: talk about libfuzzer?
10:30 Look at wikipedia's definition of Fuzzing
11:20 Gamozolabs defintion of Fuzzing
12:17 Look at simple example
12:50 Deciding what to fuzz
14:18 Decide on objdump in binutils
15:05 Attempting to build binutils
15:44 Q: are we going to cover Windows?
19:10 What if you can't run the binary or don't have a binary?
20:55 Q: Can we run objdump on objdump?
21:10 Discuss capabilities of objdump
21:55 Using objdump on itself
22:10 Deciding what do we want to fuzz on the target? Specifics
22:38 Does the situation allow us to reach a particular codepath?
24:17 Q: Intel vs AT&T assembly syntax? Intel FOREVER!!!!!!!!!!!!!!!!
26:10 Using bad flag to test if flags are being passed correctly to the build
26:30 Building objdump without optimizations and with DWARF version 2
26:40 Chat: AT&T assembly syntax dissent
29:56 Decide to write fuzzer that tries different options
30:25 Create objdump fuzzer
32:10 Removing non-elf files from corpus
33:00 Creating fuzz.py in python
33:20 Finding all files in corpus
34:01 Use glob to get listing of corpus files
34:40 Commenting on why we need a corpus and what we plan on using it for.
35:13 Loading the corpus into memory
35:59 We plan on first fuzzing the corpus without mutation 
36:20 Loading corpus files into a set and ignoring duplicates (symlinks, etc)
38:58 Chat: problem is most people often focus on optimizing
40:05 Talk about the need for thread safety in the fuzzer. Easier to build thread-safe from scratch vs building thread-safety into a existing codebase
40:35 Introduce the concept of a thread id
42:35 Test writing out corpus input into a temporary file
44:51 Attempt to run objdump with subprocess
46:05 Use popen function
46:20 Search for subprocess documentation
47:10 Add an assert to check for successful program return codes
48:14 Add objdump disassembly flag
48:54 Create loop that fuzzes a randomly selected corpus file 
49:50 Bottleneck on output. Piping objdump output to /dev/null
51:30 Print program status code for failure cases
51:59 Switching to different server
53:12 Understanding the performance of your fuzzer
53:30 Adding profiling timers to determine fuzzer peformance
54:04 Adding print statement for elapsed time of fuzz case and number of fuzz cases tested so far
54:35 Calculating fuzz cases per second
55:28 Adding multiple threads
55:40 Search documentation for python3 threading
56:20 Move loop into a function called "worker" so that we can run it in multiple threads
57:50 Add global counter to count number of total fuzz cases for all threads
58:42 Launch 192 fuzzing worker threads
59:10 Q: do you need a lock for "cases" variable?
59:33 Start mutating input
1:00:35 Change corpus from byte to bytearray
1:01:10 Explaination of fuzzer program so far
1:02:10 Testing objdump -x flag (all headers parsing)
1:02:25 Doesn't seem faster because of the performance limitations of python
1:02:50 Discussion of why this method of threaded fuzzing is not always applicable to all fuzzing targets. Concept of "live fuzzing".
1:04:47 Q: what would you use to measure perf on linux? 
1:05:20 Q: are you aware of web app fuzzing that isn't live fuzzing?
1:07:12 Bottlenecking on python
1:07:39 Rant: Academic papers who write fuzzers in python
1:09:22 Q: C++ vs Rust vs Go?
1:09:59 Q: What about garbage collectors don't you like?
1:10:40 Q: I thought modern C++ is memory safe?
1:11:37 Q: Will Rust kill low level security?
1:12:14 Q: How do you feel about global allocators having to handle allocating in one thread and deallocating in another. How do you feel about the mesh compacting allocator?
1:13:10 Chat: too much software has been written in C and C++
1:13:28 Chat: Mesh compacting allocator
1:14:00 Memory usage is a solvable problem with money!
1:14:26 Copy input corpus to mutate bytearray so we can mutate it
1:14:59 Start mutating corpus