Any bidder can prevent all other bidders from refunding their bids and a winner from claiming their NFT in claimAuction
#1125
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-734
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L104-L120
Vulnerability details
Vulnerability Details
The
claimAuction
function inAuctionDemo.sol
allows users to refund their bids and an auction's winner to claim their won NFT. However, as the function makes an external call on each bidder to refund their bid, the high possibility of a Gas Bomb attack arises.As each ETH transfer is not assured to have been successful, the external call failing would not revert the call to
claimAuction
. Despite this, a malicious bidder could perform a Gas Bomb attack the following way: a.call()
is made to a bidder address that is a smart contract. The contract returnsbytes data
with a substantial size that is then copied in memory in theclaimAuction
function. The size is so great that it consumes the remaining gas making the function revert.Another way is by exploiting the 1/64 rule of external calls. An ETH transfer would invoke a contract's
receive
function which would consume all of the 63/64 gas provided. The remaining 1/64 of gas would not be enough to finish the transaction execution, leading to theclaimAuction
function reverting.Impact
Both attacks would completely block the winner of an NFT from claiming it and would prevent all bidders from refunding their bids, leading to massive losses for users.
The attacker would practically not suffer any losses as they only need to have bidded in an auction, in order to perform the DOS, which could be done at the auction's start at a price as low as 1 wei.
Proof of Concept
The
claimAuction
function does not implement thepull-over-push
pattern, but instead makes an external call to each bidder's address to refund the bidded ETH.Tools Used
Manual review
Recommended Mitigation Steps
Implement the
pull-over-push
method by adding a claim function that allows every bidder to individually refund their bid or claim their won NFT.Assessed type
DoS
The text was updated successfully, but these errors were encountered: