Solidity Smart Contract Auditor
A professional-grade smart contract audit skill covering security vulnerabilities, gas optimization, storage patterns, and code architecture. Adapted to Solidity version specifics.
Audit Types
Determine the audit type based on user request:
| User Request |
Audit Type |
Primary Reference |
| "Full audit", "comprehensive review" |
Full Audit |
All references |
| "Security audit", "vulnerability scan" |
Security Focused |
references/security-checklist.md |
| "Gas optimization", "reduce gas costs" |
Gas Optimization |
references/gas-optimization.md |
| "Storage optimization", "storage patterns" |
Storage Optimization |
references/storage-optimization.md |
| "Code review", "architecture review" |
Architecture Review |
references/architecture-review.md |
| "DeFi audit", "protocol review" |
DeFi Protocol |
Security + Architecture references |
Core Audit Workflow
Phase 1: Preparation
Identify Solidity Version: Check pragma statement. Read references/version-specific.md for version-specific considerations:
- Pre-0.8.0: Check for SafeMath usage, arithmetic vulnerabilities
- 0.8.0+: Review
unchecked blocks, check custom errors usage
Understand Scope:
- List all contracts, interfaces, libraries
- Identify external dependencies (OpenZeppelin, etc.)
- Note inheritance hierarchy
- Document entry points (external/public functions)
Gather Context: Ask if not provided:
- Protocol purpose and intended behavior
- Deployment chain(s)
- Expected user flows
- Admin roles and privileges
Phase 2: Static Analysis
Run automated checks mentally using patterns from the security checklist:
- Access control patterns
- State-changing operations flow (checks-effects-interactions)
- External call patterns
- Arithmetic operations (especially in
unchecked blocks)
Map attack surface:
- External/public functions
- Functions handling ETH/tokens
- Functions with access control
- Upgrade mechanisms
Phase 3: Vulnerability Assessment
Read references/security-checklist.md and evaluate each category:
Critical Priority (check first):
- Access Control Vulnerabilities (OWASP SC-01) - $953M+ in losses
- Logic Errors (OWASP SC-02) - $64M+ in losses
- Reentrancy (OWASP SC-03) - $36M+ in losses
High Priority:
4. Flash Loan Attack Vectors (OWASP SC-04)
5. Input Validation (OWASP SC-05)
6. Oracle Manipulation (OWASP SC-06)
7. Unchecked External Calls (OWASP SC-07)
Medium Priority:
8. Integer Overflow/Underflow (version-dependent)
9. Denial of Service vectors
10. Front-running vulnerabilities
Phase 4: Optimization Analysis (if requested)
For gas optimization: Read references/gas-optimization.md
For storage optimization: Read references/storage-optimization.md
Phase 5: Report Generation
Use the template in references/report-template.md to structure findings.
Severity Classification
| Severity |
Criteria |
Action |
| Critical |
Direct fund loss possible, no user interaction needed |
Immediate fix required, do not deploy |
| High |
Fund loss possible with specific conditions, significant impact |
Must fix before deployment |
| Medium |
Limited impact, unlikely exploitation, or governance issue |
Should fix, assess risk |
| Low |
Minor issue, best practice violation |
Recommended fix |
| Informational |
Code quality, gas optimization, suggestions |
Optional improvement |
Quick Reference: Top Attack Vectors (2024-2025)
From OWASP Smart Contract Top 10 (2025) with real losses:
- Access Control ($953.2M): Missing/incorrect modifiers, exposed admin functions
- Logic Errors ($63.8M): Flawed business logic, incorrect calculations
- Reentrancy ($35.7M): State updates after external calls
- Flash Loans ($33.8M): Price manipulation, governance attacks
- Input Validation ($14.6M): Missing bounds checks, unchecked parameters
- Oracle Manipulation ($8.8M): TWAP manipulation, stale prices
Output Guidelines
Always provide:
- Clear finding title with severity
- Location: Contract name, function, line numbers
- Description: What the issue is
- Impact: Potential consequences
- Proof of Concept: How it could be exploited (when applicable)
- Recommendation: Specific fix with code example
Format recommendations as actionable code changes when possible.
Reference Files
Load these as needed based on audit type:
references/security-checklist.md - Complete vulnerability checklist with detection patterns
references/gas-optimization.md - Gas optimization techniques and patterns
references/storage-optimization.md - Storage layout and optimization
references/architecture-review.md - Code architecture best practices
references/version-specific.md - Solidity version considerations
references/report-template.md - Professional audit report template
1---2name: solidity-auditor3description: Professional-grade Solidity smart contract security auditor. Performs comprehensive audits or targeted reviews (security vulnerabilities, gas optimization, storage optimization, code architecture, DeFi protocol analysis). Use this skill when users request smart contract audits, security reviews, vulnerability assessments, gas/storage optimization analysis, code quality reviews, or when analyzing Solidity code for any security or quality concerns. Supports all Solidity versions with version-specific vulnerability detection. Based on OWASP Smart Contract Top 10 (2025) and real-world exploit patterns.4---5
6# Solidity Smart Contract Auditor
7
8A professional-grade smart contract audit skill covering security vulnerabilities, gas optimization, storage patterns, and code architecture. Adapted to Solidity version specifics.
9
10## Audit Types
11
12Determine the audit type based on user request:
13
14| User Request | Audit Type | Primary Reference |
15|--------------|------------|-------------------|
16| "Full audit", "comprehensive review" | Full Audit | All references |
17| "Security audit", "vulnerability scan" | Security Focused | `references/security-checklist.md` |
18| "Gas optimization", "reduce gas costs" | Gas Optimization | `references/gas-optimization.md` |
19| "Storage optimization", "storage patterns" | Storage Optimization | `references/storage-optimization.md` |
20| "Code review", "architecture review" | Architecture Review | `references/architecture-review.md` |
21| "DeFi audit", "protocol review" | DeFi Protocol | Security + Architecture references |
22
23## Core Audit Workflow
24
25### Phase 1: Preparation
26
271. **Identify Solidity Version**: Check pragma statement. Read `references/version-specific.md` for version-specific considerations:
28 - Pre-0.8.0: Check for SafeMath usage, arithmetic vulnerabilities
29 - 0.8.0+: Review `unchecked` blocks, check custom errors usage
30
312. **Understand Scope**:
32 - List all contracts, interfaces, libraries
33 - Identify external dependencies (OpenZeppelin, etc.)
34 - Note inheritance hierarchy
35 - Document entry points (external/public functions)
36
373. **Gather Context**: Ask if not provided:
38 - Protocol purpose and intended behavior
39 - Deployment chain(s)
40 - Expected user flows
41 - Admin roles and privileges
42
43### Phase 2: Static Analysis
44
451. **Run automated checks mentally** using patterns from the security checklist:
46 - Access control patterns
47 - State-changing operations flow (checks-effects-interactions)
48 - External call patterns
49 - Arithmetic operations (especially in `unchecked` blocks)
50
512. **Map attack surface**:
52 - External/public functions
53 - Functions handling ETH/tokens
54 - Functions with access control
55 - Upgrade mechanisms
56
57### Phase 3: Vulnerability Assessment
58
59Read `references/security-checklist.md` and evaluate each category:
60
61**Critical Priority (check first):**
621. Access Control Vulnerabilities (OWASP SC-01) - $953M+ in losses
632. Logic Errors (OWASP SC-02) - $64M+ in losses
643. Reentrancy (OWASP SC-03) - $36M+ in losses
65
66**High Priority:**
674. Flash Loan Attack Vectors (OWASP SC-04)
685. Input Validation (OWASP SC-05)
696. Oracle Manipulation (OWASP SC-06)
707. Unchecked External Calls (OWASP SC-07)
71
72**Medium Priority:**
738. Integer Overflow/Underflow (version-dependent)
749. Denial of Service vectors
7510. Front-running vulnerabilities
76
77### Phase 4: Optimization Analysis (if requested)
78
79For gas optimization: Read `references/gas-optimization.md`
80For storage optimization: Read `references/storage-optimization.md`
81
82### Phase 5: Report Generation
83
84Use the template in `references/report-template.md` to structure findings.
85
86## Severity Classification
87
88| Severity | Criteria | Action |
89|----------|----------|--------|
90| **Critical** | Direct fund loss possible, no user interaction needed | Immediate fix required, do not deploy |
91| **High** | Fund loss possible with specific conditions, significant impact | Must fix before deployment |
92| **Medium** | Limited impact, unlikely exploitation, or governance issue | Should fix, assess risk |
93| **Low** | Minor issue, best practice violation | Recommended fix |
94| **Informational** | Code quality, gas optimization, suggestions | Optional improvement |
95
96## Quick Reference: Top Attack Vectors (2024-2025)
97
98From OWASP Smart Contract Top 10 (2025) with real losses:
99
1001. **Access Control** ($953.2M): Missing/incorrect modifiers, exposed admin functions
1012. **Logic Errors** ($63.8M): Flawed business logic, incorrect calculations
1023. **Reentrancy** ($35.7M): State updates after external calls
1034. **Flash Loans** ($33.8M): Price manipulation, governance attacks
1045. **Input Validation** ($14.6M): Missing bounds checks, unchecked parameters
1056. **Oracle Manipulation** ($8.8M): TWAP manipulation, stale prices
106
107## Output Guidelines
108
109Always provide:
1101. **Clear finding title** with severity
1112. **Location**: Contract name, function, line numbers
1123. **Description**: What the issue is
1134. **Impact**: Potential consequences
1145. **Proof of Concept**: How it could be exploited (when applicable)
1156. **Recommendation**: Specific fix with code example
116
117Format recommendations as actionable code changes when possible.
118
119## Reference Files
120
121Load these as needed based on audit type:
122
123- `references/security-checklist.md` - Complete vulnerability checklist with detection patterns
124- `references/gas-optimization.md` - Gas optimization techniques and patterns
125- `references/storage-optimization.md` - Storage layout and optimization
126- `references/architecture-review.md` - Code architecture best practices
127- `references/version-specific.md` - Solidity version considerations
128- `references/report-template.md` - Professional audit report template