Normal behavior:
The claimFaucetTokens() function should allow users to claim tokens once every 3 days, with state variables (lastClaimTime, dailyClaimCount) updated immediately to prevent
Specific issue:
External ETH transfer occurs at line 198 before critical state updates at lines 227-228, allowing attackers to re-enter and bypass all cooldown and limit protections.
Likelihood:
Reason 1: Any user can call claimFaucetTokens() without special permissions, making the attack surface completely public and unrestricted.
Reason 2: The exploit requires only a simple malicious contract with a receive() fallback function, making it trivial for any attacker to execute.
Reason 3: The vulnerability is triggered on every first-time ETH claim, occurring naturally in normal faucet operations.
Impact:
Impact 1: Complete fund drainage - Attacker can steal all faucet tokens and ETH in a single transaction by re-entering before lastClaimTime is updated.
Impact 2: Cooldown mechanism bypass - The 3-day cooldown becomes completely ineffective as attackers can claim multiple times before the timestamp is recorded.
Impact 3: Daily limit bypass - dailyClaimCount is incremented after the attack completes, allowing attackers to exceed the daily claim limit.
Impact 4: Denial of Service - Once funds are drained, legitimate users cannot claim tokens, breaking core faucet functionality.
Test:
forge test --match-contract PoC_ReentrancyTest -vv
Result: Attacker obtained 2000 tokens instead of expected 1000 (2x claims in single transaction).
Apply Checks-Effects-Interactions pattern by moving state updates before external calls.
Why this fixes it: Updating lastClaimTime and dailyClaimCount before the external call ensures that any re-entry attempt will fail the cooldown check, preventing multiple claims.
Implementation: (Alternative (additional layer): Add OpenZeppelin's ReentrancyGuard modifier to the 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.