Differential Fuzzing of Bitcoin implementations

Hi, all!

I’m working on differential fuzzing of Bitcoin implementations/libraries (GitHub - brunoerg/bitcoinfuzz: Differential Fuzzing of Bitcoin implementations and libraries). I’m starting it with miniscript, so at this moment it’s fuzzing Core’s and rust-miniscript.

I’m openning this topic to raise ideas and get feedbacks about it.

9 Likes

Nice, and it seems you’ve discovered something too (bug: `pk()()` is considered a valid policy · Issue #140 · sipa/miniscript · GitHub)!

1 Like

Yes, I got more crashes but I’m analyzing them before publishing them.

1 Like

Another crash has been discussed in rust-miniscript repo: bug: some miniscripts are being pointed as invalid, but are valid · Issue #633 · rust-bitcoin/rust-miniscript · GitHub

cc: @sipa

1 Like

One more bug found by it!

1 Like

Updates!

We recently added support for btcd and we discovered and could reproduce more bugs.


rust-miniscript: Some miniscripts were unexpectedly being rejected

rust-bitcoin: During witness verification, rust-bitcoin doesn’t check if a transaction has the witness flag but empty witnesses.

btcd: Not a bug but an API mismatch with Bitcoin Core. When decoding a transaction, Bitcoin Core fails if the input was not entirely consumed, btcd doesn’t.

Bitcoin Core/rust-miniscript: When validating miniscripts from string, there is an inconsistence between rust-miniscript and Bitcoin Core. We noticed that Bitcoin Core accepts the usage of the + sign, e.g. (l:older(+1) , u:after(+1) ), because of ParseInt64 function. However, rust-miniscript checks the character itself, so it only accepts “1”, “2”, “3”…“9”.

rust-miniscript: The parser function is still recursive while Core isn’t anymore. It makes some miniscripts valid for Core but rejected by rust-miniscript due to the max recursion depth. (We didn’t find this, we just could reproduce by running the harness with the seed corpus from Core)

4 Likes