refund function allows re-entrancy which can result in attacker emptying contract balance.
The refund function, see relevant lines below, allows for re-entrancy attack due to state-changing code after sending the refund value to entrant.
A test showing how to exploit this vulnerability is located here.
The contract, Attack.sol, which was used to request multiple refunds and empty contract is here
An image showing the test's failure is here
High - likelihood and impact are both high. The protocol could lose all funds held by contract.
VS Code
Hardhat
Rewrite the refund function such that there is no state-changing code following the payment of funds.
reentrancy in refund() function
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.