Skip to content

Latest commit

 

History

History
28 lines (16 loc) · 1.2 KB

5_AttackVectors.md

File metadata and controls

28 lines (16 loc) · 1.2 KB

Attack Vectors

Second Pre-Image Attack

Can we prove that an intermediary-hash is part of the tree?

Yes!

Proof

If the proof for element 9 consists of [8, 5, 3, 0] (the blue-circled nodes), we can also proof that the blue-circled 3 itself is part of the tree via [2, 0].

(Note that a merkle proof should not only proof that an element is part of the tree, but that the element is a leaf of the tree)

A second pre-image attack is where you are given some data and your task is to find a second set of data which generates the same hash as the first. (See Attacking Merkle Trees With a Second Preimage Attack )

The merkle root has a lof of different second pre-images!

(Note that this is an inherent problem of merkle trees)

However, it is easy to fix in real life by differentiating between leaf nodes and intermediary nodes.

In case of on-chain verification, see attacking OpenZeppelin and attacking solmate.

Prev Start