Naive ERC721 receiver implementation can lead to a permanent locking of all bidder's capital #181
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-739
partial-50
Incomplete articulation of vulnerability; eligible for partial credit only (50%)
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L104-L120
Vulnerability details
A naive ERC721 receiver implementation may lead to a permanent locking of all bidder capital.
This can happen if the winning bidder contract fails to implement
onERC721Received
correctly.The issue manifests in
auctionDemo::claimAuction
which returns bidder's capital based on the successful execution ofIERC721(gencore).safeTransferFrom(ownerOfToken, highestBidder, _tokenid);
.Proof of Concept
Add the following file to
hardhat/test
.And the following file within
hardhat/smart-contracts
:Impact
All funds from bidders become irretrievably locked within the AuctionDemo contract.
Tools Used
Manual Review, Hardhat
Recommended Mitigation Steps
A simple mitigation step is to use
transferFrom
rather thansafeTransferFrom
inclaimAuction
to avoid the potential revert.However, to avoid winning bidder disapointment, alternatively consider expanding functionality with "pull over push" methods for bid reclaimation. For example, by including a seperate function such as
reclaimBidderFunds
.Assessed type
ERC721
The text was updated successfully, but these errors were encountered: