Incorrect verification of onERC721Received callback success #26
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-148
🤖_09_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/sol/OwnershipNFTs.sol#L92-L95
Vulnerability details
Impact
Incorrect verification of
onERC721Received
callback can lead to the inability to transferOwnershipNFTs
to contracts.Proof of Concept
According to the EIP-721 specification, the
OwnershipNFTs.sol
contract checks whether the recipient is a contract. If so, it validates the success of the transfer inside the_onTransferReceived
function:However, instead of checking that the returned data equals the
onERC721Received.selector
"magic word", the contract requires the opposite. This logic error causes NFT transfers to contract addresses to revert even when they are successful.Tools Used
Manual review
Recommended Mitigation Steps
require( + data == IERC721TokenReceiver.onERC721Received.selector, "bad nft transfer received data" );
Assessed type
ERC721
The text was updated successfully, but these errors were encountered: