Starknet Auction

First Flight #26
Beginner FriendlyNFT
100 EXP
View results
Submission Details
Severity: high
Valid

reenttrancy attack

Summary

Vulnerability Details

https://github.com/Cyfrin/2024-10-starknet-auction/blob/main/src/starknet_auction.cairo#L116

The withdraw function allows participants of the auction (both the highest bidder and other bidders) to withdraw their funds after the auction has ended:

  • The NFT owner receives the highest bid.

  • All other bidders are refunded their bid amounts.

    but there is a potencial reentrancy in the withdraw logic

Impact

this function does not set the caller bid to 0 after withdrawal allowing a bad user to make multiple withdrawal which can lead to drain of funds

Tools Used

manaul

Recommendations

caller bid should be set to 0 after withdrawal

Updates

Lead Judging Commences

bube Lead Judge 9 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Reentrancy in `withdraw` function

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.