Skip to content

Commit 29b030b

Browse files
committed
Merge bitcoin/bitcoin#22585: fuzz: add guide to fuzzing with Eclipser v1.x
6e1150e fuzz: add guide to fuzzing with Eclipser v1.x (Alex Groce) Pull request description: MarcoFalke and practicalswift here's an Eclipser guide, reconstructed from their documentation and my docker history getting it up and running. It might be good if someone confirmed it actually works for them in a fresh ubuntu 20.04. ACKs for top commit: practicalswift: ACK 6e1150e Tree-SHA512: ca855932fd7a2c1d1005d572ab5fabc26f42d779f9baf279783f08a43dd72ec60f57239135d30c2a82781e593626fec2c96bb19fb91e1b777cef2d83a54eba35
2 parents 4e1de1f + 6e1150e commit 29b030b

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

0 commit comments

Comments
 (0)