Use CI-Fuzz on Windows with WSL

This article shows how to setup CI-Fuzz on Windows. In short, we will install the ci-daemon inside the WSL and will setup VS Code to communicate with it. In the end you will be able to use all the same features that are available in CI-Fuzz on Linux.

copy-installer-to-wsl

First, you need to install WSL 2 as described in the Windows 10 documentation. In this tutorial, we will use Ubuntu 20.04 as the Linux distribution running inside WSL 2.

Next, install Docker Desktop in Windows 10. In the installer select to install the required Windows components for WSL 2. This way the ci-daemon can use this docker installation as a backend and we don't need to install docker inside the WSL.windows-docker-installer

Next, install gdb inside WSL. It is needed to debug findings.

sudo apt install gdb

Now we will copy the CI-Fuzz installer to the WSL file system so that Ubuntu can use it. Since inside the WSL the Windows system drive "C" is automatically mounted at /mnt/c this is straighforward:

cp /mnt/c/<PATH_TO_INSTALLER> ~

copy-installer-to-wsl-1

Now run the installer. You can use the default installation directory. When asked if you want to install the Visual Studio Code extension select "no". We will run Visual Studio Code on Windows 10, outside the WSL. For this, we will install the extension later.

run-installer-in-wsl

Since we can not run the CI-Fuzz installer on Windows we will install the VS Code extension manually from the .vsix file. The installer places this file at /opt/ci-<VERSION>/share/code-intelligence/vscode-fuzzing-ui.vsix . Copy this file to the Windows 10 file system:

cp /opt/ci-<VERSION>/share/code-intelligence/vscode-fuzzing-ui.vsix /mnt/c/Users/<WIN-USERNAME>/Desktop

 

copy-vs-extension-to-windows

In VS Code go to the Extensions tab (Ctrl+Shift+X) and select "Install from VSIX..." in the "..." dropdown menu and select the vsix file from the previous step.

install-extension-from-vsix

Additionally, install the Remote WSL extension. This will allow VSCode to compile and run applications inside the WSL. You can easily install it from the Marketplace.

install-remote-wsl-ext

 

Now the installation is completed. To fuzz an application copy the project folder to the WSL file system by running

cp -r /mnt/c/Users/<WIN-USERNAME>/<PROJECT_FOLDER> ~

and then run

ci-daemon -v1 --alsologtostderr

inside WSL to start the ci-daemon.

Running the ci-daemon as root is not recommended since it can lead to problems when VS Code tries to connect to it. Furthermore, it is a good security practice to run software with the least privilege.

To open the project folder open VC Code and click the green button in the left bottom corner or press Ctrl+Shift+P and search for "Remote WSL".

Select "Open Folder in WSL".

open-folder-in-wsl

Now you can initialize the project, write and run fuzz tests and debug findings. CI-Fuzz on Windows 10 with WSL supports the same features as CI-Fuzz in Linux.

project-init

finding