The StarknetAuction
contract does not properly handle the scenario when no bids are placed during the auction. As a result, if an auction ends with no valid bids, the NFT is not transferred back to the original owner, leading to it being locked within the contract indefinitely. This flaw could prevent the original owner from reclaiming the NFT, effectively causing a permanent asset loss.
In the end()
function of the StarknetAuction
contract, the following logic is used to determine how to finalize the auction:
The line assert(self.starting_price.read() < self.highest_bid.read(), 'No bids');
is intended to prevent the auction from ending without a valid bid. However, this also means that if no bids are placed, the end()
function will revert, leaving the NFT permanently locked in the contract, with no way for the original owner to reclaim it.
The following test case, included in the provided test library, demonstrates that the contract was designed to panic if there were no bids placed, resulting in the NFT being stuck in the contract:
This test shows that if no bids are placed, attempting to end the auction will cause a panic with the message 'No bids'
. As a result, the NFT remains in the auction contract, inaccessible to the original owner. This behavior was likely a design oversight, mistakenly leaving the NFT locked.
The NFT can become locked inside the contract if no bids are placed, resulting in:
Loss of Asset Ownership: The original owner permanently loses access to the NFT, as there is no function available to reclaim it.
Incomplete Auction Lifecycle: The auction cannot be properly finalized, leaving the contract in an undesirable state.
There are numerous possible reasons for why there would be no bidders at the auction. One of them could be that the owner initialized the auciton with too high of a starting_price
_ _by mistake (eg. 1000 instead of 100 ether). Since there is no way to edit it, no one will ever bid if that price is way too high.
Manual review, Starknet Foundry
Update the end()
Function Logic to allow the initial owner of the nft to be able to claim it whenever the bid has ended and there were no bidders
If there are no placed bids in the auction, the `end` function will always revert. The owner can not receive back the nft ant it will be locked in the contract.
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.