Skip to content

Commit 6e1150e

Browse files
committed
fuzz: add guide to fuzzing with Eclipser v1.x
1 parent d235700 commit 6e1150e

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

doc/fuzzing.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,73 @@ $ honggfuzz/honggfuzz --exit_upon_crash --quiet --timeout 4 -n 1 -Q \
247247
-debug
248248
```
249249
250+
# Fuzzing Bitcoin Core using Eclipser (v1.x)
251+
252+
## Quickstart guide
253+
254+
To quickly get started fuzzing Bitcoin Core using [Eclipser v1.x](https://github.com/SoftSec-KAIST/Eclipser/tree/v1.x):
255+
256+
```sh
257+
$ git clone https://github.com/bitcoin/bitcoin
258+
$ cd bitcoin/
259+
$ sudo vim /etc/apt/sources.list # Uncomment the lines starting with 'deb-src'.
260+
$ sudo apt-get update
261+
$ sudo apt-get build-dep qemu
262+
$ sudo apt-get install libtool libtool-bin wget automake autoconf bison gdb
263+
```
264+
265+
At this point, you must install the .NET core. The process differs, depending on your Linux distribution.
266+
See [this link](https://docs.microsoft.com/en-us/dotnet/core/install/linux) for details.
267+
On ubuntu 20.04, the following should work:
268+
269+
```sh
270+
$ wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
271+
$ sudo dpkg -i packages-microsoft-prod.deb
272+
$ rm packages-microsoft-prod.deb
273+
$ sudo apt-get update
274+
$ sudo apt-get install -y dotnet-sdk-2.1
275+
```
276+
277+
You will also want to make sure Python is installed as `python` for the Eclipser install to succeed.
278+
279+
```sh
280+
$ git clone https://github.com/SoftSec-KAIST/Eclipser.git
281+
$ cd Eclipser
282+
$ git checkout v1.x
283+
$ make
284+
$ cd ..
285+
$ ./autogen.sh
286+
$ ./configure --enable-fuzz
287+
$ make
288+
$ mkdir -p outputs/
289+
$ FUZZ=bech32 dotnet Eclipser/build/Eclipser.dll fuzz -p src/test/fuzz/fuzz -t 36000 -o outputs --src stdin
290+
```
291+
292+
This will perform 10 hours of fuzzing.
293+
294+
To make further use of the inputs generated by Eclipser, you
295+
must first decode them:
296+
297+
```sh
298+
$ dotnet Eclipser/build/Eclipser.dll decode -i outputs/testcase -o decoded_outputs
299+
```
300+
This will place raw inputs in the directory `decoded_outputs/decoded_stdins`. Crashes are in the `outputs/crashes` directory, and must
301+
be decoded in the same way.
302+
303+
Fuzzing with Eclipser will likely be much more effective if using an existing corpus:
304+
305+
```sh
306+
$ git clone https://github.com/bitcoin-core/qa-assets
307+
$ FUZZ=bech32 dotnet Eclipser/build/Eclipser.dll fuzz -p src/test/fuzz/fuzz -t 36000 -i qa-assets/fuzz_seed_corpus/bech32 outputs --src stdin
308+
```
309+
310+
Note that fuzzing with Eclipser on certain targets (those that create 'full nodes', e.g. `process_message*`) will,
311+
for now, slowly fill `/tmp/` with improperly cleaned-up files, which will cause spurious crashes.
312+
See [this proposed patch](https://github.com/bitcoin/bitcoin/pull/22472) for more information.
313+
314+
Read the [Eclipser documentation for v1.x](https://github.com/SoftSec-KAIST/Eclipser/tree/v1.x) for more details on using Eclipser.
315+
316+
250317
# OSS-Fuzz
251318
252319
Bitcoin Core participates in Google's [OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/bitcoin-core)

0 commit comments

Comments
 (0)