bidders can withdraw multiple times due to lack of checks in the withdraw
function.
https://github.com/Cyfrin/2024-10-starknet-auction/blob/main/src/starknet_auction.cairo#L116-L137
Multiple Withdrawals for All Bidders: The withdraw
function allows all bidders, including non-winners, to withdraw their bids multiple times. This is because the bid amounts are never reset after withdrawal.
Auction Winner Can Reclaim Funds: The contract doesn't distinguish between the winning bidder and other bidders in the withdrawal process. This allows the auction winner to withdraw their bid, effectively undoing the auction result.
Lack of State Tracking: The contract doesn't track whether a withdrawal has occurred or the auction has been settled, allowing for these incorrect behaviors.
Financial Loss: The contract could be drained of more funds than were actually bid, leading to significant financial loss.
Auction Integrity: The ability for the winner to withdraw their bid undermines the entire auction process, as the highest bidder can effectively cancel their win.
Unfair Advantage: Bidders who realize this vulnerability could exploit it to withdraw more than their initial bid, potentially profiting unfairly.
Manual Review
Implement a withdrawal tracking mechanism:
Distinguish between the winner and other bidders:
Add this check to prevent the auction winner from withdrawing their bid.
Implement an auction settlement process:
After the auction ends, transfer the winning bid to the NFT owner and the NFT to the winner automatically, rather than
relying on manual withdrawals.
The `withdraw` function doesn't reset the `bid_values` to 0 after the withdraw. That means the bidder can call multiple time the `withdraw` function and receive the whole balance of the protocol.
The `withdraw` function allows the participants to receive back the value of all their unsuccessful bids. The problem is that the winner of the auction will receive all bids including the `highest_bid` that should be paid to the NFT owner.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.