_mint Function Breaks Total Supply and Balance IntegrityIn a secure ERC20 implementation, the _mint function must prevent arithmetic overflow by ensuring that _totalSupply + value and accountBalance + value do not exceed type(uint256).max.
However, this function directly uses Yul's add instruction for addition without validating the result for overflow. Since Yul's add silently wraps around on overflow, this can cause _totalSupply or account balances to be incorrectly set to extremely small values, thereby violating token supply conservation and account asset integrity.
Likelihood:
Overflow is triggered when calling _mint again if the total token supply or an account balance is close to type(uint256).max (low probability in standard use cases, but significant risk in mintable tokens or high-inflation models)
Project owners or governance contracts may have unlimited minting privileges; without external validation, this issue is highly likely to be exploited
Impact:
_totalSupply or user balances become severely distorted due to wrapping, undermining the credibility of the token's economic model
Potential for logical attacks (e.g., using overflow to zero out or reduce balances, then profiting from other integrated mechanisms)
Add the function test_1_mint_overflow to Token.t.sol:
Execute command: forge test --mt test_1_mint_overflow -vv
overflow & underflow occurs
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.