web3-audit
Skill này làm gì
Skill này dạy agent cách rà soát hợp đồng thông minh để tìm lỗi DeFi phổ biến. Skill bao gồm hợp đồng Solidity và Rust, và có các kiểm tra giúp quyết định xem một giao thức có đáng rà soát không.
Khi nào nên dùng
- ✓Khi người rà soát kiểm tra một hợp đồng thông minh Solidity hoặc Rust để tìm rủi ro DeFi.
- ✓Khi thợ săn cần quyết định xem một mục tiêu DeFi bug bounty có đáng thời gian không.
- ✓Khi nhà nghiên cứu muốn có một bài kiểm thử Foundry để chứng minh lỗi hợp đồng nghi ngờ.
Liên kết skill
https://github.com/awarexone/Agentic-Bug-Hunter/blob/main/skills/web3-audit/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Rà soát các hàm anh em của hợp đồng cho vay này để tìm kiểm tra truy cập bị thiếu, và cho tôi biết nó có đáng rà soát sâu không.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent trước tiên áp dụng các kiểm tra nhanh về quy mô, các lần kiểm toán trước và giá trị bug bounty. Sau đó agent đọc hợp đồng, so sánh từng hàm với các hàm anh em, và kiểm tra mười nhóm lỗi. Một lỗi nghi ngờ được xác nhận bằng bài kiểm thử Foundry.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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.
- TVL < $500K → max payout capped too low for effort
- 2+ top-tier audits (Halborn, ToB, Cyfrin, OpenZeppelin) on simple protocol → bugs already found
- Protocol < 500 lines, single A→B→C flow → minimal attack surface
- 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, checkpoke(),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\|
Câu hỏi thường gặp
Quy tắc chính là gì?
Skill nói phải đọc tất cả các hàm anh em, vì một modifier bị thiếu trên một hàm anh em thường chính là lỗi.
Tín hiệu dừng là gì?
Ví dụ gồm tổng giá trị khóa dưới 500 nghìn đô la, hoặc giao thức đã được vài hãng hàng đầu kiểm toán.
Nó bao phủ những ngôn ngữ nào?
Nó bao phủ hợp đồng thông minh Solidity và Rust.
Chi tiết
Mô tả gốc của tác giả
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.
Độ phổ biến
- Sao GitHub
- 5.5k
- Vị trí xếp hạng
- #14798
- Giấy phép
- MIT
- Cập nhật
- 28/10/2026
Bình luận
- …
Thêm skill từ kho mã này
bug-bounty
5.5kGiúp agent của bạn lên kế hoạch cho một đợt rà soát bug bounty theo từng giai đoạn, từ kiểm tra phạm vi chương trình và lập bản đồ tài sản đến thử nghiệm các manh mối, xác nhận tác động và viết báo cáo.
agentic-app-audit
5.5kGiúp agent của bạn rà soát từ bên ngoài một trợ lý AI đang chạy thật, tìm các rủi ro như lệnh gọi công cụ bị chiếm quyền, bộ nhớ bị nhiễm độc và hành động dùng quyền cao hơn người dùng.
argus
5.5kGiúp agent của bạn chạy sáu bộ quét tự động cho các lỗi phổ biến của ứng dụng web và AI, như chia sẻ tài nguyên chéo nguồn quá mở, điểm yếu JWT và lỗi mù được xác nhận ngoài băng.
bb-methodology
5.5kGiúp agent của bạn lên kế hoạch một phiên bug bounty theo từng giai đoạn, chọn bước tiếp theo và các kiểm tra phù hợp, rồi loại bỏ những ý tưởng không thể gây hại thật.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.