Incorrect Token Transfer Before Burn Allows Owner to Drain Faucet Balance (Low Impact)
The burnFaucetTokens function in the RaiseBoxFaucet contract is intended to burn a specific amount of faucet tokens held by the contract. However, before burning, it transfers the entire token balance of the faucet to the owner, not just the amountToBurn.
As a result, the owner receives all tokens from the faucet’s balance while only burning a small portion of them. This behavior does not align with the documented purpose ("burn faucet tokens held by the contract") and can unintentionally drain the faucet’s token reserve.
Although the function is protected by onlyOwner, the logic error may cause operational issues or misuse of tokens if this function is called under the assumption it only burns tokens.
Low
Access Control: Proper (onlyOwner)
Impact: The faucet’s entire token supply can be transferred to the owner when only a portion should be burned.
Likelihood: Low (since only the owner can call), but could lead to misuse of funds or incorrect token accounting.
The faucet contract’s token balance can be entirely drained by the owner in one call.
The amountToBurn parameter becomes misleading since it does not control how many tokens are transferred.
The faucet’s functionality or accounting may break if other functions depend on its token balance.
Misleading documentation ("Burns faucet tokens held by the contract") creates risk for accidental misuse.
Manual Review
Foundry Unit Test (custom PoC confirming over-transfer)
Transfer and burn only the amount intended by the amountToBurn parameter. Add an event for transparency.
Fixed Version:
Add an event definition:
Below is a self-contained Foundry test file that demonstrates the vulnerable and fixed behavior. You can place this single file in your test/ directory (e.g., test/BurnFaucetTokens.t.sol) and run forge test --match-path test/burnFaucetTokens.t.sol -vvv.
Note: This test contains both the vulnerable and fixed function variations in the same contract for demonstration and regression testing.
This finding is categorized as Low severity because the function is gated by onlyOwner. However, the logic is incorrect and can lead to accidental or intentional draining when the owner calls the function under incorrect assumptions.
The provided test is self-contained and demonstrates both the buggy and fixed behavior for regression testing.
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.