Integer Overflow and Underflow


Integer overflow and underflow occur when arithmetic operations exceed the maximum or minimum size that an integer type variable can hold, causing the value to wrap around to the opposite extreme.


An attacker can exploit these vulnerabilities to disrupt contract logic, possibly stealing assets or minting an excessive amount of tokens.

Steps to Fix

  1. Use SafeMath or similar libraries that offer functions for safe arithmetic operations.
  2. Upgrade to Solidity version 0.8.0 or later, which includes built-in protection against overflow and underflow.


The BatchOverflow exploit in multiple ERC20 smart contracts allowed attackers to generate an almost infinite amount of tokens by exploiting an integer overflow vulnerability.