solidity-security

Implements defensive Solidity patterns preventing reentrancy, oracle manipulation, and proxy storage collisions.

1|1|Updated May 21, 2026
One-click install
npx skills add https://github.com/naruto11eth/cryptoskills --skill solidity-security-naruto11eth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: solidity-security
Source: https://github.com/naruto11eth/cryptoskills/tree/main/skills/solidity-security
Command: npx skills add https://github.com/naruto11eth/cryptoskills --skill solidity-security-naruto11eth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI-generated Solidity code frequently contains exploitable vulnerabilities such as reentrancy, token decimal mismatches, flash-loan-manipulable oracles, and unsafe proxy upgrades that cause real fund losses in DeFi protocols. ## Core Features & Use Cases - Vulnerability Patterns with Fixes: Covers reentrancy, access control, ERC4626 vault inflation, oracle manipulation, EIP-712 signatures, and MEV protection, each shown as wrong vs correct Solidity 0.8.20+ code. - Audit Preparation Resources: Includes SWC registry references, pre-deploy checklists, vulnerability severity tables, and tooling guides for Slither, Mythril, Echidna, Foundry fuzzing, and Certora. - Attack Test Examples: Provides Foundry test patterns for reentrancy attacks, flash loan oracle manipulation, access control exploits, and oracle failure simulation with vm.mockCall. - Use Case: Before deploying a lending protocol, use this Skill to verify CEI ordering on withdrawals, add Chainlink staleness checks, validate UUPS storage layout, and run the pre-deploy checklist. ## Quick Start Review my Solidity contract for reentrancy, oracle, and access control vulnerabilities and show the corrected code for each issue found.

Frequently Asked Questions about solidity-security

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

FAQPage Schema
How do I prevent reentrancy attacks in Solidity?

Apply the Checks-Effects-Interactions pattern by updating state before external calls, and add OpenZeppelin's ReentrancyGuard nonReentrant modifier to all state-changing functions. CEI alone does not stop cross-function reentrancy, so use both defenses together.

How to protect against flash loan oracle manipulation?

Never use Uniswap slot0 or reserve ratios as price oracles since flash loans can move them within one transaction. Use Chainlink feeds with staleness checks or Uniswap V3 TWAP with a 30-minute window, which makes manipulation economically infeasible.

What is the difference between Slither and Mythril for smart contract auditing?

Slither is a fast static analyzer with low false positives, suited for CI on every pull request. Mythril uses symbolic execution to find deep logic bugs but is slower, making it better for pre-deployment analysis of high-value contracts.

Does Solidity 0.8 prevent all integer overflow?

No. Solidity 0.8 checked math covers standard arithmetic on standard types, but does not protect unchecked blocks, assembly, bitwise operations, or downcasts like uint256 to uint128. Review all unchecked blocks and use OpenZeppelin SafeCast for downcasts.

Why does my ERC20 approve transaction fail with USDT?

USDT requires resetting the allowance to zero before setting a new value, and its approve returns no boolean. Use OpenZeppelin SafeERC20's forceApprove, which handles the reset automatically and works with non-standard tokens like USDT and BNB.

How do I safely upgrade a UUPS proxy contract?

Include _disableInitializers in the implementation constructor, protect _authorizeUpgrade with access control, and only append new storage variables using the __gap pattern. Validate storage layout between versions with OpenZeppelin upgrades tooling and test upgrades via fork tests.