_burn()The intended behavior of ERC20Internals::_burn() is to permanently remove a specified value of tokens from the account and reduce the global _totalSupply. Under normal conditions, a burn operation must always decrease balances and never create new tokens.
However, the current implementation performs raw subtraction inside Yul without any underflow checks. Since inline assembly bypasses Solidity’s built-in overflow protection, subtracting a value larger than the actual balance or total supply results in a uint256 underflow, causing the storage slot to wrap around to a massive value (≈ 2^256 - x). This behavior mints tokens instead of burning them, breaking ERC20 invariants.
An underflow occurs whenever a burn amount is larger than the actual balance of the account.
Since arithmetic is handled in assembly, Solidity’s safe-math checks do not trigger, making this issue trivial to exploit.
Unbounded minting: Burning more than the balance inadvertently increases the user’s balance to a near-max uint256 value.
Economic collapse: Total supply is inflated, tokenomics break, and anyone—even with zero tokens—can mint a massive amount by calling burn.
Overall impact: High
The “after” balance is essentially 2^256 – (requestedBurn - balance), confirming underflow-based minting occurred.
Add explicit assembly-level checks to ensure both the account balance and total supply are sufficient before performing subtraction. If any condition fails, revert early.
Note: For security-sensitive logic like accounting, avoid using Yul unless absolutely necessary. High-level Solidity already provides safe arithmetic and is much less error-prone.
Patched Version (Assembly Checks Added)
function _burn(address account, uint256 value) internal {
assembly ("memory-safe") {
// Revert on zero address
if iszero(account) {
mstore(0x00, shl(224, 0x96c6fd1e))
mstore(add(0x00, 4), 0x00)
revert(0x00, 0x24)
}
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.