Page MenuHomePhabricator

Merge #13452: rpc: have verifytxoutproof check the number of txns in proof structure
ClosedPublic

Authored by markblundeberg on Jul 1 2019, 02:05.

Details

Summary

PR13452 backport https://github.com/bitcoin/bitcoin/pull/13452/files
d280617bf569f84457eaea546541dc74c67cd1e4 [qa] Add a test for merkle proof malleation (Suhas Daftuar)
ed82f1700006830b6fe34572b66245c1487ccd29 have verifytxoutproof check the number of txns in proof structure (Gregory Sanders)

Pull request description:

Recent publication of a weakness in Bitcoin's merkle tree construction demonstrates many SPV applications vulnerable to an expensive to pull off yet still plausible attack: https://bitslog.wordpress.com/2018/06/09/leaf-node-weakness-in-bitcoin-merkle-tree-design/

This change would at least allow `verifytxoutproof` to properly validate that the proof matches a known block, with known number of transactions any time after the full block is processed. This should neuter the attack entirely.

The negative is that a header-only processed block/future syncing mode would cause this to fail until the node has imported the data required.

related: #13451

`importprunedfunds` needs this check as well. Can expand it to cover this if people like the idea.
Test Plan

make check
test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien added inline comments.
test/functional/test_framework/messages.py
753 ↗(On Diff #9831)

Nit: spaces around the // operator.

This revision is now accepted and ready to land.Jul 1 2019, 09:42