In the withdraw
function, after transferring the user's bid amount, the user's bid balance in storage is not updated to 0. This leads to a logical vulnerability where users (including attackers) can withdraw repeatedly, because the balance never changes.
In this logic:
The amount
for the user is read from storage.
The contract sends the tokens using transfer_from()
.
However, the state is never updated to set the bid amount to 0 after the transfer.
The user (or an attacker) can call withdraw
multiple times to withdraw the same amount repeatedly.
This can lead to a complete drain of tokens from the contract.
After transferring the tokens, the user's bid amount should be updated to 0 to prevent multiple withdrawals.
Here’s the corrected code:
This ensures that the user’s bid amount is set to 0 immediately, making further withdrawals impossible.
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 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.