analyzing-ethereum-sma…
Perform static and symbolic analysis of Solidity smart contracts using
External research synthesis from Trail of Bits, SlowMist, ConsenSys, Immunefi, and Cyfrin. Use this for advanced audit methodology, Echidna/Medusa fuzzing setup, Slither custom detector writing, attack pattern deep dives, or the 4-phase learning roadmap.
$ npx -y skills add tradecatlabs/vibe-coding-cn --skill web3-methodology-research --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/web3-methodology-researchContext preview
The summary Claude sees to decide when to auto-load this skill.
External research synthesis from Trail of Bits, SlowMist, ConsenSys, Immunefi, and Cyfrin. Use this for advanced audit methodology, Echidna/Medusa fuzzing setup, Slither custom detector writing, attack pattern deep dives, or the 4-phase learning roadmap.
name: web3-methodology-research description: External research synthesis from Trail of Bits, SlowMist, ConsenSys, Immunefi, and Cyfrin. Use this for advanced audit methodology, Echidna/Medusa fuzzing setup, Slither custom detector writing, attack pattern deep dives, or the 4-phase learning roadmap.
Sources: Trail of Bits, SlowMist, ConsenSys, Immunefi Web3 Security Library, Cyfrin Audit Course, Lido Audits Library, Nethermind PublicAuditReports.
---
| Tool | What It Does | When to Use | |------|-------------|-------------| | **Slither** | Static analysis for Solidity/Vyper | Always — run first | | **Echidna** | Property-based fuzzer (write invariants, it breaks them) | Write 3-5 invariants before reading code | | **Medusa** | Next-gen fuzzer, multi-core, parallel corpus | Deeper campaigns after Echidna | | **Manticore** | Symbolic execution — confirms if a path is truly reachable | Specific PoC confirmation | | **Halmos** | Symbolic unit testing — proves for ALL inputs | Math-heavy functions |
---
# Install pip3 install slither-analyzer # First pass — protocol overview slither . --print human-summary slither . --print contract-summary # Targeted detectors slither . --detect reentrancy-eth,reentrancy-no-eth,unchecked-lowlevel slither . --detect arbitrary-send-erc20,controlled-delegatecall slither . --detect uninitialized-state,uninitialized-storage slither . --detect suicidal,controlled-array-length # Visualization slither . --print inheritance-graph slither . --print function-summary slither . --print call-graph # Filtered run (skip tests and libs) slither . --exclude-low --filter-paths "test|lib"
---
// Write invariants BEFORE fully reading the code
contract VaultInvariants {
Vault vault;
// Protocol should never owe more than it holds
function echidna_solvency() public view returns (bool) {
return vault.totalAssets() >= vault.totalDebt();
}
// Share math must be consistent
function echidna_share_math() public view returns (bool) {
return vault.balanceOf(address(this)) <= vault.totalSupply();
}
// cumulativeRewardPerShare only ever increases
function echidna_reward_monotonic() public view returns (bool) {
return vault.cumulativeRewardPerShare() >= lastRewardPerShare;
}
}echidna contracts/VaultInvariants.sol --contract VaultInvariants --test-mode assertion # With config echidna Test.sol --contract EchidnaTest --config echidna.yaml
# echidna.yaml testLimit: 50000 seqLen: 100 workers: 4 corpusDir: corpus/
---
# Install
# github.com/crytic/medusa
go install github.com/crytic/medusa@latest
# Run (coverage-guided, multi-core)
medusa fuzz --config medusa.json
# medusa.json
{
"fuzzing": {
"workers": 4,
"testLimit": 500000,
"corpusDirectory": "corpus"
}
}Medusa vs Echidna: Medusa is faster on large contracts due to coverage-guided exploration. Use Echidna for first pass, Medusa for extended campaigns.
---
1. THREAT MODEL FIRST - What are the assets? (tokens, governance power, user funds) - What are the trust boundaries? (who can call what?) - What are the attack surfaces? (entry points, external calls) 2. STATIC ANALYSIS - Run Slither with all detectors - Examine SlithIR output for complex functions - Map ALL state variables and who can write them 3. WRITE INVARIANTS BEFORE READING EVERYTHING - "totalAssets >= totalDebt always" - "shares * pricePerShare == underlying always" - "user can always withdraw their full deposit" - Run Echidna. Watch it break them. 4. SYMBOLIC EXECUTION ON HIGH-VALUE PATHS - Use Manticore/Halmos for precise reachability confirmation - Confirms "can an attacker actually reach state X?" 5. MANUAL REVIEW — FOCUS ON - Business logic (not syntax — Slither caught that) - Economic invariants (is the math right under adversarial conditions?) - Access control (who can call what, when, with what params?) 6. DIFFERENTIAL TESTING - Compare against reference implementation - "Function A does X. Function B does the same thing differently. Why?" - The inconsistency IS the bug.
---
**EVM / Solidity:**
REENTRANCY VARIANTS (still common) - Cross-function: lock in depositA, reenter via depositB before state update - Cross-contract: callback to attacker contract via safeTransfer - Read-only: view function reads stale state during reentrant call (Curve $70M — most underestimated variant) ROUNDING ERRORS - Division before multiplication: (a / b) * c vs (a * c) / b - Wrong rounding direction (should round up for safety, rounds down) - Precision loss in sequential operations WEAK FIAT-SHAMIR (ZK SYSTEMS — ToB IEEE S&P 2023) - ZK proof prover can forge proofs if transcript not fully committed - Missing: challenge must bind all public inputs - Check: is the verifier challenge a hash of EVERYTHING the prover touches? ACCESS CONTROL GAPS - Function A has onlyOwner → sibling function B does NOT - Emergency functions callable by non-emergency roles - Initializer called after deployment without restrictions UNSAFE UPGRADES - Storage slot collision between proxy and implementation - Uninitialized implementation contract (selfdestruct vector) - delegatecall to address from storage (attacker controls target) SIGNATURE REPLAY - Missing nonce in signed message - Missing chainId in signed message - Missing contract address in signed message
**DeFi-Specific (from Uniswap, Frax, Reserve Protocol, Scroll audits):**
LIQUIDITY MATH EDGE CASES - Integer overflow at extreme tick values (Uniswap V3 type) - Rounding direction matters at boundary ORACLE MANIPULATION - TWAP too short → manipulable in same block - Spot price used directly → 1
从想法到产品的 AI 结对编程工作流标准:Prompt + Skill + Context + Quality Gate + 工程闭环 <!-- 徽章区域 (BADGES) --> 本仓库的 AI 解读链接:zread.ai/tukuaiai/vibe-coding-cn 🧠 六条核心命题
Repo: tradecatlabs/vibe-coding-cn
Perform static and symbolic analysis of Solidity smart contracts using
Pre-deployment security audit of Solidity smart contracts in a Foundry project. Combines…
AI-powered tools for Web3 bug bounty automation. Use when you want to automate recon, run…
Complete reference for all 10 DeFi smart contract bug classes. Use this when hunting for…
Case study - role misconfiguration bug class applied to a yield aggregator protocol. Use as a…
Master grep command arsenal for Web3 smart contract auditing. Use when starting a new…