input-arithmetic-safety

Detect input validation failures and arithmetic vulnerabilities in Solidity smart contracts.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/dajneem23/codex-skills --skill input-arithmetic-safety-dajneem23
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: input-arithmetic-safety
Source: https://github.com/dajneem23/codex-skills/tree/main/input-arithmetic-safety
Command: npx skills add https://github.com/dajneem23/codex-skills --skill input-arithmetic-safety-dajneem23

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill identifies and mitigates critical input validation failures and subtle arithmetic vulnerabilities in smart contracts, even those using Solidity 0.8+, preventing exploits that lead to fund loss and protocol instability.

Core Features & Use Cases

  • Input Validation Audits: Detects missing zero-address/amount checks, array bounds, and improper parameter ranges.
  • Arithmetic Vulnerability Detection: Finds precision loss (division-before-multiplication), rounding exploitation, ERC4626 inflation risks, unsafe casting, and unchecked block dangers.
  • Use Case: When auditing a DeFi lending protocol, use this Skill to ensure that user-supplied collateral amounts are validated, interest calculations don't suffer from precision loss, and vault share minting is protected against inflation attacks.

Quick Start

Analyze the provided smart contract code for input validation and arithmetic vulnerabilities.

Frequently Asked Questions about input-arithmetic-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit smart contracts for arithmetic vulnerabilities and input validation failures?

To audit smart contract arithmetic vulnerabilities, you need to detect missing zero-address checks, precision loss from division-before-multiplication, unsafe integer casting, and ERC4626 share inflation risks. This Skill systematically analyzes Solidity code to identify these flaws.

What are common input validation vulnerabilities in DeFi smart contracts?

Common input validation vulnerabilities in DeFi smart contracts include missing zero-address checks, unvalidated user-supplied amounts, improper parameter ranges, and array bounds issues. These flaws allow attackers to manipulate protocol logic and cause fund loss.

How does Solidity 0.8+ unchecked block arithmetic affect smart contract security?

Solidity 0.8+ unchecked blocks disable built-in overflow checks, creating edge cases where arithmetic operations can silently wrap around. Auditing unchecked blocks is critical to identify vulnerabilities that bypass default safety checks and lead to unexpected behavior.

Can this detect ERC4626 vault share inflation attacks and rounding direction exploitation?

Yes, it detects ERC4626 vault share inflation attacks and rounding direction exploitation by analyzing share pricing and exchange rate logic. It identifies mathematical edge cases where attackers can manipulate rounding to extract value from the protocol.

When should I audit smart contracts for precision loss in fee calculations?

You should audit for precision loss in fee calculations whenever contracts perform division before multiplication, handle dust amounts, or apply exchange rates. These operations frequently introduce rounding errors that attackers exploit to drain protocol funds.

Does this Skill work for auditing public-facing functions that accept user input?

Yes, this Skill is specifically designed to audit public-facing functions that accept user input. It validates parameter ranges, array bounds, and amount checks to ensure external calls cannot exploit arithmetic logic or bypass protocol constraints.