solidity-argus 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +161 -1
- package/package.json +5 -2
- package/skills/README.md +63 -0
- package/skills/checklists/cyfrin-defi-core/SKILL.md +3 -0
- package/skills/manifests/cyfrin.json +16 -0
- package/skills/manifests/defifofum.json +25 -0
- package/skills/manifests/kadenzipfel.json +48 -0
- package/skills/manifests/scvd.json +9 -0
- package/skills/manifests/smartbugs.json +11 -0
- package/skills/manifests/solodit.json +9 -0
- package/skills/manifests/sunweb3sec.json +11 -0
- package/skills/manifests/trailofbits.json +9 -0
- package/skills/methodology/audit-workflow/SKILL.md +3 -0
- package/skills/patterns/access-control.yaml +31 -0
- package/skills/patterns/erc4626.yaml +29 -0
- package/skills/patterns/flash-loan.yaml +20 -0
- package/skills/patterns/oracle.yaml +30 -0
- package/skills/patterns/proxy.yaml +30 -0
- package/skills/patterns/reentrancy.yaml +30 -0
- package/skills/patterns/signature.yaml +31 -0
- package/skills/protocol-patterns/amm-dex/SKILL.md +3 -0
- package/skills/references/exploit-reference/SKILL.md +3 -0
- package/skills/vulnerability-patterns/access-control/SKILL.md +13 -0
- package/skills/vulnerability-patterns/authorization-txorigin/SKILL.md +6 -0
- package/skills/vulnerability-patterns/delegatecall-untrusted-callee/SKILL.md +6 -0
- package/skills/vulnerability-patterns/dos-revert/SKILL.md +13 -1
- package/skills/vulnerability-patterns/flash-loan-attacks/SKILL.md +12 -0
- package/skills/vulnerability-patterns/oracle-manipulation/SKILL.md +13 -0
- package/skills/vulnerability-patterns/overflow-underflow/SKILL.md +10 -1
- package/skills/vulnerability-patterns/reentrancy/SKILL.md +13 -0
- package/skills/vulnerability-patterns/signature-malleability/SKILL.md +9 -0
- package/skills/vulnerability-patterns/unchecked-return-values/SKILL.md +11 -0
- package/src/agents/argus-prompt.ts +7 -7
- package/src/agents/pythia-prompt.ts +11 -11
- package/src/agents/scribe-prompt.ts +6 -6
- package/src/agents/sentinel-prompt.ts +7 -7
- package/src/cli/cli-output.ts +16 -0
- package/src/cli/cli-program.ts +9 -5
- package/src/cli/commands/doctor.ts +274 -16
- package/src/cli/commands/init.ts +5 -5
- package/src/cli/commands/install.ts +5 -5
- package/src/cli/commands/lint-skills.ts +114 -0
- package/src/cli/tui-prompts.ts +4 -2
- package/src/config/schema.ts +2 -0
- package/src/create-hooks.ts +141 -32
- package/src/create-tools.ts +2 -0
- package/src/features/error-recovery/session-recovery.ts +7 -1
- package/src/features/error-recovery/tool-error-recovery.ts +74 -19
- package/src/features/persistent-state/audit-state-manager.ts +36 -13
- package/src/hooks/agent-tracker.ts +53 -0
- package/src/hooks/compaction-hook.ts +46 -37
- package/src/hooks/config-handler.ts +22 -9
- package/src/hooks/context-budget.ts +45 -0
- package/src/hooks/event-hook-v2.ts +8 -2
- package/src/hooks/event-hook.ts +5 -4
- package/src/hooks/knowledge-sync-hook.ts +2 -1
- package/src/hooks/recon-context-builder.ts +66 -0
- package/src/hooks/safe-create-hook.ts +4 -5
- package/src/hooks/system-prompt-hook.ts +92 -221
- package/src/hooks/tool-tracking-hook.ts +108 -9
- package/src/hooks/types.ts +0 -1
- package/src/index.ts +28 -6
- package/src/knowledge/retry.ts +53 -0
- package/src/knowledge/scvd-client.ts +37 -10
- package/src/knowledge/scvd-errors.ts +89 -0
- package/src/knowledge/scvd-index.ts +53 -3
- package/src/knowledge/scvd-sync.ts +205 -34
- package/src/knowledge/source-manifest.ts +102 -0
- package/src/plugin-interface.ts +11 -3
- package/src/shared/binary-utils.ts +1 -0
- package/src/shared/logger.ts +78 -17
- package/src/skills/argus-skill-resolver.ts +226 -0
- package/src/skills/skill-schema.ts +98 -0
- package/src/state/audit-state.ts +2 -0
- package/src/state/types.ts +32 -1
- package/src/tools/argus-skill-load-tool.ts +73 -0
- package/src/tools/pattern-checker-tool.ts +56 -12
- package/src/tools/pattern-loader.ts +183 -0
- package/src/tools/pattern-schema.ts +51 -0
- package/src/tools/report-generator-tool.ts +134 -11
- package/src/tools/slither-tool.ts +61 -19
- package/src/tools/solodit-search-tool.ts +92 -14
- package/src/utils/audit-artifact-detector.ts +119 -0
- package/src/utils/dependency-scanner.ts +93 -0
- package/src/utils/project-detector.ts +128 -26
- package/src/utils/solidity-parser.ts +20 -4
- package/src/utils/solodit-health.ts +29 -0
package/README.md
CHANGED
|
@@ -111,10 +111,105 @@ The plugin ships with **55 curated SKILL.md files** organized into 5 categories:
|
|
|
111
111
|
|
|
112
112
|
**Sources:** Trail of Bits, Cyfrin, DeFiFoFum, kadenzipfel, SunWeb3Sec, smartbugs
|
|
113
113
|
|
|
114
|
+
### Pattern Packs
|
|
115
|
+
|
|
116
|
+
Pattern packs are YAML files containing collections of regular expression patterns used for vulnerability detection. These packs allow Argus to scan code for known security flaws without requiring full static analysis tools.
|
|
117
|
+
|
|
118
|
+
- **Location:** `skills/patterns/`
|
|
119
|
+
- **Available Packs:**
|
|
120
|
+
- `access-control.yaml` — Ownership and permission checks
|
|
121
|
+
- `erc4626.yaml` — Vault standard security patterns
|
|
122
|
+
- `flash-loan.yaml` — Flash loan attack vectors
|
|
123
|
+
- `oracle.yaml` — Price manipulation and staleness checks
|
|
124
|
+
- `proxy.yaml` — Upgradeability and initialization flaws
|
|
125
|
+
- `reentrancy.yaml` — State change and external call ordering
|
|
126
|
+
- `signature.yaml` — Malleability and replay protection
|
|
127
|
+
|
|
128
|
+
#### Custom Pattern Packs
|
|
129
|
+
|
|
130
|
+
You can create custom pattern packs by adding YAML files to your configured `customSkillsDir`. Each pack must follow this structure:
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
pack_name: "My Custom Pack"
|
|
134
|
+
pack_version: "1.0"
|
|
135
|
+
patterns:
|
|
136
|
+
- name: "Insecure Transfer"
|
|
137
|
+
category: "access-control"
|
|
138
|
+
severity: "High"
|
|
139
|
+
regex: "transfer\\(msg\\.sender, .+\\)"
|
|
140
|
+
description: "Detects potentially insecure transfers to the caller"
|
|
141
|
+
```
|
|
142
|
+
|
|
114
143
|
**SCVD Integration:** The plugin connects to [api.scvd.dev](https://api.scvd.dev) for 7,769+ real-world audit findings. Sync with `argus_sync_knowledge` or configure `knowledge.autoSync: true`.
|
|
115
144
|
|
|
116
145
|
---
|
|
117
146
|
|
|
147
|
+
## Knowledge Ingestion Contract
|
|
148
|
+
|
|
149
|
+
All ingested knowledge sources must conform to a standardized metadata contract to ensure traceability, freshness, and compliance:
|
|
150
|
+
|
|
151
|
+
### Required Metadata Fields
|
|
152
|
+
|
|
153
|
+
Every knowledge source ingested into Argus must include:
|
|
154
|
+
|
|
155
|
+
- **`source`** — Human-readable source name (e.g., "Cyfrin", "Trail of Bits", "SCVD")
|
|
156
|
+
- **`url`** — Canonical URL to the source repository or API endpoint
|
|
157
|
+
- **`license`** — SPDX license identifier (e.g., "MIT", "Apache-2.0", "CC0")
|
|
158
|
+
- **`retrievedAt`** — ISO 8601 timestamp of when the knowledge was last fetched
|
|
159
|
+
- **`hash`** — SHA-256 hash of the ingested content for integrity verification
|
|
160
|
+
- **`version`** — Semantic version of the knowledge source (e.g., "1.2.3")
|
|
161
|
+
- **`provenance`** — Trust tier and source verification metadata
|
|
162
|
+
|
|
163
|
+
### Trust Tiers
|
|
164
|
+
|
|
165
|
+
Argus classifies knowledge sources into three trust tiers:
|
|
166
|
+
|
|
167
|
+
- **`bundled`** — Built-in skills and patterns. Highest trust, always available.
|
|
168
|
+
- **`companion`** — Installed separately (e.g., Trail of Bits). Medium trust.
|
|
169
|
+
- **`custom`** — User-provided skills in `customSkillsDir`. Lower trust, validated on load.
|
|
170
|
+
|
|
171
|
+
### Freshness Policy
|
|
172
|
+
|
|
173
|
+
Knowledge freshness is monitored automatically:
|
|
174
|
+
|
|
175
|
+
- **SCVD local index** — Stale if not synced within 7 days. `argus doctor` will warn if stale and suggest running `argus_sync_knowledge`.
|
|
176
|
+
- **Pattern packs** — Versioned via `PATTERN_PACK_VERSION` and updated on package release.
|
|
177
|
+
- **Baked-in curated skills** — Updated only on package release; no automatic refresh.
|
|
178
|
+
- **On-demand live sources** — Retrieved per-request; never cached locally.
|
|
179
|
+
|
|
180
|
+
`argus doctor` reports the staleness of all indexed sources.
|
|
181
|
+
|
|
182
|
+
### Three Operating Modes
|
|
183
|
+
|
|
184
|
+
Argus supports three distinct knowledge ingestion patterns:
|
|
185
|
+
|
|
186
|
+
#### 1. Baked-in Curated
|
|
187
|
+
**Sources:** Cyfrin audit checklists, kadenzipfel vulnerability patterns, DeFiFoFum protocol guides
|
|
188
|
+
|
|
189
|
+
- Bundled directly with the plugin package
|
|
190
|
+
- Updated only on package release (via npm/bun)
|
|
191
|
+
- No network calls required; instant availability
|
|
192
|
+
- Example: `skills/checklists/cyfrin-defi-core.md`
|
|
193
|
+
|
|
194
|
+
#### 2. On-Demand Live
|
|
195
|
+
**Sources:** Solodit audit reports, SCVD real-time queries
|
|
196
|
+
|
|
197
|
+
- Retrieved per-request from external APIs
|
|
198
|
+
- Never cached locally; always fresh
|
|
199
|
+
- Network-dependent; graceful fallback if unavailable
|
|
200
|
+
- Example: `argus_solodit_search` queries Solodit's database on each call
|
|
201
|
+
|
|
202
|
+
#### 3. Hybrid Indexed
|
|
203
|
+
**Sources:** SCVD local index, Trail of Bits companion skills
|
|
204
|
+
|
|
205
|
+
- Local index synced periodically via `argus_sync_knowledge`
|
|
206
|
+
- Cached locally in `~/.cache/opencode-argus/scvd-index.json`
|
|
207
|
+
- Refreshed on-demand when `knowledge.autoSync: true`
|
|
208
|
+
- Trail of Bits skills git-cloned on install and updated via companion plugin
|
|
209
|
+
- Example: SCVD findings indexed locally, queried without network latency
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
118
213
|
## Configuration
|
|
119
214
|
|
|
120
215
|
Create `.opencode/solidity-argus.jsonc` in your project root:
|
|
@@ -136,7 +231,8 @@ Create `.opencode/solidity-argus.jsonc` in your project root:
|
|
|
136
231
|
"knowledge": {
|
|
137
232
|
"scvd": { "enabled": true, "apiUrl": "https://api.scvd.dev" },
|
|
138
233
|
"autoSync": true,
|
|
139
|
-
"customSkillsDir": "./my-custom-skills"
|
|
234
|
+
"customSkillsDir": "./my-custom-skills",
|
|
235
|
+
"skillPrecedence": "bundled-first"
|
|
140
236
|
},
|
|
141
237
|
|
|
142
238
|
"reporting": {
|
|
@@ -160,6 +256,67 @@ Create `.opencode/solidity-argus.jsonc` in your project root:
|
|
|
160
256
|
|
|
161
257
|
---
|
|
162
258
|
|
|
259
|
+
## Context Delivery Architecture
|
|
260
|
+
|
|
261
|
+
Argus uses a **three-channel context delivery system** to inject dynamic audit state, methodology, and knowledge into agents at runtime. Each channel serves a distinct purpose:
|
|
262
|
+
|
|
263
|
+
### Decision Matrix: When to Use Each Channel
|
|
264
|
+
|
|
265
|
+
| Channel | Mechanism | Use Case | Scope | Mutability |
|
|
266
|
+
|---------|-----------|----------|-------|-----------|
|
|
267
|
+
| **Prompt** | Static agent identity files (`src/agents/*-prompt.ts`) | Methodology, personality, tool instructions, audit framework | Agent-specific | Never changes at runtime |
|
|
268
|
+
| **Hook** | `experimental.chat.system.transform` (agent-gated injection) | Audit progress, findings count, current phase, session state | Per-session | Changes every turn |
|
|
269
|
+
| **Skill-load** | `argus_skill_load` tool (on-demand) | Vulnerability patterns, protocol-specific knowledge, historical exploits | On-demand | Loaded when agent requests |
|
|
270
|
+
|
|
271
|
+
### Prompt Channel (Static Identity)
|
|
272
|
+
|
|
273
|
+
Each of the 4 Argus agents has a static prompt file defining its role, methodology, and tool instructions:
|
|
274
|
+
|
|
275
|
+
- `src/agents/argus-prompt.ts` — Orchestrator methodology (7-step audit framework)
|
|
276
|
+
- `src/agents/sentinel-prompt.ts` — Static analysis & testing instructions
|
|
277
|
+
- `src/agents/pythia-prompt.ts` — Vulnerability research methodology
|
|
278
|
+
- `src/agents/scribe-prompt.ts` — Report generation format and structure
|
|
279
|
+
|
|
280
|
+
These prompts **never change at runtime** and establish the agent's core identity and decision-making framework.
|
|
281
|
+
|
|
282
|
+
### Hook Channel (Dynamic State Injection)
|
|
283
|
+
|
|
284
|
+
The `experimental.chat.system.transform` hook injects dynamic audit state into the system context on every turn. This includes:
|
|
285
|
+
|
|
286
|
+
- Current audit phase (Reconnaissance, Automated Scanning, etc.)
|
|
287
|
+
- Findings discovered so far (count, severity distribution)
|
|
288
|
+
- Tools executed and their results
|
|
289
|
+
- Session-specific audit state (contract under review, scope, etc.)
|
|
290
|
+
|
|
291
|
+
**Critical Rule:** This hook is **Argus-family gated**. Only agents in `{argus, sentinel, pythia, scribe}` receive injected context. All other agents receive `undefined` (no injection).
|
|
292
|
+
|
|
293
|
+
**Session→Agent Mapping Pattern:**
|
|
294
|
+
1. `chat.params` hook captures `(sessionID, agentName)` pairs during each turn
|
|
295
|
+
2. `system.transform` hook looks up the agent by sessionID
|
|
296
|
+
3. If agent is in the Argus family, inject audit state; otherwise, return `undefined`
|
|
297
|
+
|
|
298
|
+
This prevents context pollution and ensures non-audit agents operate independently.
|
|
299
|
+
|
|
300
|
+
### Skill-Load Channel (On-Demand Knowledge)
|
|
301
|
+
|
|
302
|
+
Agents load specialized knowledge on-demand via the `argus_skill_load` tool:
|
|
303
|
+
|
|
304
|
+
- **Vulnerability Patterns** — 38 SKILL.md files covering reentrancy, oracle manipulation, flash loans, etc.
|
|
305
|
+
- **Protocol Patterns** — 5 files for AMM/DEX, bridges, governance, lending, staking
|
|
306
|
+
- **Methodology** — 3 files for audit workflow, report templates, severity classification
|
|
307
|
+
- **Checklists** — 6 Cyfrin audit checklists
|
|
308
|
+
- **References** — 2 files for exploit index and vulnerable contract examples
|
|
309
|
+
|
|
310
|
+
This channel is **lazy-loaded** — agents request skills only when needed, reducing context overhead.
|
|
311
|
+
|
|
312
|
+
### Implementation Notes
|
|
313
|
+
|
|
314
|
+
- **Phase 1 (Current):** `system.transform` is `undefined` (line 84 in `src/create-hooks.ts`). Agent-gated injection will replace this in Phase 2.
|
|
315
|
+
- **Global transforms forbidden:** No global system context injection unless agent-gated and minimal. Prevents context window overflow.
|
|
316
|
+
- **Audit state persistence:** State is saved to `.opencode/argus-state.json` and restored on session restart (see `Persistent Audit State` section).
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
163
320
|
## New in v2: Modular Architecture
|
|
164
321
|
|
|
165
322
|
This release restructures solidity-argus into a modular factory-based architecture with several new infrastructure features:
|
|
@@ -175,6 +332,9 @@ argus doctor
|
|
|
175
332
|
# Generate a starter .opencode/solidity-argus.jsonc config
|
|
176
333
|
argus init
|
|
177
334
|
|
|
335
|
+
# Validate SKILL.md files against schema
|
|
336
|
+
argus lint-skills
|
|
337
|
+
|
|
178
338
|
# Install optional dependencies (Slither, Foundry)
|
|
179
339
|
argus install
|
|
180
340
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solidity-argus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Solidity smart contract security auditing plugin for OpenCode — 4 specialized agents, 8 tools, and a curated vulnerability knowledge base",
|
|
5
5
|
"keywords": ["solidity", "security", "audit", "opencode", "plugin", "smart-contract", "ethereum", "defi", "slither", "foundry"],
|
|
6
6
|
"author": "Apegurus",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"init": "bun src/cli/index.ts init"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"yaml": "^2.8.2",
|
|
29
30
|
"zod": "^4.3.6"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
@@ -40,5 +41,7 @@
|
|
|
40
41
|
"type": "git",
|
|
41
42
|
"url": "https://github.com/Apegurus/solidity-argus"
|
|
42
43
|
},
|
|
43
|
-
"engines": {
|
|
44
|
+
"engines": {
|
|
45
|
+
"bun": ">=1.0.0"
|
|
46
|
+
}
|
|
44
47
|
}
|
package/skills/README.md
CHANGED
|
@@ -21,6 +21,12 @@ OpenCode Skills System
|
|
|
21
21
|
|
|
22
22
|
## Source Attribution
|
|
23
23
|
|
|
24
|
+
All sources in the table below must include the following metadata in their SKILL.md frontmatter or index entry:
|
|
25
|
+
- **Source name** — Human-readable identifier (e.g., "Cyfrin", "Trail of Bits")
|
|
26
|
+
- **URL** — Canonical link to the source repository or API endpoint
|
|
27
|
+
- **License identifier** — SPDX license code (e.g., "MIT", "Apache-2.0", "CC0")
|
|
28
|
+
- **Last-verified date** — ISO 8601 timestamp of when the source was last checked for updates
|
|
29
|
+
|
|
24
30
|
| Source | License | URL | What Was Imported |
|
|
25
31
|
|--------|---------|-----|-------------------|
|
|
26
32
|
| DeFiFoFum/fofum-solidity-skills | MIT | https://github.com/DeFiFoFum/fofum-solidity-skills | 15 SKILL.md files: methodology, vulnerability patterns, protocol patterns |
|
|
@@ -38,6 +44,16 @@ Contributors can add custom skills using this format:
|
|
|
38
44
|
---
|
|
39
45
|
name: topic-name # Must match parent directory name
|
|
40
46
|
description: One sentence description (1-1024 chars)
|
|
47
|
+
version: 1.0.0 # Optional semver
|
|
48
|
+
category: vulnerability-pattern # methodology, protocol-pattern, checklist, reference
|
|
49
|
+
provenance:
|
|
50
|
+
source: "Author Name"
|
|
51
|
+
license: "MIT"
|
|
52
|
+
lastVerified: "2024-01-01"
|
|
53
|
+
detection_rules:
|
|
54
|
+
- regex: "pattern here"
|
|
55
|
+
severity: "High"
|
|
56
|
+
description: "What this detects"
|
|
41
57
|
---
|
|
42
58
|
<!-- Source: Author/repo (License) -->
|
|
43
59
|
|
|
@@ -51,6 +67,53 @@ description: One sentence description (1-1024 chars)
|
|
|
51
67
|
|
|
52
68
|
To add your own skills, use the `knowledge.customSkillsDir` configuration option in your `opencode-argus.jsonc` file. Point this to a directory containing your custom `SKILL.md` files organized into subdirectories.
|
|
53
69
|
|
|
70
|
+
### Skill Overrides
|
|
71
|
+
|
|
72
|
+
By default, built-in skills take priority. You can change this behavior using the `skillPrecedence` option:
|
|
73
|
+
|
|
74
|
+
```jsonc
|
|
75
|
+
"knowledge": {
|
|
76
|
+
"skillPrecedence": "custom-first"
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
When set to `custom-first`, skills in your `customSkillsDir` will override built-in skills with the same name. All custom skills must have valid frontmatter with at least `name` and `description` fields.
|
|
81
|
+
|
|
82
|
+
## Pattern Pack Authoring
|
|
83
|
+
|
|
84
|
+
Pattern packs are YAML files that define collections of regex-based vulnerability detectors.
|
|
85
|
+
|
|
86
|
+
### Structure
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
pack_name: "My Security Pack"
|
|
90
|
+
pack_version: "1.1"
|
|
91
|
+
patterns:
|
|
92
|
+
- name: "Unprotected Selfdestruct"
|
|
93
|
+
category: "access-control"
|
|
94
|
+
severity: "Critical"
|
|
95
|
+
regex: "selfdestruct\\("
|
|
96
|
+
description: "Detects use of selfdestruct which may be unprotected"
|
|
97
|
+
swc: "SWC-106"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Available Categories
|
|
101
|
+
|
|
102
|
+
- `reentrancy`
|
|
103
|
+
- `oracle-manipulation`
|
|
104
|
+
- `flash-loan`
|
|
105
|
+
- `access-control`
|
|
106
|
+
- `erc4626`
|
|
107
|
+
- `proxy`
|
|
108
|
+
- `signature`
|
|
109
|
+
- `dos`
|
|
110
|
+
- `front-running`
|
|
111
|
+
- `governance`
|
|
112
|
+
- `token-standard`
|
|
113
|
+
- `gas-optimization`
|
|
114
|
+
- `logic-error`
|
|
115
|
+
- `delegatecall`
|
|
116
|
+
|
|
54
117
|
## Inventory
|
|
55
118
|
|
|
56
119
|
See [INVENTORY.md](./INVENTORY.md) for a complete listing of all 55 SKILL.md files currently bundled with Argus.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cyfrin-defi-core
|
|
3
3
|
description: Cyfrin DeFi checklist covering attacker mindset and protocol-level DeFi primitives
|
|
4
|
+
source_url: https://github.com/Cyfrin/audit-checklist
|
|
5
|
+
source_license: unspecified
|
|
6
|
+
imported_at: "2025-01-15T00:00:00Z"
|
|
4
7
|
---
|
|
5
8
|
<!-- Source: Cyfrin/audit-checklist -->
|
|
6
9
|
<!-- Auto-generated from https://github.com/Cyfrin/audit-checklist -->
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cyfrin",
|
|
3
|
+
"mode": "baked-in",
|
|
4
|
+
"url": "https://github.com/Cyfrin/audit-checklist",
|
|
5
|
+
"license": "unspecified",
|
|
6
|
+
"updateCadence": "per-release",
|
|
7
|
+
"lastVerified": "2026-02-19",
|
|
8
|
+
"files": [
|
|
9
|
+
"checklists/cyfrin-best-practices-runtime/SKILL.md",
|
|
10
|
+
"checklists/cyfrin-best-practices-upgrades/SKILL.md",
|
|
11
|
+
"checklists/cyfrin-defi-core/SKILL.md",
|
|
12
|
+
"checklists/cyfrin-defi-integrations/SKILL.md",
|
|
13
|
+
"checklists/cyfrin-gas/SKILL.md",
|
|
14
|
+
"checklists/general-audit/SKILL.md"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "defifofum",
|
|
3
|
+
"mode": "baked-in",
|
|
4
|
+
"url": "https://github.com/DeFiFoFum/fofum-solidity-skills",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"updateCadence": "per-release",
|
|
7
|
+
"lastVerified": "2026-02-19",
|
|
8
|
+
"files": [
|
|
9
|
+
"vulnerability-patterns/access-control/SKILL.md",
|
|
10
|
+
"vulnerability-patterns/flash-loan-attacks/SKILL.md",
|
|
11
|
+
"vulnerability-patterns/logic-errors/SKILL.md",
|
|
12
|
+
"vulnerability-patterns/oracle-manipulation/SKILL.md",
|
|
13
|
+
"vulnerability-patterns/reentrancy/SKILL.md",
|
|
14
|
+
"vulnerability-patterns/weird-tokens/SKILL.md",
|
|
15
|
+
"methodology/audit-workflow/SKILL.md",
|
|
16
|
+
"methodology/report-template/SKILL.md",
|
|
17
|
+
"methodology/severity-classification/SKILL.md",
|
|
18
|
+
"protocol-patterns/amm-dex/SKILL.md",
|
|
19
|
+
"protocol-patterns/bridges-cross-chain/SKILL.md",
|
|
20
|
+
"protocol-patterns/dao-governance/SKILL.md",
|
|
21
|
+
"protocol-patterns/lending-borrowing/SKILL.md",
|
|
22
|
+
"protocol-patterns/staking-vesting/SKILL.md",
|
|
23
|
+
"checklists/general-audit/SKILL.md"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kadenzipfel",
|
|
3
|
+
"mode": "baked-in",
|
|
4
|
+
"url": "https://github.com/kadenzipfel/smart-contract-vulnerabilities",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"updateCadence": "per-release",
|
|
7
|
+
"lastVerified": "2026-02-19",
|
|
8
|
+
"files": [
|
|
9
|
+
"vulnerability-patterns/access-control/SKILL.md",
|
|
10
|
+
"vulnerability-patterns/arbitrary-storage-location/SKILL.md",
|
|
11
|
+
"vulnerability-patterns/assert-violation/SKILL.md",
|
|
12
|
+
"vulnerability-patterns/asserting-contract-from-code-size/SKILL.md",
|
|
13
|
+
"vulnerability-patterns/authorization-txorigin/SKILL.md",
|
|
14
|
+
"vulnerability-patterns/default-visibility/SKILL.md",
|
|
15
|
+
"vulnerability-patterns/delegatecall-untrusted-callee/SKILL.md",
|
|
16
|
+
"vulnerability-patterns/dos-gas-limit/SKILL.md",
|
|
17
|
+
"vulnerability-patterns/dos-revert/SKILL.md",
|
|
18
|
+
"vulnerability-patterns/flash-loan-attacks/SKILL.md",
|
|
19
|
+
"vulnerability-patterns/floating-pragma/SKILL.md",
|
|
20
|
+
"vulnerability-patterns/hash-collision/SKILL.md",
|
|
21
|
+
"vulnerability-patterns/inadherence-to-standards/SKILL.md",
|
|
22
|
+
"vulnerability-patterns/incorrect-constructor/SKILL.md",
|
|
23
|
+
"vulnerability-patterns/incorrect-inheritance-order/SKILL.md",
|
|
24
|
+
"vulnerability-patterns/insufficient-gas-griefing/SKILL.md",
|
|
25
|
+
"vulnerability-patterns/lack-of-precision/SKILL.md",
|
|
26
|
+
"vulnerability-patterns/logic-errors/SKILL.md",
|
|
27
|
+
"vulnerability-patterns/missing-protection-signature-replay/SKILL.md",
|
|
28
|
+
"vulnerability-patterns/msgvalue-loop/SKILL.md",
|
|
29
|
+
"vulnerability-patterns/off-by-one/SKILL.md",
|
|
30
|
+
"vulnerability-patterns/oracle-manipulation/SKILL.md",
|
|
31
|
+
"vulnerability-patterns/outdated-compiler-version/SKILL.md",
|
|
32
|
+
"vulnerability-patterns/overflow-underflow/SKILL.md",
|
|
33
|
+
"vulnerability-patterns/reentrancy/SKILL.md",
|
|
34
|
+
"vulnerability-patterns/shadowing-state-variables/SKILL.md",
|
|
35
|
+
"vulnerability-patterns/signature-malleability/SKILL.md",
|
|
36
|
+
"vulnerability-patterns/unbounded-return-data/SKILL.md",
|
|
37
|
+
"vulnerability-patterns/unchecked-return-values/SKILL.md",
|
|
38
|
+
"vulnerability-patterns/unencrypted-private-data-on-chain/SKILL.md",
|
|
39
|
+
"vulnerability-patterns/unexpected-ecrecover-null-address/SKILL.md",
|
|
40
|
+
"vulnerability-patterns/uninitialized-storage-pointer/SKILL.md",
|
|
41
|
+
"vulnerability-patterns/unsafe-low-level-call/SKILL.md",
|
|
42
|
+
"vulnerability-patterns/unsecure-signatures/SKILL.md",
|
|
43
|
+
"vulnerability-patterns/unsupported-opcodes/SKILL.md",
|
|
44
|
+
"vulnerability-patterns/unused-variables/SKILL.md",
|
|
45
|
+
"vulnerability-patterns/use-of-deprecated-functions/SKILL.md",
|
|
46
|
+
"vulnerability-patterns/weak-sources-randomness/SKILL.md"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "smartbugs",
|
|
3
|
+
"mode": "baked-in",
|
|
4
|
+
"url": "https://github.com/smartbugs/smartbugs-curated",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"updateCadence": "per-release",
|
|
7
|
+
"lastVerified": "2026-02-19",
|
|
8
|
+
"files": [
|
|
9
|
+
"references/smartbugs-examples/SKILL.md"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sunweb3sec",
|
|
3
|
+
"mode": "baked-in",
|
|
4
|
+
"url": "https://github.com/SunWeb3Sec/DeFiHackLabs",
|
|
5
|
+
"license": "reference-only",
|
|
6
|
+
"updateCadence": "per-release",
|
|
7
|
+
"lastVerified": "2026-02-19",
|
|
8
|
+
"files": [
|
|
9
|
+
"references/exploit-reference/SKILL.md"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: audit-workflow
|
|
3
3
|
description: Five-phase Solidity audit workflow covering recon, static analysis, manual review, verification, and reporting.
|
|
4
|
+
source_url: https://github.com/DeFiFoFum/fofum-solidity-skills
|
|
5
|
+
source_license: MIT
|
|
6
|
+
imported_at: "2025-01-15T00:00:00Z"
|
|
4
7
|
---
|
|
5
8
|
<!-- Source: DeFiFoFum/fofum-solidity-skills (MIT) -->
|
|
6
9
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
pack_name: access-control
|
|
2
|
+
pack_version: "1.0"
|
|
3
|
+
patterns:
|
|
4
|
+
- name: missing-access-modifier
|
|
5
|
+
category: access-control
|
|
6
|
+
severity: High
|
|
7
|
+
swc: SWC-105
|
|
8
|
+
confidence: Low
|
|
9
|
+
version: "1.0"
|
|
10
|
+
regex: 'function\s+\w+\s*\([^)]*\)\s+(external|public)'
|
|
11
|
+
description: External or public function — verify appropriate access control modifiers (onlyOwner, onlyRole, require(msg.sender)) are applied
|
|
12
|
+
remediation: Add access control modifiers to sensitive functions; use OpenZeppelin AccessControl or Ownable patterns
|
|
13
|
+
|
|
14
|
+
- name: unprotected-initialize
|
|
15
|
+
category: access-control
|
|
16
|
+
severity: Critical
|
|
17
|
+
confidence: High
|
|
18
|
+
version: "1.0"
|
|
19
|
+
regex: 'function\s+initialize'
|
|
20
|
+
description: Initializer function detected — if missing initializer modifier, anyone can call and take ownership of the contract
|
|
21
|
+
remediation: Use OpenZeppelin Initializable with initializer modifier; call _disableInitializers() in constructor for implementation contracts
|
|
22
|
+
|
|
23
|
+
- name: default-visibility
|
|
24
|
+
category: access-control
|
|
25
|
+
severity: Medium
|
|
26
|
+
swc: SWC-100
|
|
27
|
+
confidence: Low
|
|
28
|
+
version: "1.0"
|
|
29
|
+
regex: 'function\s+\w+\s*\([^)]*\)\s*\{'
|
|
30
|
+
description: Function without explicit visibility specifier — defaults to public in older Solidity versions, potentially exposing internal logic
|
|
31
|
+
remediation: Always specify visibility (external, public, internal, private) explicitly for every function
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
pack_name: erc4626
|
|
2
|
+
pack_version: "1.0"
|
|
3
|
+
patterns:
|
|
4
|
+
- name: inflation-attack
|
|
5
|
+
category: erc4626
|
|
6
|
+
severity: Critical
|
|
7
|
+
confidence: High
|
|
8
|
+
version: "1.0"
|
|
9
|
+
regex: 'deposit.*totalSupply.*==.*0|convertToShares.*totalSupply'
|
|
10
|
+
description: ERC-4626 vault first-depositor inflation attack — attacker can donate assets to vault before first deposit to manipulate share price and steal subsequent deposits
|
|
11
|
+
remediation: Mint dead shares on first deposit (e.g., 10**3 to address(0)); use virtual offset in share calculation; set minimum deposit amount
|
|
12
|
+
|
|
13
|
+
- name: donation-attack
|
|
14
|
+
category: erc4626
|
|
15
|
+
severity: High
|
|
16
|
+
confidence: Medium
|
|
17
|
+
version: "1.0"
|
|
18
|
+
regex: 'balanceOf.*address.*this.*totalAssets|asset\.balanceOf'
|
|
19
|
+
description: Vault totalAssets derived from balanceOf — vulnerable to donation attack where attacker sends assets directly to inflate share price
|
|
20
|
+
remediation: Use internal accounting for totalAssets instead of balanceOf; track deposits and withdrawals explicitly
|
|
21
|
+
|
|
22
|
+
- name: rounding-error
|
|
23
|
+
category: erc4626
|
|
24
|
+
severity: Medium
|
|
25
|
+
confidence: Medium
|
|
26
|
+
version: "1.0"
|
|
27
|
+
regex: 'mulDiv|roundUp|roundDown|FullMath'
|
|
28
|
+
description: Custom rounding math in vault share calculations — potential rounding errors that favor attacker (round down on deposit, round up on withdraw)
|
|
29
|
+
remediation: Round against the user (down on deposit/mint, up on withdraw/redeem); use OpenZeppelin Math.mulDiv with explicit rounding direction
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
pack_name: flash-loan
|
|
2
|
+
pack_version: "1.0"
|
|
3
|
+
patterns:
|
|
4
|
+
- name: unchecked-flash-return
|
|
5
|
+
category: flash-loan
|
|
6
|
+
severity: High
|
|
7
|
+
confidence: Medium
|
|
8
|
+
version: "1.0"
|
|
9
|
+
regex: 'flashLoan|flashBorrow'
|
|
10
|
+
description: Flash loan invocation without verified return — borrowed funds may not be repaid if return value is not checked
|
|
11
|
+
remediation: Verify flash loan callback returns expected success value; check token balance after repayment; use established flash loan receiver interfaces
|
|
12
|
+
|
|
13
|
+
- name: balance-inflation
|
|
14
|
+
category: flash-loan
|
|
15
|
+
severity: Medium
|
|
16
|
+
confidence: Medium
|
|
17
|
+
version: "1.0"
|
|
18
|
+
regex: 'balanceOf\(address\(this\)\)'
|
|
19
|
+
description: Contract reads its own token balance — vulnerable to donation/inflation attacks where attacker sends tokens directly to manipulate balance-dependent logic
|
|
20
|
+
remediation: Track balances via internal accounting instead of balanceOf(address(this)); use shares-based accounting for vaults
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
pack_name: oracle-manipulation
|
|
2
|
+
pack_version: "1.0"
|
|
3
|
+
patterns:
|
|
4
|
+
- name: stale-price-check
|
|
5
|
+
category: oracle-manipulation
|
|
6
|
+
severity: High
|
|
7
|
+
swc: SWC-120
|
|
8
|
+
confidence: High
|
|
9
|
+
version: "1.0"
|
|
10
|
+
regex: 'latestRoundData|getPrice'
|
|
11
|
+
description: Oracle price feed usage — verify staleness checks (updatedAt, roundId) are enforced to prevent using outdated prices
|
|
12
|
+
remediation: Add require(updatedAt > block.timestamp - MAX_STALENESS) after latestRoundData calls; check answeredInRound >= roundId
|
|
13
|
+
|
|
14
|
+
- name: twap-manipulation
|
|
15
|
+
category: oracle-manipulation
|
|
16
|
+
severity: Medium
|
|
17
|
+
confidence: Medium
|
|
18
|
+
version: "1.0"
|
|
19
|
+
regex: 'observe\(|consult\('
|
|
20
|
+
description: TWAP oracle usage — time-weighted average prices can be manipulated via sustained trading pressure within the observation window
|
|
21
|
+
remediation: Use sufficiently long TWAP windows (30+ minutes); combine with spot price deviation checks; add circuit breakers
|
|
22
|
+
|
|
23
|
+
- name: price-feed-decimals
|
|
24
|
+
category: oracle-manipulation
|
|
25
|
+
severity: Medium
|
|
26
|
+
confidence: Medium
|
|
27
|
+
version: "1.0"
|
|
28
|
+
regex: 'priceFeed|oracle.*decimals'
|
|
29
|
+
description: Oracle price feed with decimal handling — potential decimal mismatch between oracle feed (8 decimals) and token (18 decimals)
|
|
30
|
+
remediation: Normalize oracle response to consistent decimals; use oracle.decimals() dynamically rather than hardcoded values
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
pack_name: proxy
|
|
2
|
+
pack_version: "1.0"
|
|
3
|
+
patterns:
|
|
4
|
+
- name: storage-collision
|
|
5
|
+
category: proxy
|
|
6
|
+
severity: Critical
|
|
7
|
+
swc: SWC-112
|
|
8
|
+
confidence: Medium
|
|
9
|
+
version: "1.0"
|
|
10
|
+
regex: 'delegatecall|IMPLEMENTATION_SLOT'
|
|
11
|
+
description: Delegatecall or implementation slot usage — potential storage collision between proxy and implementation contracts if storage layouts diverge
|
|
12
|
+
remediation: Use EIP-1967 standard storage slots; use OpenZeppelin TransparentUpgradeableProxy or UUPS; verify storage layout compatibility on upgrades
|
|
13
|
+
|
|
14
|
+
- name: uninitialized-proxy
|
|
15
|
+
category: proxy
|
|
16
|
+
severity: High
|
|
17
|
+
confidence: Medium
|
|
18
|
+
version: "1.0"
|
|
19
|
+
regex: '_disableInitializers|initializer'
|
|
20
|
+
description: Proxy initialization pattern detected — verify implementation contract calls _disableInitializers() in constructor and proxy calls initialize()
|
|
21
|
+
remediation: Call _disableInitializers() in implementation constructor; ensure initialize() is called atomically during proxy deployment
|
|
22
|
+
|
|
23
|
+
- name: selector-clash
|
|
24
|
+
category: proxy
|
|
25
|
+
severity: Medium
|
|
26
|
+
confidence: Low
|
|
27
|
+
version: "1.0"
|
|
28
|
+
regex: 'fallback\(\)|receive\(\).*delegatecall'
|
|
29
|
+
description: Fallback or receive function with delegatecall — risk of function selector clash between proxy admin functions and implementation functions
|
|
30
|
+
remediation: Use TransparentUpgradeableProxy pattern to separate admin and user call paths; verify no selector collisions with implementation ABI
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
pack_name: reentrancy
|
|
2
|
+
pack_version: "1.0"
|
|
3
|
+
patterns:
|
|
4
|
+
- name: reentrancy-eth-transfer
|
|
5
|
+
category: reentrancy
|
|
6
|
+
severity: High
|
|
7
|
+
swc: SWC-107
|
|
8
|
+
confidence: High
|
|
9
|
+
version: "1.0"
|
|
10
|
+
regex: '\.call\{value:'
|
|
11
|
+
description: ETH transfer via low-level call — classic reentrancy vector where external call is made before state updates
|
|
12
|
+
remediation: Apply checks-effects-interactions pattern; use ReentrancyGuard; update state before external calls
|
|
13
|
+
|
|
14
|
+
- name: reentrancy-erc20
|
|
15
|
+
category: reentrancy
|
|
16
|
+
severity: Medium
|
|
17
|
+
confidence: Medium
|
|
18
|
+
version: "1.0"
|
|
19
|
+
regex: '\.(transfer|transferFrom)\('
|
|
20
|
+
description: ERC-20 token transfer that may precede state changes — potential reentrancy via token callback hooks (ERC-777, ERC-1155)
|
|
21
|
+
remediation: Update state variables before token transfers; use ReentrancyGuard for functions with external token interactions
|
|
22
|
+
|
|
23
|
+
- name: cross-function-reentrancy
|
|
24
|
+
category: reentrancy
|
|
25
|
+
severity: High
|
|
26
|
+
confidence: Low
|
|
27
|
+
version: "1.0"
|
|
28
|
+
regex: '(external|public)\s.*\{[^}]*\.call'
|
|
29
|
+
description: Public or external function containing a low-level call — potential cross-function reentrancy if shared state is read by other functions
|
|
30
|
+
remediation: Use ReentrancyGuard on all functions sharing mutable state; apply checks-effects-interactions across the contract
|