The _burn function is responsible for reducing an account’s balance and decreasing the total token supply. In a correct ERC-20 implementation, burning more tokens than the account owns must revert to protect supply invariants. Since Solidity 0.8.x automatically reverts on underflow, this is normally enforced automatically.
However, this contract implements _burn entirely in Yul, and Yul arithmetic does not revert on underflow. The function performs:
without validating that supply >= value or accountBalance >= value.
This causes sub() to wrap around to a very large uint256 value — effectively inflating balances and total supply to near-maximum.
This breaks all ERC-20 invariants and enables indirect infinite mint-like behavior.
Likelihood:
The _burn function is internal, but can be reached by any external function in derived contracts (e.g., a public burn() wrapper, token upgrade, staking/vesting contract, or governance extension using burn logic).
The function performs unchecked Yul arithmetic, meaning any call path that forwards an amount larger than the balance will silently underflow rather than revert.
Many developers assume Solidity 0.8.x protects against underflow, making the issue easy to overlook during integration.
Total supply can jump to extremely large values, breaking all accounting and enabling catastrophic inflation.
Account balances can wrap to near-2^256-1, giving the attacker a massive spendable balance, effectively minting unlimited tokens.
Below is a minimal Foundry test that demonstrates the underflow on your current implementation:
Running this test shows the underflow exploit clearly:
afterBalance and afterSupply become extremely large values.
Add explicit balance and supply checks before performing subtraction in Yul, and emit the appropriate Transfer event:
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.