smart-contract-auditing
БесплатноБез исполняемых скриптовНе проверенComplete mastery guide for smart contract security auditing — from first principles of EVM bytecode to advanced exploit patterns. Covers manual code review…
от nirholas★ 289 звёзд на GitHubОб этом скилле
Smart Contract Auditing — From Zero to Expert
This skill teaches you to think like a top-tier smart contract auditor. You'll learn to find vulnerabilities that automated tools miss, write clear findings, and reason about protocol-level risks in DeFi systems.
The Auditor's Mindset
"Your job is not to confirm the code works. It's to prove it can break."
An auditor must think adversarially. Every function is a potential attack surface. Every external call is a trust boundary. Every assumption is a vulnerability waiting to happen.
┌─────────────────────────────────────────────────┐
│ AUDITOR'S MENTAL MODEL │
├─────────────────────────────────────────────────┤
│ │
│ 1. UNDERSTAND the protocol's invariants │
│ 2. ENUMERATE every state-changing path │
│ 3. CHALLENGE every assumption │
│ 4. SIMULATE adversarial scenarios │
│ 5. VERIFY mitigations are complete │
│ │
│ "What must ALWAYS be true?" ← start here │
│ "How can I make it false?" ← then ask this │
│ │
└─────────────────────────────────────────────────┘
Vulnerability Taxonomy
Tier 1 — Critical (Funds at Risk)
| Vulnerability | What Breaks | Classic Example |
|---|---|---|
| Reentrancy | State updated after external call | The DAO hack ($60M) |
| Flash Loan Attack | Price oracle manipulation in single tx | bZx ($8M), Cream ($130M) |
| Access Control | Missing onlyOwner / role checks |
Parity wallet freeze ($280M) |
| Unchecked Return Values | Silent failure on transfer | Token transfers returning false |
| Storage Collision | Proxy upgrades overwriting slots | Audius governance ($6M) |
Tier 2 — High (Protocol Malfunction)
| Vulnerability | What Breaks | How to Spot |
|---|---|---|
| Oracle Manipulation | Price feeds return stale/wrong data | Check updatedAt staleness |
| Integer Overflow/Underflow | Math wraps around (pre-0.8.0) | Solidity < 0.8 without SafeMath |
| Front-running | MEV bots sandwich user txs | Unprotected swaps, auctions |
| Denial of Service | Unbounded loops, gas griefing | Arrays that grow without limit |
| Signature Replay | Same sig reused across chains/contracts | Missing nonce or chainId |
Tier 3 — Medium (Edge Cases)
| Vulnerability | What Breaks | How to Spot |
|---|---|---|
| Rounding Errors | Dust accumulation, unfair distributions | Division before multiplication |
| Timestamp Dependence | Miners manipulate block.timestamp | ±15 second tolerance |
| Centralization Risk | Admin can rug (even if "trusted") | Unrevoked roles, no timelock |
| Missing Events | Off-chain trackers lose sync | State changes without emit |
| Gas Optimization | Tx reverts on large sets | Storage reads in loops |
The Audit Process
Phase 1: Scoping (Day 1)
Questions to answer before reading ANY code:
─────────────────────────────────────────────
□ What does this protocol DO? (lending, DEX, vault, stablecoin?)
□ What are the protocol invariants?
- "Total deposits ≥ total borrows"
- "LP token supply × price ≥ pool reserves"
- "Collateral ratio always > liquidation threshold"
□ What's the attack surface?
- External entry points (public/external functions)
- Admin/privileged functions
- Oracle dependencies
- Cross-contract interactions
□ What token standards are involved? (ERC-20, ERC-721, ERC-4626, rebasing?)
□ Is it upgradeable? (proxy pattern? UUPS? Transparent?)
□ What chains is it deployed on? (different precompiles, EIPs)
Phase 2: Architecture Review (Day 1-2)
Draw the contract dependency graph:
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Router │────▶│ Vault │────▶│ Strategy │
│ (user entry) │ │ (holds funds) │ │ (deploys $) │
└──────────────┘ └──────┬───────┘ └──────────────┘
│
┌──────▼───────┐
│ PriceOracle │
│ (Chainlink) │
└──────────────┘
Identify trust boundaries:
- User → Router: Input validation, slippage checks
- Router → Vault: Authorization, reentrancy guards
- Vault → Strategy: Withdrawal limits, accounting
- Vault → Oracle: Staleness checks, deviation bounds
Phase 3: Line-by-Line Review (Day 2-5)
Checklist Per Function
// For EVERY external/public function, verify:
// 1. ACCESS CONTROL
// ✓ Who can call this? Is that correct?
// ✓ Are modifiers applied? (onlyOwner, onlyRole, whenNotPaused)
// 2. INPUT VALIDATION
// ✓ Are all parameters validated? (address != 0, amount > 0)
// ✓ Are array lengths bounded?
// ✓ Can attacker pass malici
Установить smart-contract-auditing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл smart-contract-auditing?
Complete mastery guide for smart contract security auditing — from first principles of EVM bytecode to advanced exploit patterns. Covers manual code review methodology, automated tooling (Slither, Mythril, Foundry fuzz), common vulnerability taxonomy (reentrancy, flash-loan attacks, oracle manipulation, access control, integer math), audit report writing, severity classification (Critical/High/Medium/Low/Informational), gas optimization reviews, upgrade safety, and DeFi-specific audit checklists for lending, AMM, vault, and stablecoin protocols.
Как установить скилл smart-contract-auditing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл smart-contract-auditing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic