Highest bidder can frontrun late bidder and prevent their refund #503
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-175
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
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L57
Vulnerability details
Impact
The highest bidder can frontrun anyone that waits until the end of the auction to bid(block.timestamp == minter.getAuctionEndTime(_tokenid)).
The current highest bidder can frontrun any bids at the deadline with a call to claimAuction(). The bids will still succeed and the new highest bidder will not be able to refund and will not be able to claim their NFT.
Proof of Concept
In this example Alice is the highest bidder and Bob waits until the end to bid.
Advance to the end of the auction
2a. Bob places a bid at the deadline
2b. Alice frontruns bob with a call to claimAuction()
Alice has recieved the NFT
Bob has not recieved the NFT and has no way to refund/cancel his bid
Tools Used
Foundry
Recommended Mitigation Steps
It should not be possible to bid at the same time as calling claimAuction()
To solve this we can change claimAuction so that it can only be called after the end of the auction and not at the end.
Assessed type
Timing
The text was updated successfully, but these errors were encountered: