The _mint function performs two addition operations in Yul assembly without overflow checks: updating _totalSupply and the recipient's balance. Since Solidity 0.8.x's automatic overflow protection does not apply to inline assembly, an attacker can mint tokens that cause integer overflow, corrupting the token's total supply and account balances.
The function uses Yul assembly for gas optimization but omits mandatory overflow checks for addition operations. The vulnerability occurs because the add opcode in Yul silently wraps on overflow, unlike Solidity's checked arithmetic.
Likelihood:
High: Any address with minting privileges (or any user if _mint is exposed) can intentionally cause overflow by minting when totalSupply or a balance is close to type(uint256).max
Easy Exploitation: The attack requires only a single transaction with calculated parameters, and the overflow condition is trivial to compute
Impact:
Direct Fund Loss: Account balances can be reduced from near-maximum values to near-zero through overflow corruption
Total Supply Corruption: _totalSupply becomes mathematically incorrect, breaking all supply-dependent calculations (inflation rates, percentages, etc.)
Protocol-Wide Disruption: The token's economic model becomes unusable, requiring emergency migration or abandonment
Result:
Ran 1 test for test/Token.t.sol:TokenTest
[PASS] test_mint_totalSupply_overflow() (gas: 59465)
Logs:
TotalSupply after overflow: 999
Add explicit overflow checks before both addition operations in the _mint function
Alternative Solution: Create reusable safe arithmetic functions to avoid code duplication and ensure consistent overflow protection across the entire contract.
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.