Attacker Balance Gain
What it detects
This detector spots cases where contract math lets an attacker artificially grow their token or ether balance. It looks for arithmetic mistakes or unchecked input that credit more value than intended.
Typical symptoms
- User balance grows without corresponding deposits
- Transfer functions grant more tokens than debited
Solidity snippet (v0.8.25)
pragma solidity ^0.8.25;
contract BalanceBug {
mapping(address => uint256) public balances;
function give(address user, uint256 amount) external {
// No proper validation can let user gain extra funds
balances[user] += amount * 2;
}
}
Why it matters on EVM
Improper accounting opens the door for attackers to siphon funds, undermining trust in the token's supply and contract's integrity.