Arbitrary Transfer of Unowned NFTs
The trade validation function did not check that the recovered signer address was not the zero address, so an invalid signature could be accepted as valid. An attacker could transfer any NFT that had no owner, including unminted tokens.
Larva Labs Meebits
Originally disclosed on Code4rena
Due to how the market functions are structured, it is possible to arbitrarily transfer any NFT that is not owned by any address.
The function in question is the tradeValid function invoked by acceptTrade before the trade is performed. It, in turn, validates the signature of a trade via verify, which does not account for the behavior of ecrecover.
When ecrecover is invoked with an invalid signature, the zero-address is returned by it, meaning that verify will yield true for the zero-address as long as the signature provided is invalid.
This can be exploited to transfer any NFT whose idToOwner is zero, including NFTs that have not been minted yet.
Recommend an additional check be imposed within verify that ensures the signer is not the zero-address which will alleviate this check. For more details, consult the EIP721 implementation by OpenZeppelin.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The signature verification function did not check that the address recovered from the signature was not the zero address, which is what ecrecover returns for invalid signatures.
Impact
An attacker could transfer any NFT that was not owned by any address, including NFTs that had not been minted yet.
What the attacker needed
None
The fix
An additional check should be added within `verify` to ensure the signer is not the zero address.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract used a signature check to approve trades, but it forgot to reject the special zero address that appears when a signature is invalid. This let anyone pretend to be the owner of NFTs that had no owner yet, and take them.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.