-
Notifications
You must be signed in to change notification settings - Fork 38.8k
doc: Add instructions on how to fuzz the P2P layer using Honggfuzz NetDriver #20380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Concept ACK - will be sure to try this out. |
Crypt-iQ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently testing on my macOS.
Keep getting the following warning line, but seems that coverage still increases:
[2020-11-21T17:11:06-0500][W][91981] netDriver_bindToRndLoopback():143 Could not bind to a random IPv4 Loopback address: Can't assign requested address
|
@Crypt-iQ I don't have any Mac to test on, so I'm afraid I cannot help much. Could you add an assertion in Do you have any Linux machine to test under? :) |
|
Testing on an Ubuntu machine now. |
|
With this method of fuzzing, I think honggfuzz has to guess the handshake by picking multiple correct inputs/messages? |
|
@Crypt-iQ That is correct (unless we bypass the handshake logic by manually patching it out too)! However, my experience is that Honggfuzz quickly figures that out and achieves meaningful coverage post-handshake. Is that your experience as well? :) |
|
Are crashes reproducible? I guess they might happen to, but generally might require all seeds that have been sent in the past? |
|
Theoretically both types of issues are certainly possible: reproducible (single input enough to trigger condition) and "non-reproducible" (in this context: single input + previous inputs needed to trigger condition). Practically: If this fuzzer hits any issues my guess is that such issues will be reproducible with high probability. That has been the case historically with issues uncovered by Does that answer your question? :) |
|
The reason is that process_messages sends all messages in one input/seed. This one might split them into multiple seeds. |
|
@MarcoFalke I'm not sure I follow TBH. In the case of HonggFuzz NetDriver each input is handled as if it was a new incoming TCP connection, and each input can contain multiple messages (Bitcoin P2P messages). The TCP connection is not re-used across inputs if that is what you meant :) |
|
Reports a signed integer overflow here: bitcoin/src/net_processing.cpp Line 2651 in 16b784d
|
3ddbf22 util: Disallow negative mocktime (MarcoFalke) f5f2f97 net: Avoid UBSan warning in ProcessMessage(...) (practicalswift) Pull request description: Avoid UBSan warning in `ProcessMessage(...)`. Context: bitcoin/bitcoin#20380 (comment) (thanks Crypt-iQ!) ACKs for top commit: MarcoFalke: re-ACK 3ddbf22 only change is adding patch written by me ajtowns: ACK 3ddbf22 -- code review only Tree-SHA512: e8d7af0457ca86872b75a4e406c0a93aafd841c2962e244e147e748cc7ca118c56be0fdafe53765f4b291410030b2c3cc8f76f733b37a955d34fc885ab6037b9
|
Given @Crypt-iQ's finding above the value of having Honggfuzz NetDriver in the fuzzing toolbox has been proven empirically I guess :) Is there anything left to do for this documentation only PR? |
…er using Honggfuzz NetDriver fd0be92 doc: Add instructions on how to fuzz the P2P layer using Honggfuzz NetDriver (practicalswift) Pull request description: Add instructions on how to fuzz the P2P layer using [Honggfuzz NetDriver](http://blog.swiecki.net/2018/01/fuzzing-tcp-servers.html). Honggfuzz NetDriver allows for very easy fuzzing of TCP servers such as Bitcoin Core without having to write any custom fuzzing harness. The `bitcoind` server process is largely fuzzed without modification. This makes the fuzzing highly realistic: a bug reachable by the fuzzer is likely also remotely triggerable by an untrusted peer. Top commit has no ACKs. Tree-SHA512: 9e98cb30f00664c00c8ff9fd224ff9822bff3fd849652172df48dbaeade1dd1a5fc67ae53203f1966a1d4210671b35656009a2d8b84affccf3ddf1fd86124f6e
|
I had to comment out the following line before building honggfuzz as otherwise it would stop on my 2015 macbook Arch Linux citing slow execution. Could be the age of my computer though. I bumped the timeout as some of the seeds took >4 seconds, and could not use multiple threads due to a lock on the data directory. |
|
Sorry to gravedig, but I found out why honggfuzz can't get past the version-verack handshake on my machine. Compiling with honggfuzz and |
|
@Crypt-iQ Could using a dictionary file containing the commands help overcome that fuzzing hurdle? |
Add instructions on how to fuzz the P2P layer using Honggfuzz NetDriver.
Honggfuzz NetDriver allows for very easy fuzzing of TCP servers such as Bitcoin Core without having to write any custom fuzzing harness. The
bitcoindserver process is largely fuzzed without modification.This makes the fuzzing highly realistic: a bug reachable by the fuzzer is likely also remotely triggerable by an untrusted peer.