The function refund()
is open to reentrancy attacks. Funds from the raffle contract can be drained by an attacker.
The refund()
function is subjected to a reentrancy attack. This means that an attacker can reenter the function and drain it of its funds. This is mainly due to the missing reentrancy guard modifier and also lack of check effect interact design in the function, which is caused by a state update after the funds are sent. Which can be seen here:
An attacker can easily deploy a contract such as below:
And the attack is demonstrated as per below:
The function is left wide open for reentrancy attacks, the attacker can keep on draining the funds until there is none left.
Manual review and foundry
A reentrancy guard modifiers should be implemented in the function.
The check effect and interaction pattern should be adhered to.
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.