• Stars
    star
    248
  • Rank 163,560 (Top 4 %)
  • Language
    Python
  • Created over 6 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

T-Fuzz

T-Fuzz consists of 2 components:

  • Fuzzing tool (TFuzz): a fuzzing tool based on program transformation
  • Crash Analyzer (CrashAnalyzer): a tool that verifies whether crashes found transformed programs are true bugs in the original program or not (coming soon).

OS support

The current version is tested only on Ubuntu-16.04, while trying to run the code, please use our tested OS.

Prerequisite

T-Fuzz system is built on several opensource tools.

Installing radare2

$ git clone https://github.com/radare/radare2.git
$ cd radare2
$ ./sys/install.sh

Installing python libraries

installing some dependent libraries

Note: to use apt-get build-dep, you need to uncomment the deb-src lines in your apt source file (/etc/apt/sources.list) and run apt-get update.

$ sudo apt-get install build-essential gcc-multilib libtool automake autoconf bison debootstrap debian-archive-keyring
$ sudo apt-get build-dep qemu-system
$ sudo apt-get install libacl1-dev

installing pip and setting up virtualenv & wrapper

$ sudo apt-get install python-pip python-virtualenv
$ pip install virtualenvwrapper

Add the following lines to your shell rc file (~/.bashrc or ~/.zshrc).

export WORKON_HOME=$HOME/.virtual_envs
source /usr/local/bin/virtualenvwrapper.sh

Creating a python virtual environment

$ mkvirtualenv tfuzz-env

Installing dependent libraries

This command will install all the dependent python libraries for you.

$ workon tfuzz-env
$ pip install -r req.txt

Fuzzing target programs with T-Fuzz

$ ./TFuzz  --program  <path_to_target_program> --work_dir <work_dir> --target_opts <target_opts>

Where

  • <path_to_target_program>: the path to the target program to fuzz
  • <work_dir>: the directory to save the results
  • <target_opts>: the options to pass to the target program, like AFL, use @@ as placeholder for files to mutate.

Examples

  1. Fuzzing base64 with T-Fuzz
$ ./TFuzz  --program  target_programs/base64  --work_dir workdir_base64 --target_opts "-d @@"
  1. Fuzzing uniq with T-Fuzz
$ ./TFuzz  --program  target_programs/uniq  --work_dir workdir_uniq --target_opts "@@"
  1. Fuzzing md5sum with T-Fuzz
$ ./TFuzz  --program  target_programs/md5sum  --work_dir workdir_md5sum --target_opts "-c @@"
  1. Fuzzing who with T-Fuzz
$ ./TFuzz  --program  target_programs/who  --work_dir workdir_who --target_opts "@@"

Using CrashAnalyzer to verify crashes

T-Fuzz CrashAnalyzer has been put in a docker image, however, it is still not working in all binaries we tested, we are still investigating it the cause.

Here is how:

Run the following command to run our docker image

$ [sudo] docker pull tfuzz/tfuzz-test
$ [sudo] docker run  --security-opt seccomp:unconfined -it tfuzz/tfuzz-test  /usr/bin/zsh 

In the container:

There are 3 directories:

  • release: contains code the built lava binaries
  • results: contains some results we found in lava-m dataset
  • radare2: it is a program used by T-Fuzz.

Currently, T-Fuzz may not work, because the tracer crashes accidentally. And the CrashAnalyzer can not work on all results. But some cases can be recovered.

For example:

To verify bugs in base64, first goto release and checkout ca_base64:

$ cd release
$ git checkout ca_base64

Then we use a transformed program to recover the crash in the original program:

  1. Choose a transformed program and run it on the input found by a fuzzer:
$ cd ~
$./results/ca_base64/554/base64_tfuzz_28/base64_tfuzz_28 -d ./results/ca_base64/554/crashing_inputs_from/results_saved_0_from 
[1]    131 segmentation fault (core dumped)  ./results/ca_base64/554/base64_tfuzz_28/base64_tfuzz_28 -d
  1. Recover an input from this transformed program and crashing input
$ ./release/CrashAnalyzer  --tprogram ./results/ca_base64/554/base64_tfuzz_28/base64_tfuzz_28 --target_opts "-d @@" --crash_input ./results/ca_base64/554/crashing_inputs_from/results_saved_0_from --result_dir base64_result --save_to recover
WARNING | 2018-12-04 04:28:22,350 | angr.analyses.disassembly_utils | Your verison of capstone does not support MIPS instruction groups.
Trying /root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from
WARNING | 2018-12-04 04:28:23,228 | angr.project | Address is already hooked, during hook(0x9021cd0, <SimProcedure ReturnUnconstrained>). Re-hooking.
WARNING | 2018-12-04 04:28:23,228 | angr.project | Address is already hooked, during hook(0x90dd000, <SimProcedure ReturnUnconstrained>). Re-hooking.
WARNING | 2018-12-04 04:28:23,229 | angr.simos.linux | Tracer has been heavily tested only for CGC. If you find it buggy for Linux binaries, we are sorry!
Adding <Bool Or(((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_0_0_8 >= 65) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_0_0_8 <= 90)), ((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_0_0_8 >= 97) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_0_0_8 <= 122)), ((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_0_0_8 >= 48) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_0_0_8 <= 57)), (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_0_0_8 == 43), (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_0_0_8 == 47))>
Adding <Bool Or(((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_1_1_8 >= 65) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_1_1_8 <= 90)), ((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_1_1_8 >= 97) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_1_1_8 <= 122)), ((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_1_1_8 >= 48) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_1_1_8 <= 57)), (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_1_1_8 == 43), (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_1_1_8 == 47))>
Adding <Bool Or(((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_2_2_8 >= 65) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_2_2_8 <= 90)), ((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_2_2_8 >= 97) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_2_2_8 <= 122)), ((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_2_2_8 >= 48) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_2_2_8 <= 57)), (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_2_2_8 == 43), (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_2_2_8 == 47))>
Adding <Bool Or(((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_3_3_8 >= 65) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_3_3_8 <= 90)), ((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_3_3_8 >= 97) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_3_3_8 <= 122)), ((file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_3_3_8 >= 48) && (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_3_3_8 <= 57)), (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_3_3_8 == 43), (file_/root/results/ca_base64/554/crashing_inputs_from/results_saved_0_from_9_3_3_8 == 47))>
results saved to /root/base64_result/recover_0

Then /root/base64_result/recover_0 is generated, we can use it to trigger a crash in the original program.

  1. verify the input by running the generated input on the original program
$ ./results/base64 -d base64_result/recover_0 
Successfully triggered bug 554, crashing now!
Successfully triggered bug 554, crashing now!
Successfully triggered bug 554, crashing now!
[1]    177 segmentation fault (core dumped)  ./results/base64 -d base64_result/recover_0

More Repositories

1

retrowrite

RetroWrite -- Retrofitting compiler passes through binary rewriting
Python
669
star
2

printbf

Brainfuck interpreter inside printf
Brainfuck
609
star
3

FuzzGen

C++
295
star
4

magma

A ground-truth fuzzing benchmark suite based on real programs with real bugs.
HTML
287
star
5

BOPC

Block Oriented Programming -- Compiler
Python
180
star
6

thesis_template

Template for EPFL (BSc, MSc, or doctoral) theses and semester projects
TeX
123
star
7

FuZZan

FuZZan: Efficient Sanitizer Metadata Design for Fuzzing
C++
119
star
8

malWASH

C++
112
star
9

datAFLow

A data-flow-guided fuzzer
Faust
111
star
10

USBFuzz

A Framework for fuzzing USB Drivers by Device Emulation
C
109
star
11

HexType

HexType: Efficient Detection of Type Confusion Errors for C++
C++
100
star
12

FishFuzz

AFL/AFL++ version FishFuzz
C
86
star
13

FirmFuzz

Automated IoT firmware fuzzing framework.
C
76
star
14

SMoTherSpectre

Proof-of-concept code for the SMoTherSpectre exploit.
C
73
star
15

Igor

C
70
star
16

Gramatron

Coverage-guided grammar aware fuzzer that uses grammar automatons
C
63
star
17

libdetox

Fast and efficient binary translator
C
58
star
18

Evocatio

C
55
star
19

memTrace

memTrace, a framework for lightweight memory tracing
C
54
star
20

fuzzing-seed-selection

"Seed Selection for Successful Fuzzing" artifact (at ISSTA 2021)
C++
41
star
21

HexPADS

HexPADS, a host-based, Performance-counter-based Attack Detection System
C
39
star
22

ShadowStack

LLVM Implementation of different ShadowStack schemes for x86_64
C++
37
star
23

RetroWrite-Tutorial

C
37
star
24

GLeeFuzz

LLVM
35
star
25

EPOXY

Root Repo for the EPOXY tool that applies Privilege Overlays on bare-metal systems
C
32
star
26

OSTEP-slides

Makefile
31
star
27

ViDeZZo

ViDeZZo source code.
C
30
star
28

scudo-exploitation

Python
29
star
29

CFIXX

C++
27
star
30

SieveFuzz

Optimizing Directed Fuzzing via Target-tailored Program State Restriction
C
27
star
31

pubstats

Python
26
star
32

teezz-fuzzer

22
star
33

mitiGate

Benchmark to test different stop the exploit mitigations
C
18
star
34

HyperPill

C++
18
star
35

datashield

C++
17
star
36

HexVASAN

C++
16
star
37

AutoBib

AutoBib: create beautiful bib files and html publication pages automagically
Python
14
star
38

Tango

Tango: Extracting Higher-Order Feedback through State Inference
Python
13
star
39

GlobalConfusion

TrustZone Trusted Application 0-Days by Design
C
12
star
40

specrop

Code repository for experiments in SpecROP paper
C
11
star
41

WarpAttack

JavaScript
11
star
42

hexhive.github.io

HexHive homepage
HTML
10
star
43

nesCheck

C++
9
star
44

SyzRisk

Official repository of SyzRisk [ASIA CCS'24]
Go
9
star
45

Crystallizer

A hybrid analysis framework to aid in uncovering deserialization vulnerabilities
Java
9
star
46

retrowrite-dev

Retrowrite Development (Internal) Repository
7
star
47

SURGEON

Performant, flexible, and accurate re-hosting via transplantation
C
7
star
48

EL3XIR

Fuzzing Secure Monitor Implementations
C
6
star
49

EPOXY-llvm

Fork of LLVM for used to create EPOXY
C++
6
star
50

dis-cover

Disassemble binaries and recover as much info as possible
Python
6
star
51

specrop-public

Code repository for experiments in SpecROP paper
C
6
star
52

midas

Systematic Kernel TOCTTOU Protection
C
6
star
53

IOVFI

An accurate and resilient semantic function identifier
Python
6
star
54

simple_attacks

A set of simple buggy programs with corresponding exploits and simple shellcode
C
6
star
55

spill_the_tea

Python
5
star
56

halucinator-tutorial

Tutorial for HALucinator
C
5
star
57

teezz-ca-driver

C
5
star
58

CUP

5
star
59

teezz-caid

TEEzz's Client Application Identification
Python
4
star
60

EPOXY-clang

Fork of Clang used to create EPOXY
C++
4
star
61

adaptSTM

adaptSTM, a competitive, word-based STM library that is based on a global clock and an array of combined global versions (timestamps) and locks.
C
4
star
62

GAENScan

Java
3
star
63

dis-cover-packages-analysis

Debian C++ packages analysis with the dis-cover tool
Jupyter Notebook
3
star
64

teezz-fuzzing-engine

Python
3
star
65

BLURtooth

2
star
66

WOOT21

HTML
2
star
67

teezz-introspection

C++
2
star
68

seccell-seL4

The seL4 microkernel
C
2
star
69

se-valgrind

C
2
star
70

dimva24

HTML
2
star
71

dibartolomeo-msthesis

Luca Di Bartolomeo's master thesis
TeX
1
star
72

security-group.epfl.ch

HTML
1
star
73

teezz-adb

Python adb wrapper.
Python
1
star
74

seccell-riscv-binutils-gdb

C
1
star
75

seccell-riscv-gnu-toolchain

GNU toolchain for RISC-V, including GCC
C
1
star
76

Ancile

C++
1
star
77

securecells

SecureCells website repository
1
star
78

Igor-evaluations

1
star
79

seccell-seL4_libseccells

Userspace library for SecCells-specific functionality
C
1
star
80

seccell-opensbi

C
1
star
81

seccell-sel4-playground

A project based on the seL4 microkernel to implement and test new functionality based on the SecCells architecture
C
1
star
82

seccell-qemu

C
1
star
83

seccell-memcache

In-memory cache
C
1
star
84

virtfuzz-bugs

C
1
star
85

seccell-browser

C
1
star
86

JournalBot

Python
1
star
87

seccell-archtests

Testing basic architectural functionality for SecureCells
C
1
star