The burnFaucetTokens function is intended to allow the owner to burn a specified amount of faucet tokens. However, it is implemented in a way that transfers the entire token balance of the faucet contract to the owner before performing the burn operation. This completely drains the faucet of its tokens, rendering its primary function (claimFaucetTokens) unusable until the owner manually transfers tokens back or mints new ones. This constitutes a critical Denial of Service (DoS) vulnerability.
Normal Behavior: The owner should be able to burn a specific amountToBurn amount from the faucet's token supply without affecting the remaining balance.
The Issue: The function incorrectly transfers the entire balance of the contract to the owner _transfer(address(this), msg.sender, balanceOf(address(this))); , regardless of the amountToBurn specified. This defeats the purpose of the faucet by removing all available tokens for claimers.
Likelihood: Low
This action can only be performed by the contract owner.
The owner would likely trigger this by mistake while intending to burn only a small amount, not maliciously.
Impact: High
Denial of Service: The faucet becomes completely non-functional as its token balance drops to zero. No users can claim tokens.
Centralization Risk: The entire faucet supply is moved to the owner's EOA, centralizing all tokens and breaking the contract's intended operation.
A test case can demonstrate this behaviour. The owner calls burnFaucetTokens with a small amount (e.g., 1 token), but the faucet's entire balance is transferred to the owner, leaving the faucet with 0 tokens.
The _burn function should be called directly on the contract's own balance. Since the ERC20 contract inherits from Context, _msgSender() within _burn will be address(this). However, _burn it is an internal function. The standard ERC20Burnable extension provides a public burn function, which should be used, but a direct internal call is appropriate since the contrct itself is the token. The logic should be changed to burn tokens directly from the contract's address without transferring them to the owner first.
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.