Closed code423n4 closed 2 years ago
This is valid, and we intend to fix — it is also a subset of the more generalized finding on criteria proofs where intermediate nodes of the proof can be used as leaves (and has the same mitigation, hashing leaf nodes)
Lines of code
https://github.com/code-423n4/2022-05-opensea-seaport/blob/main/contracts/lib/CriteriaResolution.sol#L155 https://github.com/code-423n4/2022-05-opensea-seaport/blob/main/contracts/lib/CriteriaResolution.sol#L241
Vulnerability details
Impact
_verifyProof
allows empty proofs and in that case it expects theleaf
to equal theroot
, because no hashing and iteration is taking place. The purpose of the tree is to hold multiple acceptedtokenId
s, where the consideration contains one and proving its existence in the order via the proof. Because of this theleaf
equals to a singletokenId
.This can manifest in distinct issues:
A criteria order with an empty proof is the same as a non-criteria order with the exception of the
ItemType
is differing (e.g.ItemType.ERC721
vsItemType.ERC721_WITH_CRITERIA
). This is a slight malleability symptom.In the case of
leaf=0
(tokenId=0
) the_verifyProof
function is not even executed.Proof of Concept
Context: CriteriaResolution.sol#L241, CriteriaResolution.sol#L155
Tools Used
Manual review
Recommended Mitigation Steps
Hash the leaf node or disallow empty proofs.