Through the withdraw
function, a client can withdraw their unsuccessful bid from the protocol. However, the function lacks code to set the client's funds to 0 before the transfer.
If the client's amount is greater than 0, they can withdraw funds from the protocol, fully depleting smart contract's balance thanks to reetrance attack.
In the `withdraw` function is if statement where is checking client's amount.
if amount > 0
If amount is greate than 0, then is possible transfer client's founds from smart contract to it's address.
erc20_dispatcher.transfer_from(sender, caller, amount.into())
;
In the withdraw
function, there's no code to set the client's balance to 0 before transferring the amount. This omission allows for a reentrancy attack, enabling malicious actors to steal all funds from the smart contract.
The entire amount from the protocol can be stolen.
manual review
Please add self.bid_values.entry(sender).write(0)
to set 0 for client balance and remove
let sender = get_contract_address();
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.