Langsung ke konten
Skillpedia
Keamanan5.5k Β· #14798

web3-audit

Fungsinya

Skill ini mengajari agent cara mengaudit kontrak pintar untuk bug DeFi yang umum. Mencakup kontrak Solidity dan Rust, serta pemeriksaan yang membantu memutuskan apakah sebuah protokol layak ditinjau.

Kapan dipakai

  • βœ“Saat auditor meninjau kontrak pintar Solidity atau Rust untuk risiko DeFi.
  • βœ“Saat pemburu perlu memutuskan apakah target bounty DeFi layak diluangkan waktu.
  • βœ“Saat peneliti ingin tes Foundry untuk membuktikan dugaan bug kontrak.

Link skill

https://github.com/awarexone/Agentic-Bug-Hunter/blob/main/skills/web3-audit/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/awarexone/Agentic-Bug-Hunter/blob/main/skills/web3-audit/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œAudit fungsi-fungsi sejenis pada kontrak pinjaman ini untuk pemeriksaan akses yang hilang, dan beri tahu apakah layak ditinjau mendalam.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent pertama-tama menerapkan pemeriksaan cepat terhadap ukuran, audit sebelumnya, dan nilai bounty. Setelah itu agent membaca kontrak, membandingkan setiap fungsi dengan saudaranya, dan memeriksa sepuluh kelas bug. Dugaan bug dikonfirmasi dengan tes Foundry.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

WEB3 SMART CONTRACT AUDIT

10 bug classes. Pre-dive kill signals. Foundry PoC template. Real paid examples.


PRE-DIVE KILL SIGNALS (check BEFORE any code review)

ZKsync lesson: $322M TVL + OZ audit + 750K LOC + 5 sessions = 0 findings. Large well-audited bridges are extremely hard.

  1. TVL < $500K β†’ max payout capped too low for effort
  2. 2+ top-tier audits (Halborn, ToB, Cyfrin, OpenZeppelin) on simple protocol β†’ bugs already found
  3. Protocol < 500 lines, single A→B→C flow → minimal attack surface
  4. Formula: max_realistic_payout = min(10% Γ— TVL, program_cap) β€” if < $10K, skip

Soft kill: OZ/ToB/Cyfrin audit on current version + codebase > 500K LOC β†’ expect 40+ hours for maybe 1 finding. Only proceed if bounty floor > $50K AND you have protocol-specific expertise.

Target scoring (go if >= 6/10):

  • TVL > $10M: +2
  • Immunefi program with Critical >= $50K: +2
  • No top-tier audit on current version: +2
  • < 30 days since deploy: +1
  • Protocol you've hunted before: +1
  • Source code + natspec comments: +1
  • Upgradeable proxies: +1

THE ONE RULE

"Read ALL sibling functions. If vote() has a modifier, check poke(), reset(), harvest(). The missing modifier on the sibling IS the bug."

This single rule explains 19% of all Critical findings.


1. ACCOUNTING STATE DESYNCHRONIZATION

#1 Critical bug class β€” 28% of all Criticals on Immunefi.

What It Is

Two state variables supposed to stay in sync. One code path updates A but forgets B. Later code reads both and makes decisions based on stale B.

Real Value = A - B
If A updated but B isn't β†’ Real Value appears larger β†’ phantom value

Root Cause Patterns

Variant 1: Phantom Yield (Yeet protocol β€” 35 duplicate reports)

function startUnstake(uint256 amount) external {
    totalSupply -= amount;  // decremented BEFORE transfer
    // aToken.balanceOf(this) still reflects old value
    // yieldAmount = aToken.balanceOf - totalSupply = phantom yield
}

Variant 2: Fast Path Skips State Update (Alchemix V3)

function claimRedemption(uint256 tokenId) external {
    if (transmuter.balance >= amount) {
        transmuter.transfer(user, amount);
        _burn(tokenId);
        return;  // EARLY RETURN β€” cumulativeEarmarked, _redemptionWeight, totalDebt never updated
    }
    // Slow path: updates all state vars correctly
    alchemist.redeem(...);
}

Variant 3: Update Happens in Wrong Order (Alchemix)

function deposit(uint256 amount) external {
    _shares = (amount * totalShares) / totalAssets;  // calculated BEFORE deposit
    totalAssets += amount;   // assets added AFTER shares calculated β†’ wrong rate
}

Grep Patterns

# Find all accounting variables
grep -rn "totalSupply\|totalShares\|totalAssets\|totalDebt\|cumulativeReward\|rewardPerShare" contracts/

# Find all early returns in claim/redeem functions
grep -rn "\breturn\b" contracts/ -B3 | grep -B3 "if\b"

# For each early return: which state updates in normal path are skipped?

2. ACCESS CONTROL

#2 Critical β€” 19% of Criticals. $953M lost in 2024 alone.

Variant 1: Missing Modifier on Sibling Function

function vote(uint256 tokenId) external onlyNewEpoch(tokenId) {  // guarded
function reset(uint256 tokenId) external onlyNewEpoch(tokenId) { // guarded
function poke(uint256 tokenId) external {                         // NO GUARD β†’ infinite FLUX inflation
}

Variant 2: Wrong Check (Existence vs Ownership)

function split(uint256 tokenId, uint256 amount) external {
    _requireOwned(tokenId);  // checks if token EXISTS, not if caller OWNS it
    _burn(tokenId);
    _mint(msg.sender, amount);  // attacker steals tokens they don't own
}

Variant 3: Silent Modifier (if vs require)

// VULNERABLE β€” non-admin silently gets through:
modifier onlyAdmin() {
    if (msg.sender == admin) {
        _;  // body only executes for admin, but non-admin doesn't revert
    }
}
// CORRECT: require(msg.sender == admin, "Not admin"); _;

Variant 4: Uninitialized Proxy

function initialize(address _owner) public {  // MISSING: initializer modifier
    owner = _owner;  // anyone can call β†’ become owner
}
// Fix: constructor() { _disableInitializers(); }

Grep Patterns

# Find sibling function families β€” do ALL have the same modifier set?
grep -rn "function vote\|function poke\|function reset\|function update\|
Pertanyaan umum

Apa aturan utamanya?

Skill ini meminta agent membaca semua fungsi sejenis, karena modifier yang hilang pada salah satu fungsi sering kali menjadi bugnya.

Apa itu sinyal penghentian?

Contohnya total nilai terkunci di bawah 500 ribu dolar atau protokol yang sudah diaudit oleh beberapa firma teratas.

Bahasa apa saja yang dicakup?

Skill ini mencakup kontrak pintar Solidity dan Rust.

Detail

Deskripsi asli dari pembuat

Smart contract security audit β€” 10 DeFi bug classes (accounting desync, access control, incomplete path, off-by-one, oracle, ERC4626, reentrancy, flash loan, signature replay, proxy), pre-dive kill signals (TVL < $500K etc), Foundry PoC template, grep patterns for each class, and real Immunefi paid examples. Use for any Solidity/Rust contract audit or when deciding whether a DeFi target is worth hunting.

repo: awarexone/Agentic-Bug-Hunter

Popularitas

Bintang GitHub
5.5k
Peringkat
#14798
Lisensi
MIT
Diperbarui
28/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa