HexHive / ViDeZZo

ViDeZZo source code.
30 stars 4 forks source link

ViDeZZo: Dependency-aware Virtual Device Fuzzing Framework

ViDeZZo is a virtual device fuzzing framework considering both intra- and inter-message dependencies to balance fuzzing scalability and efficiency. The research paper was accepted by IEEE S&P 2023.

Currently, ViDeZZo supports libFuzzer in combination with ASAN and UBSAN.

Currently, ViDeZZo supports QEMU (6.1.50 and above) and VirtualBox (C++) covering Audio, Storage, Network, USB, and Graphics virtual devices, and covering i386, x86_64, ARM, and AArch64 builds.

A develop plan is as follows.

Part of virtual device code is not covered by ViDeZZo due to the lack of VM snapshot/migration and device plug in/out. Nevertheless, we do not have a plan to support them.

The usage of ViDeZZo is as follows.

Quick start

Step 1: build and enter the docker container

sudo docker build -t videzzo:latest .
sudo docker run --rm -it -v $PWD:/root/videzzo videzzo:latest /bin/bash

More adjustment is necessary for VirtualBox as VirtualBox would install its kernel modules into the host system.

sudo docker run --rm -it \
    -v /usr/src:/usr/src \
    -v /dev:/dev \
    -v /lib/modules:/lib/modules \
    --privileged \
    -v $PWD:/root/videzzo videzzo:latest \
    /bin/bash

We recommend running ViDeZZo in a docker container.

We also tested ViDeZZo on a native Ubuntu 20.04 host, espicailly for VirtualBox. Note that, testing VirtualBox virtual devices requires sudo or a root user.

Step 2: build and test QEMU and VirtualBox (artifact evaluation)

cd videzzo
make qemu qemu-coverage
make vbox vbox-coverage

make qemu compiles the latest QEMU with ASAN and UBSAN and make qemu-coverage compiles the latest QEMU with source code coverage profiling. For the fuzzing only, go to videzzo_qemu/out-san and run binary there. Use -detect_leaks=0 as we do not prefer small leakages. For the coverage collection, go to videzzo_qemu/out-cov and run binary there. This also applies to VirtualBox.

We develop scripts to make life easy. Let's say we want to fuzz QEMU ac97 for 60 second in pure fuzzing mode and coverage collection mode.

bash -x videzzo_tool/01-quick-san.sh qemu i386 ac97 60
bash -x videzzo_tool/04-quick-cov.sh qemu i386 ac97 60

Advanced usage - Crash-Resistant Mode

ViDeZZo has supported a built-in fork server that allows no stop if there is any crash. Enable it with VIDEZZO_FORK=1. Or use the scripts as follows. However, the performance deteriorates very much.

bash -x videzzo_tool/01-quick-san.sh qemu i386 ac97 60 fork
bash -x videzzo_tool/04-quick-cov.sh qemu i386 ac97 60 fork

LibFuzzer -jobs and -workers should be working automatically.

LIBFUZZER_ARGS="-jobs=2 -workers=2" \
bash -x videzzo_tool/01-quick-san.sh qemu i386 ac97 60 fork

fuzz-.log should be found in out-san.

Advanced usage - Fuzzing process

In practice, we fuzz QEMU and VirtualBox virtual devices as follows.

  1. Maintain ViDeZZo (ViDeZZo's Maintainer)
  1. Deploy ViDeZZo Locally (Security Analyst)
  1. Triage bugs (Security Analyst)

Q&A about the toolchain

With the command line in Step 1, the toolchain (clang-13) is automatically downloaded into the docker image. You can also build the toolchain yourself. In this way, you need to adjust the command lines a little bit.

sudo docker build --target base -t videzzo:latest .
sudo docker run --rm \
    -v $PWD/videzzo-llvm-project:/root/llvm-project \
    -e PATH=$PATH:/root/llvm-project/build-custom/bin \
    -v $PWD/videzzo:/root/videzzo \
    -v /usr/src:/usr/src \
    -v /dev:/dev \
    -v /lib/modules:/lib/modules \
    --privileged \
    -it videzzo:latest /bin/bash

Contribution

If any questions and ideas, please do not hesitate to raise an issue. A pull request is also welcome!