Description: When a user calls the ChristmasDinner.sol::refund function, it calls the internal functions _refundERC20 and _refundETH.
Both internal functions are vulnerable to reentrancy due to external calls made before state variables are updated.
In ChristmasDinner.sol::_refundERC20 tokens are transfered via safeTransfer() before balances[][] are updated to 0.
In ChristmasDinner.sol::_refundETH tokens are transfered via transfer() before etherBalance[] is updated to 0.
The ChristmasDinner.sol::nonReentrant modifier applied to the ChristmasDinner.sol::refund function does not protect against reentrancy due to the
locked variable always being set to false allowing functions with this modifier to be executed before previous execution is completed.
Impact: An attacker can refund to a malicious contract where the receive() function contains another call to to refund() leading to a
call loop where all funds are drained from the contract.
Recommended Mitigation: Reentrancy can be prevented if the ChristmasDinner.sol::nonReentrant modifier includes the following line:
Alternatively the vulnerable functions could implement the CEI pattern or Openzeppelin's ReentrancyGuard library could be used.
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.