Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

blockchain-auditor

БесплатноБез исполняемых скриптовНе проверен

Security audit smart contracts for exploitable vulnerabilities from an unprivileged context. Use when analyzing Solidity contracts, reviewing bytecode…

ckorhonenот ckorhonen★ 35 звёзд на GitHub

Об этом скилле

Blockchain Security Auditor

Systematically audit smart contracts to identify exploitable vulnerabilities that allow an unprivileged account to extract funds or gain unauthorized access.

Quick Start

# For verified contracts (Etherscan source available)
cast etherscan-source <address> --chain mainnet

# For unverified contracts (bytecode only)
cast code <address> --rpc-url $ETH_RPC_URL
cast disassemble <bytecode>

# Fork testing
forge test --fork-url $ETH_RPC_URL -vvv

# Static analysis
slither . --checklist

Audit Methodology

Phase 1: Reconnaissance

  1. Gather contract information:

    # Check balance
    cast balance <address> --rpc-url $ETH_RPC_URL
    
    # Get bytecode
    cast code <address> --rpc-url $ETH_RPC_URL
    
    # Check if verified on Etherscan
    curl "https://api.etherscan.io/api?module=contract&action=getsourcecode&address=<address>&apikey=$ETHERSCAN_API_KEY"
    
    # Check for proxy implementation
    cast storage <address> 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc --rpc-url $ETH_RPC_URL
    
  2. Identify contract type:

    • Multi-sig wallet (addOwner, execute, confirmTransaction)
    • Token contract (transfer, approve, balanceOf)
    • DeFi protocol (deposit, withdraw, swap, liquidate)
    • Lending/borrowing (Compound/Aave-style)
    • AMM/DEX (Uniswap v2/v3-style with liquidity pools)
    • Proxy pattern (EIP-1967, UUPS, Transparent, Beacon)
    • Vault/yield aggregator (ERC-4626)
    • Cross-chain bridge (lock/mint, burn/release)
    • NFT contract (ERC-721, ERC-1155)

Phase 2: Source Code Analysis (Verified Contracts)

  1. Identify high-risk functions:

    • selfdestruct / suicide - can drain all ETH
    • delegatecall - can execute arbitrary code
    • call with user-controlled data - arbitrary calls
    • transfer / send without checks - reentrancy
    • withdraw / claim / redeem - fund extraction points
    • initialize / init - proxy initialization (can it be called twice?)
    • permit / permitAll - off-chain approval bypass
    • flash / flashLoan - flash loan entry points
  2. Check access control patterns:

    // Weak patterns to look for:
    require(tx.origin == owner);     // tx.origin bypass
    require(msg.sender == owner);    // Check if owner is compromised
    // Missing modifier on sensitive function
    function withdraw() public {     // No onlyOwner!
        payable(msg.sender).transfer(address(this).balance);
    }
    // Proxy: unprotected initialize
    function initialize(address _owner) public {  // Missing initializer modifier!
        owner = _owner;
    }
    
  3. Known vulnerability patterns:

    • Reentrancy (state change after external call)
    • Integer overflow/underflow (Solidity < 0.8.0)
    • Unchecked return values
    • Front-running susceptibility
    • Flash loan attacks (price manipulation in single tx)
    • Price oracle manipulation (spot vs TWAP)
    • Permit/EIP-2612 signature replay
    • ERC777 callback reentrancy
    • Read-only reentrancy (view functions misused in logic)
    • Donation attacks (token balance inflation)
    • First depositor share inflation (ERC-4626 vaults)

Phase 3: DeFi-Specific Attack Vectors

For DeFi protocols, these vectors are highest-value and commonly exploitable:

  1. Price Oracle Manipulation:

    // Vulnerable: spot price used as oracle
    function getPrice() public view returns (uint256) {
        (uint112 reserve0, uint112 reserve1,) = IUniswapV2Pair(pool).getReserves();
        return reserve1 * 1e18 / reserve0;  // Manipulable in a single tx!
    }
    // Attack: flash loan → manipulate pool → call vulnerable function → repay
    
    • Check if protocol uses spot prices anywhere
    • TWAP oracles are safe; Chainlink feeds are safe (within heartbeat)
    • Look for getReserves(), slot0(), direct AMM pool queries
  2. Flash Loan Attack Surface:

    • Can any state-changing function be called with borrowed funds?
    • Check: borrow large amount → do something → repay in same tx
    • Key question: does the protocol measure prices/balances before or after user deposits?
  3. Reentrancy Variants:

    // Cross-function reentrancy
    function withdraw() external {
        // State updated after transfer → reenter via deposit()
        IERC20(token).safeTransfer(msg.sender, amounts[msg.sender]);
        amounts[msg.sender] = 0;  // Too late!
    }
    
    // Read-only reentrancy (in Curve, Balancer)
    // Attack: during callback, totalSupply() returns old value
    // Another protocol reads it via getVirtualPrice() during the callback
    
  4. ERC-4626 Vault Inflation Attack:

    • First depositor can inflate share price by donating tokens
    • Target: protocols that mint shares = (deposit * totalShares) / totalAssets
    • If totalShares = 0, first depositor gets deposit shares; then donate to inflate
  5. Signature/Permit Vulnerabilities:

    // EIP-2612 permit can be f
    
Полный SKILL.md на GitHub

Установить blockchain-auditor в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

reference.md

FAQ

Что делает скилл blockchain-auditor?

Security audit smart contracts for exploitable vulnerabilities from an unprivileged context. Use when analyzing Solidity contracts, reviewing bytecode, testing exploits on forks, or searching for ways to extract funds without owner access. Covers verified and unverified contracts, bytecode disassembly, vulnerability ranking, proof-of-concept exploit generation, DeFi protocol attacks, and cross-chain bridge security.

Как установить скилл blockchain-auditor?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл blockchain-auditor запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить blockchain-auditor с