-
Install required software
sudo apt update && sudo apt install git m4 pkg-config autoconf libtool \ libssl-dev libmysqlclient-dev libcurl4-openssl-dev python apache2 \ mysql-server python-mysqldb haveged php libapache2-mod-php php-mysql \ php-xml-parser curl python-requests python-virtualenv unzip
- You will be asked to set a password for mysql root user
-
Get code
sudo mkdir /usr/local/killerbeez sudo chown $USER /usr/local/killerbeez sudo chmod a+rx /usr/local/killerbeez umask 0022 cd /usr/local/killerbeez git clone --recursive https://github.com/grimm-co/killerbeez.git
-
Build code
cd killerbeez/server/boinc ./_autosetup ./configure --disable-client --disable-manager make
-
User permissions
sudo useradd -m -s /bin/bash boincadm sudo usermod -a -G boincadm www-data sudo -u boincadm sh -c 'echo umask 0007 >> /home/boincadm/.bashrc' sudo sh -c 'echo umask 0007 >> /etc/apache2/envvars' sudo chgrp boincadm /usr/local/killerbeez sudo chmod g+w /usr/local/killerbeez
- Note: the new user doesn't have sudo access, so continue using your normal account for the remaining instructions except when indicated.
-
MySQL setup (make sure to select your own password)
mysql -u root -p mysql> CREATE USER 'killerbeez'@'localhost' IDENTIFIED BY '<password here>'; mysql> GRANT ALL ON killerbeez.* to 'killerbeez'@'localhost';
sudo sh -c 'echo sql_mode="ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" >> /etc/mysql/mysql.conf.d/mysqld.cnf' sudo systemctl restart mysql
-
Apache setup
sudo a2enmod cgi sudo systemctl restart apache2
-
Project setup (run as the boincadm user)
-
First, open a shell as the boincadm user for the rest of this step
sudo -i -u boincadm
-
Determine a URL that points to this server. If accessed in a browser, this URL should display the default Apache "It works!" page. If this will be a public instance, take a look at these guidelines.
export BOINC_URL=<this url>
-
Create the BOINC project for Killerbeez (using the passord from step 5 above)
cd /usr/local/killerbeez/killerbeez/server/boinc tools/make_project --url_base $BOINC_URL \ --db_user killerbeez --db_pass '<password here>' killerbeez
- Enter Y at the prompt.
-
Set up cron, load platforms into the database, and set a password to access the admin UI (admin username does not need to be boincadm)
cd ~/projects/killerbeez crontab killerbeez.cronjob bin/xadd htpasswd -c html/ops/.htpasswd <admin username>
-
Edit
html/project/project.inc
to set PROJECT and COPYRIGHT_HOLDER correctly -
Install killerbeez-specific files:
cp /usr/local/killerbeez/killerbeez/server/*.py bin cp -r /usr/local/killerbeez/killerbeez/server/skel .
-
We need the killerbeez binaries to run on the target system. Download the latest release for the target platform and place it in the
skel/<platform>
directory -
The Killerbeez fuzzer binary does not use the BOINC API, however BOINC has a wrapper which wraps an executable and deals with all the BOINC-specific stuff. This allows any application to be leveraged by BOINC. We need this wrapper program for all platforms which we intend to support. Extract the wrapper binary (or see the build instructions to build your own copy):
For 64-bit Windows:
unzip -j -d skel/windows_x86_64 skel/windows_x86_64/killerbeez-x64.zip \ '*wrapper_26014_windows_x86_64.exe'
For 64-bit Linux:
unzip -j -d skel/x86_64-pc-linux-gnu \ skel/x86_64-pc-linux-gnu/killerbeez-Linux.zip */wrapper
-
If you want to support MacOS, you will need to build the wrapper yourself, as the versions on the BOINC wiki are too old.
-
Enable the project
bin/start
-
Done running as boincadm
exit
-
-
Install Apache config for project
sudo cp /home/boincadm/projects/killerbeez/killerbeez.httpd.conf /etc/apache2/sites-available/killerbeez.conf sudo sed -i -e '/Order /d' -e 's/Deny from all/Require all denied/' \ -e 's/Allow from all/Require all granted/' \ /etc/apache2/sites-available/killerbeez.conf sudo a2ensite killerbeez sudo systemctl reload apache2
-
Start the Killerbeez API server
sudo -i -u boincadm cd /usr/local/killerbeez virtualenv -ppython3 killerbeez-venv source killerbeez-venv/bin/activate cd /usr/local/killerbeez/killerbeez/python/manager pip install -r requirements.txt python server.py -create # Remove -create if restarting server
This will start up the server on port 5000. In the instructions below, we will call the URL pointing to this port
$API_URL
.
Next we need to set up at least one client. Follow these instructions first, then the operating system specific instructions below. If there aren't any instructions for your operating system, you're on your own (when if you figure it out, we accept pull requests for improved documentation :-)).
- Create an account via BOINC webpage (
$BOINC_URL/killerbeez/create_account_form.php
)
- sudo apt install boinc-client
- Get an account key using:
boinccmd --lookup_account $BOINC_URL/killerbeez/ <email address> <password>
boinccmd --project_attach $BOINC_URL/killerbeez/ <account key>
Note: only Windows 10 x64 is currently supported
- Log into the BOINC webpage (
$BOINC_URL/killerbeez
) - GUI instructions to add project:
- Go to Project > Join on website
- If client not installed, install it
- Select "Add project" in GUI
- Enter project URL from webpage
- Enter email address and password of the account you registered in step 1
All administration of the BOINC server which is done from the command line
should be done as the "boincadm" user. You can use sudo -i -u boincadm
to
drop to an interactive shell with this user.
Killerbeez jobs have a "target", which represents a target program running on a certain platform. BOINC needs to be told about these targets, and the platforms they can run on. The add_target.py tool will create a BOINC "app" for each target/platform combination. These can be customized to install a new application, but the default configuration will allow fuzzing anything that is installed on client machines already, such as Windows Media Player.
- Create the target
A list of platforms (operating/cpu architecture) can be found on the BOINC Wiki.
```
cd ~/projects/killerbeez/
bin/add_target.py <target> <platform> [<platform> ...]
```
* Example: `bin/add_target.py wmp windows_x86_64`
-
If you need any additional files in this app, put them in the app dir (
apps/<target>_<platform>/1/<platform>
). At a minimum, you will probably want to put the executable there (unless the assumption is that it is already on the clients' computers). -
Add an entry for each added file to the
apps/<target>_<platform>/1/<platform>/version.xml
file, as in the following example:<file> <physical_name>myfile.exe</physical_name> <logical_name>myfile.exe</logical_name> <copy_file/> </file>
The physical name is the actual filename you added, while the logical name is the name it will be given on the client system.
<copy_file/>
ensures that the real file is placed at that name rather than a BOINC-specific "link" file. See the BOINC docs for more information on configuring your app. -
Finalize the app creation
bin/update_versions
-
If you need to make changes to your app, you can do so by creating a new app version. Keep in mind that BOINC files are immutable, so if you change a file you must also change its filename. The following is a good workflow:
- In the
apps/<target>_<platform>/<version>/<platform>
directory, change whatever files you need to update. - Add a version number to the names of updated files (e.g. myfile.zip.1 or myfile.1.exe)
- Edit
apps/<target>_<platform>/<version>/<platform>/version.xml
with the new physical names of all files. - Rename the whole
apps/<target>_<platform>/<version>
directory toapps/<target>_<platform>/<version+1>
. - Run
bin/update_versions
.
- In the
Supporting a new platform is kind of a big deal. If you want to take a stab at it, take a look at the files in the skel directory and the comments in add_target.py to get started. You will probably want to have the BOINC wiki loaded up, especially if you're not already familiar with how the implementation details of BOINC.
Customize the boinc_submit.py script for your desired job by changing the constants at the top, and the job parameters in the requests. The constants are:
PROJECT
- The URL for the Killerbeez API ($API_URL
)SEED
- A string to be used as the contents of the seed file
Run the script, and it will print out the ID of the submitted job.
The results of a job can be accessed via the killerbeez API. Let $JOB_ID
be the ID of the job of interest:
curl $API_URL/api/job/$JOB_ID/results
For example:
$ curl http://localhost:5000/api/job/37/results
[{"result_type": "crash", "repro_file": "3fb/38D1F16F84B07DBF6B29861BD7464ABA", "job_id": 37, "result_id": 1}, {"result_type": "crash", "repro_file": "235/97A596BE0B77EF1B6899503300B205FE", "job_id": 37, "result_id": 2}]
The output is a JSON list of all the job's results. Each result is a JSON object, in which the result_type describes why this result is interesting (crash? hang? new_path?), and the repro_file is the path of a file with the input that caused the crash, hang, or new path. To retrieve the crashing input:
curl $BOINC_URL/killerbeez/download/$repro_file
For example:
$ curl http://localhost:80/killerbeez/download/3fb/38D1F16F84B07DBF6B29861BD7464ABA
-215005474723783
You may be interested to know what seed file these results were mutated from. The path of the seed file is available in the job information:
curl $API_URL/api/job/$JOB_ID
For example:
$ curl http://localhost:5000/api/job/37
{"mutator": null, "end_time": null, "status": "completed", "input_ids": [], "instrumentation_type": null, "seed_file": "ab/jf_2f79d50c5c10004b755b4622555e99f5", "job_type": null, "mutator_state": null, "driver": null, "assign_time": null, "job_id": 37}
When jobs are submitted automatically, the seed file may be the result of some other job, in which case it's possible to find the job that produced it by searching results by repro_file:
curl $API_URL/api/results?repro_file=$repro_file
For example:
$ curl http://localhost:5000/api/results?repro_file=235/97A596BE0B77EF1B6899503300B205FE
[{"result_type": "crash", "repro_file": "235/97A596BE0B77EF1B6899503300B205FE", "job_id": 37, "result_id": 2}]
This gives you the job ID of the job that produced the file, allowing you to trace its ancestry.
This step is only needed if you are going to create an account that will submit jobs directly to BOINC (see next section). You do not need administrator access to submit jobs via the Killerbeez API server.
-
Administrator must register an account via BOINC webpage (
$BOINC_URL/killerbeez/create_account_form.php
) -
Log into site and go to Project > Account to find User ID
-
On server:
sudo -i -u boincadm cd ~/projects/killerbeez bin/manage_privileges grant <user id> all`
You only need to do this if you want to submit jobs directly to BOINC (most likely for testing). Submitting jobs via the Killerbeez API server does not require this. To perform these steps you must have administrator access (see previous section). However, as an administrator you can grant job submission privileges to any account, administrator or otherwise.
- Go to
$BOINC_URL/killerbeez/manage_project.php
- Click name of the user to grant privileges to
- Select "All apps"
- Click "Ok".
The BOINC wrapper is an adapter that lets programs be run unmodified under the BOINC client. Our usage of the wrapper requires features and bugfixes that are more recent than the last released wrapper binary. Our binary release inlcudes a compiled copy of the wrapper, as described above, but you can build your own with the following steps:
- On a Windows machine, install git and Visual Studio Community 2013
- Start Git Bash and clone the BOINC repository
- Open
win_build\boinc_vs2013.sln
from the cloned repo in Visual Studio 2013 - Click the
wrapper
project in the Solution Explorer - Select
x64
from the Platforms drop-down in the toolbar, andRelease
from the Configurations drop-down next to it. - From the
BUILD
menu, selectBuild wrapper
- The compiled binary should be in
win_build\Build\x64\Release\wrapper_26014_windows_x86_64.exe
- Drop this binary into the
/home/boincadm/projects/killerbeez/skel/windows_x86_64
directory on your killerbeez server