type(uint256).max and then burning 1 token to take control of almost the entire supply, it can make the faucet unusable forever.The contract should allow the owner to burn tokens held by the contract by directly burning them from the contract's balance.
The problem is that the burnFaucetTokens function accepts a parameter that defines the amount of tokens to burn, then sends the entire balance of the contract to the owner and burns from the owner's balance the amount of tokens specified by the parameter, regardless of the size of the balance that was sent from the contract to the owner.
Owner can mint almost the entire supply (type(uint256).max - tokens held by users) to the contract, call the burn function and take control of the entire contract token balance. The contract remains with 0 tokens and cannot distribute through the faucet function.
Likelihood:
Reason 1 It can happen at any moment the owner decides to take almost full control of the tokens.
Reason 2
Impact:
Impact 1 The contract becomes non-functional, as any call to claimFaucetTokens reverts due to the contract having an insufficient balance.
Impact 2
1 - owner burn 1 token to avoid revert on the require balance < 1000 * 10 ** 18.
2- mint all the possible tokens (max uint256 - totalsupply) to exclude tokens from other users
3- burn 1 token and get all the balance contract (almost the entire supply), now the balance contract is 0 and no other tokens can be minted
4- users try to use the faucet but it will always revert due to insufficient balance
To mitigate this issue it is necessary to prevent transferring the tokens from the contract to the owner before the burn. Inside _burn replace msg.sender with address(this) and the tokens will be burned directly in the contract so the owner cannot seize them.
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.
The contest is complete and the rewards are being distributed.