Auction winner can't receive its NFT and funds blocked on auction contract. #497
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-1785
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L104-L120
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L113
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L116
Vulnerability details
Impact
Proof of Concept
In
AuctionDemo.sol
after an auction ended winner or admin can useclaimAuction()
function, winner receive an NFT, other bidders receive their funds back.https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L104-L120
Moreover, this function lack of return value check as says in bot report.
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L113
https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/smart-contracts/AuctionDemo.sol#L116
When we implement a return value check this function is still vulnerable.
If a bid made from smart contract account without payable receive/fallback function claim operation can't be executed as expected: auction winner will not receive its NFT and funds of auction participants will be blocked on an auction contract forever.
Link to gist with the test that shows exploit scenario
To make test work properly, first you must implement a return value check in
claimAuction()
function:The test itself:
To run it use:
forge test --mt test_BlockingBiddersFunds -vvv
.Tools Used
Foundry, manual review.
Recommended Mitigation Steps
Consider to implement
withraw()
function to allow each bidder receives its funds back independently instead of usingfor loop
.Assessed type
DoS
The text was updated successfully, but these errors were encountered: