unstake
function is susceptible to a reentrancy attack due to the order of operations, specifically the transfer of Ether before updating the state variables related to staking balances.unstake
function, Ether is transferred out of the contract using the send
method before the state variables usersToStakes
and totalAmountStaked
are updated. This allows a malicious contract at the _to
address to recursively call the unstake
function, draining funds from the contract.send
operation to the end of the function, after all state variables have been updated.transfer
function instead of send
for transferring Ether, as it forwards only a limited gas stipend, mitigating reentrancy risks.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.