The function should provide Sepolia ETH to first-time callers, up to a daily total cap. Once reached, it stops sending ETH and distributes only tokens. The cap resets daily to resume ETH distribution.
If an account has not yet received ETH, it receives it as expected. However, when an account that has already received ETH requests additional tokens, it unintentionally resets the daily ETH cap, effectively bypassing the limit and allowing more ETH to be distributed than intended.
Likelihood:
This issue occurs whenever an account that has already received ETH calls the claimFaucetTokens() function to claim additional tokens.
Impact:
Under the current contract parameters, the impact is low: each account receives 0.005 ETH, the dailySepEthCap is 1 ETH, and the maximum number of claims is 100. Even if all 100 claims are made, the total distributed would only amount to 0.5 ETH
The risk could increase if the owner raises the maximum daily claims via the adjustDailyClaimLimit() function. Setting the limit above 200 (0.005 * 201 > 1) would make this vulnerability more severe.
This test verifies the incorrect reset of dailyDrips when an account that has already received ETH calls the function, triggering the else block at line 216 of the contract, causing the bug.
Called the faucet to set hasClaimedEth to true for user1.
Advanced 4 days to allow user1 to call the function again.
Called the function with user2; with dailyDrips equal to ethSentToEachAccount * 1, verified that after 3 days dailyDrips is correctly reset.
Called claimFaucetTokens with user1 and expected dailyDrips to remain unchanged (correct behavior).
Test shows dailyDrips is reset to 0 instead, triggering the bug.
The tests show that the contract should keep the dailyDrips value unchanged, but it is instead reset by a call from an account that has already received ETH.
Test File: test/RaiseBoxFaucet.t.sol
Test Suite: TestRaiseBoxFaucet
Total Tests Run: 1
Tests Passed: 0
Tests Failed: 1
Tests Skipped: 0
Execution Time: 4.96ms (CPU time: 291.74µs)
testDailyDripsIsResetInAWrongWayFailure Message:
Gas Used: 433362
To mitigate this issue, it is sufficient to remove the line inside the else block that resets dailyDrips when hasClaimedEth is true.
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.