omermaksutii/rugproof/integer-issues
Claude Code and agent skill by omermaksutii/rugproof
- community
Checking that the SKILL.md file is still in the repository.
Detect integer over/underflow in `unchecked` blocks, downcasting losses, fixed-point precision errors, division-before-multiplication, signed/unsigned mixing. Activate on any arithmetic in `unchecked { }`, `SafeCast`, `uintN(uintM(x))` casts, division and modulo, percentage/basis-points math, AMM share/asset math.
Install
npx vskill@latest install omermaksutii/rugproof/integer-issuesSKILL.md
The same SKILL.md was published earlier as iktok90-design/ai-smart-contract-auditor/integer-issues.
Integer issues detection
When this applies
unchecked { … }blocks (Solidity ≥0.8)- Downcasts:
uint128(x),int256(uint256(x)),uint8(...) - Division and modulo
- Fixed-point math with custom decimal scales
- Share/asset math in vaults, lending, AMMs
- Pre-0.8 Solidity code (no built-in overflow checks)
- Vyper code with unbounded loops
- Inline assembly arithmetic
Detection patterns
Unchecked overflow on user input (HIGH)
unchecked is fine for proven-safe accumulators (e.g. ++i in bounded loops), not for value math.
Division before multiplication (HIGH)
Decimal mismatch (HIGH)
USDC = 6 decimals, WETH = 18, WBTC = 8. Mixing without scaling produces silent 1e10–1e12 errors.
Downcast loss (HIGH)
Use OZ SafeCast.
Fixed-point precision loss (HIGH)
Compounding interest done as principal * (1 + rate)^t with too-few-decimal rate. Use ray (1e27) or wad (1e18) math via PRBMath / Solady.
Round-direction asymmetry (HIGH for vaults)
ERC-4626 must round shares down on deposit (favor vault) and up on withdraw (favor vault). Reversed direction = donations-style drain. Use OZ Math.mulDiv(_, _, _, Rounding.Down/Up).
Signed/unsigned mixing (HIGH)
Modulo zero (revert, but…) (MEDIUM-HIGH if attacker can set divisor=0)
Block-time math on L2 (MEDIUM)
block.timestamp granularity differs (2s on Optimism, 250ms on Arbitrum). Slot-based deadlines can be off.
Sqrt / log integer approximations (MEDIUM)
Custom sqrt implementations are notorious. Use Solady/PRBMath.
Percentage in basis points without bounds (LOW)
fee_bps should be capped (fee_bps <= 10_000).
Severity rubric
| Pattern | Severity | |
|---|---|---|
| Unchecked overflow on user input | High | |
| ERC-4626 round-direction wrong | High | |
| Decimal-mismatch in price/balance math | High | |
| Downcast losing high bits silently | High | |
| Division before multiplication on financial-critical path | High | |
| Custom sqrt/log without overflow proof | Medium | |
| Bps fee with no cap | Low | |
| Loop index underflow in pre-0.8 code | High | |
| Modulo-zero on attacker-controlled divisor | High |
Remediation patterns
- Solidity 0.8.x default checks; only
uncheckedproven-safe (e.g.++iinforloops bounded by array length). - OZ
SafeCastfor downcasts. Math.mulDiv(OZ) for multiply-then-divide without intermediate overflow.- PRBMath or Solady for fixed-point exp/log/pow.
- Always scale to a common decimal base before doing math; document the scale.
- ERC-4626: always use
Math.mulDiv(..., Rounding.Down)on deposits,Rounding.Upon withdrawals; or use OZ'sERC4626Upgradeablewhich handles this.
False-positive notes
unchecked { ++i; }inforloops withi < arr.lengthis the canonical safe use — not a finding.- Pre-0.8 SafeMath is fine; the issue is mixed-version dependencies.
Related
- [[token-compatibility]] — decimals confusion
- [[oracle-manipulation]] — price scaling
- [[yield-aggregator-specialist]] — ERC-4626 round direction
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/integer-issues/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/omermaksutii/rugproof/integer-issues)