Incorrect onERC721Received Selector Check in _onTransferReceived()
#163
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/4528c9d2dbe1550d2660dac903a8246076044905/pkg/sol/OwnershipNFTs.sol#L92-L95
Vulnerability details
Impact
The incorrect check in
_onTransferReceived()
preventsNFTs
from being transferred to contracts that correctly implement theERC721
token receiver interface.Proof of Concept
The
_onTransferReceived()
function is designed to ensure that when anNFT
is transferred to a contract, therecipient contract
correctly implements theonERC721Received
function. This function should return a specificselector
to confirm that it can handleERC721
tokens.However, the current implementation incorrectly checks for inequality rather than equality.
This means that the function will
revert
if therecipient contract
correctly returns the expectedselector
, which is the opposite of the intended behavior. As a result, any contract that correctly implements theonERC721Received
function will be unable to receiveNFTs
from this contract.Tools Used
Manual Review
Recommended Mitigation Steps
The
require
statement should be corrected to check for equality, ensuring that the recipient contract'sonERC721Received
function returns theexpected selector
.Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: