forked from strongcourage/uafbench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCVE-2019-20633.sh
executable file
·33 lines (29 loc) · 1.2 KB
/
CVE-2019-20633.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
PUT="CVE-2019-20633"
runmode=$1
timeout=$2
targets=$3
# Checkout source code
git clone git://git.savannah.gnu.org/patch.git $PUT
cd $PUT; export SUBJECT=$PWD;
git checkout 76e7758
# Compile source code
./bootstrap; make distclean
rm -rf obj; mkdir obj; cd obj
CFLAGS="-g -m32" CXXFLAGS="-g -m32" ../configure --prefix=`pwd`
make clean; make
cd $SUBJECT; rm -rf obj-asan; mkdir obj-asan; cd obj-asan
CFLAGS="-g -m32 -fsanitize=address" CXXFLAGS="-g -m32 -fsanitize=address" ../configure --prefix=`pwd`
make clean; make
# Prepare working directories
cd $SUBJECT; rm -rf obj-$runmode; mkdir obj-$runmode; export FUZZ_DIR=$SUBJECT/obj-$runmode; cd $FUZZ_DIR
mkdir in; cp $UAFBENCH_PATH/seeds/$PUT/* in
# Fuzzing
if [ $runmode = "aflqemu" ]; then
cp $SUBJECT/obj/src/patch .
timeout -sHUP ${timeout}m $SCRIPTS/run_afl.py -f $FUZZ_DIR/patch -Q -i $FUZZ_DIR/in -o run -r "$FUZZ_DIR/patch -Rf" -to $timeout
elif [ $1 = "uafuzz" ]; then
cp $SUBJECT/obj/src/patch $PUT; cp $targets .
$UAFUZZ_PATH/scripts/preprocess.py -f $PUT -v $targets -o $FUZZ_DIR
$UAFUZZ_PATH/scripts/run_uafuzz.py -f $FUZZ_DIR/$PUT -M fuzz -i $FUZZ_DIR/in -o run -r "$FUZZ_DIR/$PUT -Rf" -I $runmode -T "$FUZZ_DIR/$PUT.tgt" -to $timeout
fi