_mint arithmetic overflow corrupts totalSupply and balances, enabling wrap-around exploitsFile Scope: src/helpers/ERC20Internals.sol
Normal Behavior: ERC20 implementations must ensure minting cannot overflow totalSupply or account balances. Overflows break core invariants and allow supply/balance wrap-around.
Specific Issue: Token-0x uses inline assembly in _mint to add(supply, value) and add(accountBalance, value) without overflow checks. This allows supply and balances to wrap modulo 2^256.
Likelihood:
High: Many inheriting tokens expose mint (owner/minter roles, reward emissions, etc.). Any call path that reaches _mint can trigger the overflow.
Impact:
High: totalSupply and user balances can wrap, breaking accounting (e.g., large mint followed by small mint collapses supply to a tiny number). Protocols relying on supply/balance correctness are compromised.
Economic Manipulation: Attackers can craft wrap-around states to bypass checks based on supply/balance magnitudes.
Mint type(uint256).max - 10, then mint 20.
Supply wraps: (2^256 - 10) + 20 = 9 (mod 2^256).
Test asserts totalSupply == 9 and balanceOf(user) == 9 (passes).
Add overflow checks in _mint (and similarly in _transfer for recipient additions):
missing checks for overflow and underflow.
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.