Skip to content

Commit

Permalink
Add fuzzing using afl++
Browse files Browse the repository at this point in the history
  • Loading branch information
jobol committed Oct 30, 2023
1 parent 5be08f7 commit 80c7b6b
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
afl-build
.vscode
site/
pdfs/
Expand Down
3 changes: 3 additions & 0 deletions afl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OUTPUTS
DATA

8 changes: 8 additions & 0 deletions afl/INPUTS/t1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#simple test
id jojo
path DATA/file0 default
permission perm
install
uninstall
display
clear
18 changes: 18 additions & 0 deletions afl/INPUTS/t2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
id j
id jojo
clear
id jojo
path DATA/file0 default
path DATA/file1 conf
path DATA/file2 data
path DATA/file3 exec
path DATA/file4 http
path DATA/file5 icon
path DATA/file6 id
path DATA/file7 lib
path DATA/file8 public
path DATA/dir1 plug
install
uninstall
display
clear
1 change: 1 addition & 0 deletions afl/INPUTS/t3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
path DATA/file2
37 changes: 37 additions & 0 deletions fuzz.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

rootdir=$(realpath $(dirname $0))
builddir=$rootdir/afl-build
afldir=$rootdir/afl

export AFL_USE_ASAN=1
#export AFL_USE_MSAN=1
export AFL_USE_UBSAN=1
export AFL_USE_CFISAN=1
#export AFL_USE_TSAN=1
export AFL_USE_LSAN=1

mkdir -p $builddir
cd $builddir || exit 1

cmake .. \
-DCMAKE_C_COMPILER=afl-cc \
-DWITH_SYSTEMD=ON \
-DWITH_SMACK=ON \
-DWITH_SELINUX=ON \
-DSIMULATE_CYNAGORA=ON \
-DSIMULATE_SMACK=ON \
-DSIMULATE_SELINUX=ON \
-DFORTIFY=ON \
-DCOMPILE_TEST=ON \
-DDEBUG=ON

make

cd $afldir

prog=$builddir/src/tests/slmc-test-simcyn-simsma
#prog=$builddir/src/tests/slmc-test-simcyn-simsel

afl-fuzz -i INPUTS -o OUTPUTS -- $prog

0 comments on commit 80c7b6b

Please sign in to comment.