The BlockTransactions deserialization code is reachable with tainted data via ProcessMessage(…, "BLOCKTXN", vRecv [tainted], …).
The same thing applies to BlockTransactionsRequest which is reachable via "GETBLOCKTXN".
The BlockTransactions deserialization code is reachable with tainted data via ProcessMessage(…, "BLOCKTXN", vRecv [tainted], …).
The same thing applies to BlockTransactionsRequest which is reachable via "GETBLOCKTXN".
@TheBlueMatt Good point! Adding also CBlockHeaderAndShortTxIDs was my original intention, but when doing so I encountered a long chain of linking errors which I was unable to fully resolve.
More specifically I didn’t manage to create a test_test_bitcoin_fuzzy_LDADD variable (in src/Makefile.test.include) which would allow test_bitcoin_fuzzy to be built cleanly with this patch applied:
0diff --git a/src/test/test_bitcoin_fuzzy.cpp b/src/test/test_bitcoin_fuzzy.cpp
1index 7b52ac9..173351f 100644
2--- a/src/test/test_bitcoin_fuzzy.cpp
3+++ b/src/test/test_bitcoin_fuzzy.cpp
4@@ -48,6 +48,7 @@ enum TEST_ID {
5 CTXOUTCOMPRESSOR_DESERIALIZE,
6 BLOCKTRANSACTIONS_DESERIALIZE,
7 BLOCKTRANSACTIONSREQUEST_DESERIALIZE,
8+ CBLOCKHEADERANDSHORTTXIDS_DESERIALIZE,
9 TEST_ID_END
10 };
11
12@@ -273,6 +274,16 @@ int main(int argc, char **argv)
13
14 break;
15 }
16+ case CBLOCKHEADERANDSHORTTXIDS_DESERIALIZE:
17+ {
18+ try
19+ {
20+ CBlockHeaderAndShortTxIDs bhastids;
21+ ds >> bhastids;
22+ } catch (const std::ios_base::failure& e) {return 0;}
23+
24+ break;
25+ }
26 default:
27 return 0;
28 }
Help with solving this would be appreciated!
CBlockHeaderAndShortTxIDs has been added as part of this PR! :-)
CBlockHeaderAndShortTxIDs deserialization commit. Couldn’t create a proper test_test_bitcoin_fuzzy_LDADD in src/Makefile.test.include that would allow test_test_bitcoin_fuzzy to compile cleanly under all configuration options.
Finally managed to make the version including fuzzing of CBlockHeaderAndShortTxIDs to compile cleanly under all configuration options.
This PR should be ready for review now :-)
@laanwj Thanks for merging the libFuzzer support (#10440) today!
This is a friendly ping about my only currently outstanding fuzzing PR.
It adds fuzzing of the remaining deserialization code that is reachable with tainted data via ProcessMessage(…, "…", vRecv [tainted], …) but not currently covered by test_bitcoin_fuzzy. More specifically it adds fuzzing of the deserialization code for BlockTransactions, BlockTransactionsRequest and CBlockHeaderAndShortTxIDs.
Do you think it might be getting ready for merge?
When this PR is merged I’ll look into having command-line argument determine the type of fuzzer as suggested in #11045.
Seems like I’m unable to create a correct Makefile.test.include for this. Anyone willing to help me resolve that issue? :-)
If not I’ll probably remove the CBlockHeaderAndShortTxIDs part of this PR to avoid the linking dependency order nightmare :-)
Changed PR to only cover BlockTransactions and BlockTransactionsRequest. Hence no extra linking.
This one should be ready for merge :-)
practicalswift
sipa
TheBlueMatt
laanwj
Labels
Tests