Malicious bidder can DOS the claimAuction
function
#1750
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
downgraded by judge
Judge downgraded the risk level of this issue
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#L112
Vulnerability details
Impact
The winner of the auction can render the
claimAuction
function useless for a particular ID by bidding through a smart contract and not adding theonERC721Received
callback hook. This callback is called by the NFT contract to ensure that the smart contract is capable of receiving and transferring the NFT. The malicious bidder will lose funds for a particular auction, and other bidders will not receive refunds because the function will revert each time.Proof of Concept
Consider the following scenario with participants Alice and Bob in the auction:
A) Alice bids 1 ETH for tokenId = 2.
B) Other bidders participate in the auction for the same tokenId.
C) Bob places the highest bid (for tokenId = 2) and becomes the winner of the auction after it ends. However, he bid using a smart contract that did not implement the
onERC721Received
callback hook, either intentionally or unintentionally.D) If the winner or admin calls the
claimAuction
function for the same tokenId,IERC721(gencore).safeTransferFrom(ownerOfToken, highestBidder, _tokenId);
will revert. This is because the callback checks whether the recipient contract is capable of receiving ERC721, but in this case, it is not, resulting in a revert.Link to relevant code - Line 112
Tools Used
VSCode
Recommended Mitigation Steps
Use
transferFrom
instead ofsafeTransferFrom
.Assessed type
DoS
The text was updated successfully, but these errors were encountered: