Unchecked Math
What it detects
The detector highlights arithmetic enclosed in unchecked
blocks or low-level assembly that sidesteps Solidity's built-in safety checks. Without these checks, overflow or underflow can occur silently.
Typical symptoms
unchecked { ... }
surrounding math operations- Comments referencing gas savings at the expense of safety
Solidity snippet (v0.8.25)
pragma solidity ^0.8.25;
contract SkipChecks {
function mul(uint256 a, uint256 b) external pure returns (uint256) {
unchecked {
// No overflow check performed
return a * b;
}
}
}
Why it matters on EVM
Unchecked arithmetic can introduce hidden overflows or underflows, leading to serious accounting errors and exploitable states.