The refund() function uses a nonReentrant modifier to prevent reentrancy. However, the modifier resets locked = false after the function execution. If an attacker finds a way to bypass the nonReentrant lock (e.g., via a malicious contract or external calls), they could repeatedly call the function and drain funds.
An attacker could repeatedly trigger the refund() function, draining assets or causing unexpected state changes.
Deploy a malicious contract that interacts with refund():
Call the attack() function from the malicious contract.
Observe that the funds are drained because reentrancy prevention is not robust.
Use OpenZeppelin's ReentrancyGuard directly for better security practices.
Ensure that external calls (_refundETH or _refundERC20) are made after state updates.
Follow the Checks-Effects-Interactions (CEI) pattern strictly.
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.