ebpf

Buzzer(eBPF fuzzer) build

tr4ce 2023. 8. 11. 13:41
반응형

-reference-

https://github.com/google/buzzer

 

GitHub - google/buzzer

Contribute to google/buzzer development by creating an account on GitHub.

github.com

 

 

 

1. Install bazel

https://bazel.build/install/ubuntu?hl=ko 

 

Ubuntu에 Bazel 설치

날짜 비워 두기: BazelCon 2023이 10월 24~25일에 Google 뮌헨에서 열립니다. 등록이 시작되었습니다. 자세히 알아보기 이 페이지는 Cloud Translation API를 통해 번역되었습니다. Switch to English Ubuntu에 Bazel 설

bazel.build

2. Install clang & dependency

sudo apt install default-jdk
sudo apt install bc bison flex build-essential
sudo apt install cmake clang llvm
sudo apt install g++ g++-12

● Trouble shooting

if you encounter such as these errors you should check that you installed all of dependencies

3. Set env

export CC=clang
export CXX=clang++

4. Git clone repository

git clone https://github.com/google/buzzer
cd buzzer
bazel build :buzzer

5. Run buzzer as a root with CAP_BPF

sudo setcap CAP_BPF=eip bazel-bin/buzzer_/buzzer
./bazel-bin/buzzer_/buzzer

if you want to check log, view /tmp directory

 

6. Run with coverage

mkdir image

cd image

wget https://github.com/google/syzkaller/blob/master/tools/create-image.sh -o create-image.sh

chmod +x create-image.sh

./create-image.sh

If you want to customize your .img , check ref below

https://github.com/google/syzkaller/blob/master/tools/create-image.sh

 

 

7. Make boot_buzzer.sh in ~/ directory

qemu-system-x86_64 \
        -m 24G \
        -smp 12 \
        -cpu host \
        -kernel /home/username/linux-repository/arch/x86/boot/bzImage \
        -append "comsole=ttyS0 root=/dev/sda nokaslr earlyprintk=serial net.ifnames=0" \
        -drive file=/home/username/image/bullseye.img,format=raw\
        -net user,host=10.0.2.10,hostfwd=tcp:127.0.0.1:10022-:22\
        -enable-kvm \
        -nographic \
        -pidfile vm.pid \
        2>&1 | tee vm.log

If you have error about portfowarding, check your ports.

netstat -tnlp 

sudo fuser -k 8080/tcp

sudo kill -9 pid

 

8. Run .sh file

sudo -s ./boot_buzzer.sh

now you can see "syzkaller login: "

login with root

9. Send files with command "scp"

 

Before sending data, I Permitted to login with root

-ref-

https://www.leafcats.com/176

 

ssh-keygen -r 127.0.0.1
ssh-keygen -f "/home/username/.ssh/known_hosts" -R "[localhost]:10022"

 

Come back to host pc & send vmlinux

mkdir sourcefiles
cd sourcefiles

- For verifier.c and other files

After, you can see the file

10. Run buzzer

Send buzzer to syzkaller

Run on Qemu

HAPPY FUZZING!!!

 

cf. run buzzer on local

반응형