solidity-argus 0.1.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/AGENTS.md +37 -0
- package/LICENSE +21 -0
- package/README.md +249 -0
- package/package.json +43 -0
- package/skills/INVENTORY.md +79 -0
- package/skills/README.md +56 -0
- package/skills/checklists/cyfrin-best-practices-runtime/SKILL.md +424 -0
- package/skills/checklists/cyfrin-best-practices-upgrades/SKILL.md +157 -0
- package/skills/checklists/cyfrin-defi-core/SKILL.md +373 -0
- package/skills/checklists/cyfrin-defi-integrations/SKILL.md +412 -0
- package/skills/checklists/cyfrin-gas/SKILL.md +55 -0
- package/skills/checklists/general-audit/SKILL.md +433 -0
- package/skills/methodology/audit-workflow/SKILL.md +129 -0
- package/skills/methodology/report-template/SKILL.md +190 -0
- package/skills/methodology/severity-classification/SKILL.md +179 -0
- package/skills/protocol-patterns/amm-dex/SKILL.md +229 -0
- package/skills/protocol-patterns/bridges-cross-chain/SKILL.md +317 -0
- package/skills/protocol-patterns/dao-governance/SKILL.md +281 -0
- package/skills/protocol-patterns/lending-borrowing/SKILL.md +221 -0
- package/skills/protocol-patterns/staking-vesting/SKILL.md +247 -0
- package/skills/references/exploit-reference/SKILL.md +259 -0
- package/skills/references/smartbugs-examples/SKILL.md +296 -0
- package/skills/vulnerability-patterns/access-control/SKILL.md +298 -0
- package/skills/vulnerability-patterns/arbitrary-storage-location/SKILL.md +59 -0
- package/skills/vulnerability-patterns/assert-violation/SKILL.md +59 -0
- package/skills/vulnerability-patterns/asserting-contract-from-code-size/SKILL.md +61 -0
- package/skills/vulnerability-patterns/authorization-txorigin/SKILL.md +55 -0
- package/skills/vulnerability-patterns/default-visibility/SKILL.md +62 -0
- package/skills/vulnerability-patterns/delegatecall-untrusted-callee/SKILL.md +60 -0
- package/skills/vulnerability-patterns/dos-gas-limit/SKILL.md +59 -0
- package/skills/vulnerability-patterns/dos-revert/SKILL.md +72 -0
- package/skills/vulnerability-patterns/flash-loan-attacks/SKILL.md +249 -0
- package/skills/vulnerability-patterns/floating-pragma/SKILL.md +51 -0
- package/skills/vulnerability-patterns/hash-collision/SKILL.md +52 -0
- package/skills/vulnerability-patterns/inadherence-to-standards/SKILL.md +61 -0
- package/skills/vulnerability-patterns/incorrect-constructor/SKILL.md +60 -0
- package/skills/vulnerability-patterns/incorrect-inheritance-order/SKILL.md +59 -0
- package/skills/vulnerability-patterns/insufficient-gas-griefing/SKILL.md +61 -0
- package/skills/vulnerability-patterns/lack-of-precision/SKILL.md +61 -0
- package/skills/vulnerability-patterns/logic-errors/SKILL.md +333 -0
- package/skills/vulnerability-patterns/missing-protection-signature-replay/SKILL.md +60 -0
- package/skills/vulnerability-patterns/msgvalue-loop/SKILL.md +66 -0
- package/skills/vulnerability-patterns/off-by-one/SKILL.md +67 -0
- package/skills/vulnerability-patterns/oracle-manipulation/SKILL.md +252 -0
- package/skills/vulnerability-patterns/outdated-compiler-version/SKILL.md +65 -0
- package/skills/vulnerability-patterns/overflow-underflow/SKILL.md +61 -0
- package/skills/vulnerability-patterns/reentrancy/SKILL.md +266 -0
- package/skills/vulnerability-patterns/shadowing-state-variables/SKILL.md +72 -0
- package/skills/vulnerability-patterns/signature-malleability/SKILL.md +59 -0
- package/skills/vulnerability-patterns/unbounded-return-data/SKILL.md +63 -0
- package/skills/vulnerability-patterns/unchecked-return-values/SKILL.md +52 -0
- package/skills/vulnerability-patterns/unencrypted-private-data-on-chain/SKILL.md +65 -0
- package/skills/vulnerability-patterns/unexpected-ecrecover-null-address/SKILL.md +61 -0
- package/skills/vulnerability-patterns/uninitialized-storage-pointer/SKILL.md +63 -0
- package/skills/vulnerability-patterns/unsafe-low-level-call/SKILL.md +56 -0
- package/skills/vulnerability-patterns/unsecure-signatures/SKILL.md +80 -0
- package/skills/vulnerability-patterns/unsupported-opcodes/SKILL.md +69 -0
- package/skills/vulnerability-patterns/unused-variables/SKILL.md +70 -0
- package/skills/vulnerability-patterns/use-of-deprecated-functions/SKILL.md +81 -0
- package/skills/vulnerability-patterns/weak-sources-randomness/SKILL.md +77 -0
- package/skills/vulnerability-patterns/weird-tokens/SKILL.md +294 -0
- package/src/agents/argus-prompt.ts +407 -0
- package/src/agents/pythia-prompt.ts +134 -0
- package/src/agents/scribe-prompt.ts +87 -0
- package/src/agents/sentinel-prompt.ts +133 -0
- package/src/cli/cli-program.ts +67 -0
- package/src/cli/commands/doctor.ts +83 -0
- package/src/cli/commands/init.ts +46 -0
- package/src/cli/commands/install.ts +55 -0
- package/src/cli/index.ts +13 -0
- package/src/cli/tui-prompts.ts +75 -0
- package/src/cli/types.ts +9 -0
- package/src/config/index.ts +3 -0
- package/src/config/loader.ts +36 -0
- package/src/config/schema.ts +82 -0
- package/src/config/types.ts +4 -0
- package/src/constants/defaults.ts +6 -0
- package/src/create-hooks.ts +84 -0
- package/src/create-managers.ts +26 -0
- package/src/create-tools.ts +30 -0
- package/src/features/audit-enforcer/audit-enforcer.ts +34 -0
- package/src/features/audit-enforcer/index.ts +1 -0
- package/src/features/background-agent/background-manager.ts +200 -0
- package/src/features/background-agent/index.ts +1 -0
- package/src/features/context-monitor/context-monitor.ts +48 -0
- package/src/features/context-monitor/index.ts +4 -0
- package/src/features/context-monitor/tool-output-truncator.ts +17 -0
- package/src/features/error-recovery/index.ts +2 -0
- package/src/features/error-recovery/session-recovery.ts +27 -0
- package/src/features/error-recovery/tool-error-recovery.ts +35 -0
- package/src/features/index.ts +5 -0
- package/src/features/persistent-state/audit-state-manager.ts +121 -0
- package/src/features/persistent-state/index.ts +1 -0
- package/src/hooks/compaction-hook.ts +50 -0
- package/src/hooks/config-handler.ts +116 -0
- package/src/hooks/event-hook-v2.ts +93 -0
- package/src/hooks/event-hook.ts +74 -0
- package/src/hooks/hook-system.ts +9 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/knowledge-sync-hook.ts +57 -0
- package/src/hooks/safe-create-hook.ts +15 -0
- package/src/hooks/system-prompt-hook.ts +126 -0
- package/src/hooks/tool-tracking-hook.ts +234 -0
- package/src/hooks/types.ts +16 -0
- package/src/index.ts +36 -0
- package/src/knowledge/scvd-client.ts +242 -0
- package/src/knowledge/scvd-index.ts +183 -0
- package/src/knowledge/scvd-sync.ts +85 -0
- package/src/managers/index.ts +1 -0
- package/src/managers/types.ts +85 -0
- package/src/plugin-interface.ts +38 -0
- package/src/shared/binary-utils.ts +63 -0
- package/src/shared/deep-merge.ts +71 -0
- package/src/shared/file-utils.ts +56 -0
- package/src/shared/index.ts +5 -0
- package/src/shared/jsonc-parser.ts +39 -0
- package/src/shared/logger.ts +36 -0
- package/src/state/audit-state.ts +27 -0
- package/src/state/finding-store.ts +126 -0
- package/src/state/plugin-state.ts +14 -0
- package/src/state/types.ts +61 -0
- package/src/tools/contract-analyzer-tool.ts +184 -0
- package/src/tools/forge-fuzz-tool.ts +311 -0
- package/src/tools/forge-test-tool.ts +397 -0
- package/src/tools/pattern-checker-tool.ts +337 -0
- package/src/tools/report-generator-tool.ts +308 -0
- package/src/tools/slither-tool.ts +465 -0
- package/src/tools/solodit-search-tool.ts +131 -0
- package/src/tools/sync-knowledge-tool.ts +116 -0
- package/src/utils/project-detector.ts +133 -0
- package/src/utils/solidity-parser.ts +174 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: exploit-reference
|
|
3
|
+
description: Reference guide to major DeFi exploits and reproducible Foundry workflows from DeFiHackLabs
|
|
4
|
+
---
|
|
5
|
+
<!-- Source: SunWeb3Sec/DeFiHackLabs (reference only, no license) -->
|
|
6
|
+
|
|
7
|
+
# DeFi Exploit Reference Index
|
|
8
|
+
|
|
9
|
+
Curated quick-reference table of major DeFi exploit reproductions from DeFiHackLabs.
|
|
10
|
+
|
|
11
|
+
## Exploit Table
|
|
12
|
+
|
|
13
|
+
| Exploit | Primary Pattern | Foundry PoC |
|
|
14
|
+
|--------|------------------|-------------|
|
|
15
|
+
| The DAO (2016) | Reentrancy | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/TheDAO_exp.sol |
|
|
16
|
+
| Parity Wallet (2017) | Access Control | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Parity_exp.sol |
|
|
17
|
+
| bZx (2020) | Flash Loan + Oracle Manipulation | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/bZx_exp.sol |
|
|
18
|
+
| Harvest Finance (2020) | Flash Loan + Oracle Manipulation | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Harvest_exp.sol |
|
|
19
|
+
| Compound (2021) | Logic Error | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Compound_exp.sol |
|
|
20
|
+
| Cream Finance (2021) | Reentrancy | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Cream_exp.sol |
|
|
21
|
+
| Poly Network (2021) | Access Control / Cross-chain Validation | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/PolyNetwork_exp.sol |
|
|
22
|
+
| Wormhole (2022) | Signature Verification | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Wormhole_exp.sol |
|
|
23
|
+
| Ronin Bridge (2022) | Access Control | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Ronin_exp.sol |
|
|
24
|
+
| Beanstalk (2022) | Flash Loan + Governance | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Beanstalk_exp.sol |
|
|
25
|
+
| Nomad Bridge (2022) | Logic Error | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Nomad_exp.sol |
|
|
26
|
+
| Mango Markets (2022) | Flash Loan + Oracle Manipulation | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/MangoMarkets_exp.sol |
|
|
27
|
+
| Euler Finance (2023) | Flash Loan + Logic Error | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Euler_exp.sol |
|
|
28
|
+
| Wintermute (2022) | Access Control / Key Compromise | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/Wintermute_exp.sol |
|
|
29
|
+
| BadgerDAO (2021) | Access Control / Frontend Compromise | https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/BadgerDAO_exp.sol |
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
- Pair this reference with references/how-to-reproduce/SKILL.md for reproducible local exploit testing.
|
|
34
|
+
- Use these PoCs as regression templates when validating fixes for similar vulnerability classes.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Reproduction Workflow
|
|
39
|
+
|
|
40
|
+
Step-by-step guide for setting up [DeFiHackLabs](https://github.com/SunWeb3Sec/DeFiHackLabs) and running Foundry proof-of-concept exploit reproductions locally.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Prerequisites
|
|
45
|
+
|
|
46
|
+
Before cloning, ensure you have the following installed:
|
|
47
|
+
|
|
48
|
+
### 1. Foundry
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Install Foundry (includes forge, cast, anvil)
|
|
52
|
+
curl -L https://foundry.paradigm.xyz | bash
|
|
53
|
+
foundryup
|
|
54
|
+
|
|
55
|
+
# Verify installation
|
|
56
|
+
forge --version
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 2. RPC URL for Mainnet Fork
|
|
60
|
+
|
|
61
|
+
Most exploits require forking Ethereum mainnet at a specific block. You need an RPC endpoint:
|
|
62
|
+
|
|
63
|
+
- **Alchemy**: https://www.alchemy.com (free tier available)
|
|
64
|
+
- **Infura**: https://infura.io (free tier available)
|
|
65
|
+
- **Ankr**: https://www.ankr.com/rpc (public endpoints available)
|
|
66
|
+
|
|
67
|
+
Set your RPC URL as an environment variable:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
export ETH_RPC_URL="https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For BSC exploits:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export BSC_RPC_URL="https://bsc-dataseed.binance.org"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Step 1: Clone DeFiHackLabs
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/SunWeb3Sec/DeFiHackLabs
|
|
85
|
+
cd DeFiHackLabs
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Install Dependencies
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Install Foundry dependencies (forge-std, etc.)
|
|
92
|
+
forge install
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Step 2: Configure the Environment
|
|
98
|
+
|
|
99
|
+
Create a `.env` file in the project root (or export variables directly):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# .env
|
|
103
|
+
ETH_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
|
|
104
|
+
BSC_RPC_URL=https://bsc-dataseed.binance.org
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
> **Note:** DeFiHackLabs uses `vm.createSelectFork()` inside each test to fork at the exact exploit block. The RPC URL is read from the environment.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Step 3: Run a Specific Exploit
|
|
112
|
+
|
|
113
|
+
### Basic Command
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
forge test --match-contract TheDAO_exp -vvv --fork-url $ETH_RPC_URL
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Verbosity Levels
|
|
120
|
+
|
|
121
|
+
| Flag | Output |
|
|
122
|
+
|------|--------|
|
|
123
|
+
| `-v` | Test pass/fail only |
|
|
124
|
+
| `-vv` | Logs and events |
|
|
125
|
+
| `-vvv` | Call traces (recommended) |
|
|
126
|
+
| `-vvvv` | Full traces including reverts |
|
|
127
|
+
| `-vvvvv` | Maximum detail (very verbose) |
|
|
128
|
+
|
|
129
|
+
### Examples for Each Exploit
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# The DAO (2016) — Reentrancy
|
|
133
|
+
forge test --match-contract TheDAO_exp -vvv --fork-url $ETH_RPC_URL
|
|
134
|
+
|
|
135
|
+
# Euler Finance (2023) — Flash Loan + Logic
|
|
136
|
+
forge test --match-contract Euler_exp -vvv --fork-url $ETH_RPC_URL
|
|
137
|
+
|
|
138
|
+
# Beanstalk (2022) — Flash Loan + Governance
|
|
139
|
+
forge test --match-contract Beanstalk_exp -vvv --fork-url $ETH_RPC_URL
|
|
140
|
+
|
|
141
|
+
# Ronin Bridge (2022) — Access Control
|
|
142
|
+
forge test --match-contract Ronin_exp -vvv --fork-url $ETH_RPC_URL
|
|
143
|
+
|
|
144
|
+
# Nomad Bridge (2022) — Logic Error
|
|
145
|
+
forge test --match-contract Nomad_exp -vvv --fork-url $ETH_RPC_URL
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Step 4: Reading the Output
|
|
151
|
+
|
|
152
|
+
### Understanding Forge Traces
|
|
153
|
+
|
|
154
|
+
A typical trace looks like:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
[PASS] testExploit() (gas: 1234567)
|
|
158
|
+
Traces:
|
|
159
|
+
[1234567] TheDAO_exp::testExploit()
|
|
160
|
+
├─ [0] VM::createSelectFork(...)
|
|
161
|
+
├─ [50000] TheDAO::withdraw(1 ether)
|
|
162
|
+
│ ├─ [40000] Attacker::receive() ← REENTRANCY HERE
|
|
163
|
+
│ │ └─ [30000] TheDAO::withdraw(1 ether)
|
|
164
|
+
│ └─ ← ()
|
|
165
|
+
└─ ← ()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Key Things to Look For
|
|
169
|
+
|
|
170
|
+
1. **The setup block** — `vm.createSelectFork()` pins the fork to the exploit block
|
|
171
|
+
2. **Flash loan acquisition** — look for `flashLoan()` or `borrow()` calls early in the trace
|
|
172
|
+
3. **The vulnerable call** — the call that triggers the exploit (often marked with comments in the PoC)
|
|
173
|
+
4. **State manipulation** — watch for unexpected balance changes or storage writes
|
|
174
|
+
5. **Profit extraction** — the final transfer of stolen funds
|
|
175
|
+
|
|
176
|
+
### Checking Profit
|
|
177
|
+
|
|
178
|
+
Most PoCs log the attacker's profit:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
[console.log] Attacker profit: 197,000,000 USDC
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
If you see this, the exploit reproduced successfully.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Step 5: Adapting PoCs to Test New Contracts
|
|
189
|
+
|
|
190
|
+
Use DeFiHackLabs PoCs as templates when auditing similar protocols.
|
|
191
|
+
|
|
192
|
+
### Pattern: Adapting a Reentrancy PoC
|
|
193
|
+
|
|
194
|
+
1. **Copy the relevant PoC** (e.g., `TheDAO_exp.sol`) to your audit project
|
|
195
|
+
2. **Replace the target contract address** with the contract under audit
|
|
196
|
+
3. **Adjust the fork block** to a recent block where the contract is deployed
|
|
197
|
+
4. **Modify the attack steps** to match the new contract's interface
|
|
198
|
+
5. **Run and observe** — if the test passes, the vulnerability exists
|
|
199
|
+
|
|
200
|
+
```solidity
|
|
201
|
+
// Template structure of a DeFiHackLabs PoC
|
|
202
|
+
contract MyAudit_exp is Test {
|
|
203
|
+
// Target contract interface
|
|
204
|
+
IVulnerableProtocol target;
|
|
205
|
+
|
|
206
|
+
function setUp() public {
|
|
207
|
+
// Fork at a specific block
|
|
208
|
+
vm.createSelectFork("mainnet", BLOCK_NUMBER);
|
|
209
|
+
target = IVulnerableProtocol(TARGET_ADDRESS);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function testExploit() public {
|
|
213
|
+
uint256 balanceBefore = address(this).balance;
|
|
214
|
+
|
|
215
|
+
// Step 1: Acquire flash loan or initial capital
|
|
216
|
+
// Step 2: Execute the attack
|
|
217
|
+
// Step 3: Repay flash loan
|
|
218
|
+
|
|
219
|
+
uint256 profit = address(this).balance - balanceBefore;
|
|
220
|
+
console.log("Profit:", profit);
|
|
221
|
+
assertGt(profit, 0, "Exploit failed");
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Callback for reentrancy or flash loan repayment
|
|
225
|
+
receive() external payable {
|
|
226
|
+
// Re-enter if conditions met
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Tips for Effective PoC Adaptation
|
|
232
|
+
|
|
233
|
+
- **Match the block number** — use `cast block --rpc-url $ETH_RPC_URL latest` to get the current block
|
|
234
|
+
- **Use `vm.label()`** — label addresses for readable traces: `vm.label(address(target), "VulnerableProtocol")`
|
|
235
|
+
- **Add `console.log` checkpoints** — log balances before/after each step to trace the attack flow
|
|
236
|
+
- **Test the happy path first** — ensure the protocol works normally before testing the exploit
|
|
237
|
+
- **Use `vm.expectRevert()`** — verify that the fix (if applied) causes the exploit to revert
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Troubleshooting
|
|
242
|
+
|
|
243
|
+
| Problem | Solution |
|
|
244
|
+
|---------|----------|
|
|
245
|
+
| `RPC rate limit exceeded` | Use a paid RPC tier or add `--slow` flag |
|
|
246
|
+
| `Block not found` | The fork block may be too old for your RPC provider; try Alchemy Archive |
|
|
247
|
+
| `Contract not deployed at block` | Adjust the fork block to after the contract deployment |
|
|
248
|
+
| `Out of gas` | Increase gas limit: `--gas-limit 30000000` |
|
|
249
|
+
| `Compilation error` | Run `forge build` first to check for syntax errors |
|
|
250
|
+
| `Test not found` | Verify the contract name matches exactly with `--match-contract` |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Additional Resources
|
|
255
|
+
|
|
256
|
+
- **DeFiHackLabs Repository**: https://github.com/SunWeb3Sec/DeFiHackLabs
|
|
257
|
+
- **Foundry Book**: https://book.getfoundry.sh
|
|
258
|
+
- **Foundry Cheatcodes**: https://book.getfoundry.sh/cheatcodes/
|
|
259
|
+
- **Exploit Reference Table**: See `exploit-reference` skill for the full list of 15 exploits with GitHub URLs
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: smartbugs-examples
|
|
3
|
+
description: SmartBugs curated dataset — 143 annotated vulnerable Solidity contracts organized by DASP vulnerability category
|
|
4
|
+
---
|
|
5
|
+
<!-- Source: smartbugs/smartbugs-curated (Apache-2.0) -->
|
|
6
|
+
<!-- Auto-generated from https://github.com/smartbugs/smartbugs-curated -->
|
|
7
|
+
<!-- Total contracts: 143 -->
|
|
8
|
+
<!-- Categories: 10 -->
|
|
9
|
+
|
|
10
|
+
# SmartBugs Curated Dataset — Vulnerable Contract Examples
|
|
11
|
+
|
|
12
|
+
The [SmartBugs curated dataset](https://github.com/smartbugs/smartbugs-curated) is a collection of **143 annotated vulnerable Solidity contracts**, organized by the [DASP taxonomy](https://dasp.co/) of smart contract vulnerabilities.
|
|
13
|
+
|
|
14
|
+
Each contract includes line-level annotations identifying the exact location of vulnerabilities, making this dataset invaluable for:
|
|
15
|
+
- Testing static analysis tools
|
|
16
|
+
- Learning vulnerability patterns
|
|
17
|
+
- Building detection heuristics
|
|
18
|
+
|
|
19
|
+
> **Note:** Contracts are referenced via GitHub URLs — source files are NOT copied into this plugin.
|
|
20
|
+
|
|
21
|
+
## Dataset Overview
|
|
22
|
+
|
|
23
|
+
| DASP Category | Contracts |
|
|
24
|
+
|---------------|-----------|
|
|
25
|
+
| Access Control (DASP #2) | 18 |
|
|
26
|
+
| Arithmetic / Integer Overflow (DASP #3) | 15 |
|
|
27
|
+
| Bad Randomness (DASP #6) | 8 |
|
|
28
|
+
| Denial of Service (DASP #5) | 6 |
|
|
29
|
+
| Front Running (DASP #7) | 4 |
|
|
30
|
+
| Other / Uncategorized (DASP #10) | 3 |
|
|
31
|
+
| Reentrancy (DASP #1) | 31 |
|
|
32
|
+
| Short Addresses (DASP #9) | 1 |
|
|
33
|
+
| Time Manipulation (DASP #8) | 5 |
|
|
34
|
+
| Unchecked Low Level Calls (DASP #4) | 52 |
|
|
35
|
+
|
|
36
|
+
## Contracts by Category
|
|
37
|
+
|
|
38
|
+
### Access Control (DASP #2)
|
|
39
|
+
|
|
40
|
+
| Contract | Vulnerable Lines | Source |
|
|
41
|
+
|----------|-----------------|--------|
|
|
42
|
+
| [FibonacciBalance.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/FibonacciBalance.sol) | 31; 38 | https://github.com/sigp/solidity-security-blog |
|
|
43
|
+
| [arbitrary_location_write_simple.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/arbitrary_location_write_simple.sol) | 27 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
44
|
+
| [incorrect_constructor_name1.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/incorrect_constructor_name1.sol) | 20 | https://github.com/trailofbits/not-so-smart-contracts/blo... |
|
|
45
|
+
| [incorrect_constructor_name2.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/incorrect_constructor_name2.sol) | 18 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
46
|
+
| [incorrect_constructor_name3.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/incorrect_constructor_name3.sol) | 17 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
47
|
+
| [mapping_write.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/mapping_write.sol) | 20 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
48
|
+
| [multiowned_vulnerable.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/multiowned_vulnerable.sol) | 38 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
49
|
+
| [mycontract.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/mycontract.sol) | 20 | https://consensys.github.io/smart-contract-best-practices... |
|
|
50
|
+
| [parity_wallet_bug_1.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/parity_wallet_bug_1.sol) | 223; 437 | https://github.com/paritytech/parity-ethereum/blob/4d08e7... |
|
|
51
|
+
| [parity_wallet_bug_2.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/parity_wallet_bug_2.sol) | 226; 233 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
52
|
+
| [phishable.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/phishable.sol) | 20 | https://github.com/sigp/solidity-security-blog |
|
|
53
|
+
| [proxy.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/proxy.sol) | 19 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
54
|
+
| [rubixi.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/rubixi.sol) | 23, 24 | https://github.com/trailofbits/not-so-smart-contracts/blo... |
|
|
55
|
+
| [simple_suicide.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/simple_suicide.sol) | 12, 13 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
56
|
+
| [unprotected0.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/unprotected0.sol) | 25 | https://github.com/trailofbits/not-so-smart-contracts/blo... |
|
|
57
|
+
| [wallet_02_refund_nosub.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/wallet_02_refund_nosub.sol) | 36 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
58
|
+
| [wallet_03_wrong_constructor.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/wallet_03_wrong_constructor.sol) | 19, 20 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
59
|
+
| [wallet_04_confused_sign.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/access_control/wallet_04_confused_sign.sol) | 30 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
60
|
+
|
|
61
|
+
**18 contracts** in this category.
|
|
62
|
+
|
|
63
|
+
### Arithmetic / Integer Overflow (DASP #3)
|
|
64
|
+
|
|
65
|
+
| Contract | Vulnerable Lines | Source |
|
|
66
|
+
|----------|-----------------|--------|
|
|
67
|
+
| [BECToken.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/BECToken.sol) | 264 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
68
|
+
| [insecure_transfer.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/insecure_transfer.sol) | 18 | https://consensys.github.io/smart-contract-best-practices... |
|
|
69
|
+
| [integer_overflow_1.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/integer_overflow_1.sol) | 14 | https://github.com/trailofbits/not-so-smart-contracts/blo... |
|
|
70
|
+
| [integer_overflow_add.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/integer_overflow_add.sol) | 17 | https://github.com/ConsenSys/evm-analyzer-benchmark-suite... |
|
|
71
|
+
| [integer_overflow_benign_1.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/integer_overflow_benign_1.sol) | 17 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
72
|
+
| [integer_overflow_mapping_sym_1.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/integer_overflow_mapping_sym_1.sol) | 16 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
73
|
+
| [integer_overflow_minimal.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/integer_overflow_minimal.sol) | 17 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
74
|
+
| [integer_overflow_mul.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/integer_overflow_mul.sol) | 17 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
75
|
+
| [integer_overflow_multitx_multifunc_feasible.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/integer_overflow_multitx_multifunc_feasible.sol) | 25 | https://github.com/ConsenSys/evm-analyzer-benchmark-suite |
|
|
76
|
+
| [integer_overflow_multitx_onefunc_feasible.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/integer_overflow_multitx_onefunc_feasible.sol) | 22 | https://github.com/ConsenSys/evm-analyzer-benchmark-suite |
|
|
77
|
+
| [overflow_simple_add.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/overflow_simple_add.sol) | 14 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
78
|
+
| [overflow_single_tx.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/overflow_single_tx.sol) | 18; 24; 30; 36; 42; 48 | https://github.com/ConsenSys/evm-analyzer-benchmark-suite |
|
|
79
|
+
| [timelock.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/timelock.sol) | 22 | https://github.com/sigp/solidity-security-blog |
|
|
80
|
+
| [token.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/token.sol) | 20; 22 | https://github.com/sigp/solidity-security-blog |
|
|
81
|
+
| [tokensalechallenge.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/arithmetic/tokensalechallenge.sol) | 23; 25; 33 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
82
|
+
|
|
83
|
+
**15 contracts** in this category.
|
|
84
|
+
|
|
85
|
+
### Bad Randomness (DASP #6)
|
|
86
|
+
|
|
87
|
+
| Contract | Vulnerable Lines | Source |
|
|
88
|
+
|----------|-----------------|--------|
|
|
89
|
+
| [blackjack.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/bad_randomness/blackjack.sol) | 17; 19; 21 | https://etherscan.io/address/0xa65d59708838581520511d98fb... |
|
|
90
|
+
| [etheraffle.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/bad_randomness/etheraffle.sol) | 49; 99; 101; 103; 114; 158 | https://etherscan.io/address/0xcC88937F325d1C6B97da0AFDbb... |
|
|
91
|
+
| [guess_the_random_number.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/bad_randomness/guess_the_random_number.sol) | 15 | https://capturetheether.com/challenges/lotteries/guess-th... |
|
|
92
|
+
| [lottery.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/bad_randomness/lottery.sol) | 38; 42 | https://etherscan.io/address/0x80ddae5251047d6ceb29765f38... |
|
|
93
|
+
| [lucky_doubler.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/bad_randomness/lucky_doubler.sol) | 127, 128, 129, 130; 132 | https://etherscan.io/address/0xF767fCA8e65d03fE16D4e38810... |
|
|
94
|
+
| [old_blockhash.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/bad_randomness/old_blockhash.sol) | 35 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
95
|
+
| [random_number_generator.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/bad_randomness/random_number_generator.sol) | 12; 18; 20; 22 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
96
|
+
| [smart_billions.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/bad_randomness/smart_billions.sol) | 523; 560; 700; 702; 704; 706; 708; 710; 712; 714; 716; 718 | https://etherscan.io/address/0x5ace17f87c7391e5792a768306... |
|
|
97
|
+
|
|
98
|
+
**8 contracts** in this category.
|
|
99
|
+
|
|
100
|
+
### Denial of Service (DASP #5)
|
|
101
|
+
|
|
102
|
+
| Contract | Vulnerable Lines | Source |
|
|
103
|
+
|----------|-----------------|--------|
|
|
104
|
+
| [auction.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/denial_of_service/auction.sol) | 23 | https://github.com/trailofbits/not-so-smart-contracts/blo... |
|
|
105
|
+
| [dos_address.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/denial_of_service/dos_address.sol) | 16, 17, 18 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
106
|
+
| [dos_number.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/denial_of_service/dos_number.sol) | 18, 19, 20, 21, 22 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
107
|
+
| [dos_simple.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/denial_of_service/dos_simple.sol) | 17, 18 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
108
|
+
| [list_dos.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/denial_of_service/list_dos.sol) | 46; 48 | https://etherscan.io/address/0xf45717552f12ef7cb65e95476f... |
|
|
109
|
+
| [send_loop.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/denial_of_service/send_loop.sol) | 24 | https://consensys.github.io/smart-contract-best-practices... |
|
|
110
|
+
|
|
111
|
+
**6 contracts** in this category.
|
|
112
|
+
|
|
113
|
+
### Front Running (DASP #7)
|
|
114
|
+
|
|
115
|
+
| Contract | Vulnerable Lines | Source |
|
|
116
|
+
|----------|-----------------|--------|
|
|
117
|
+
| [ERC20.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/front_running/ERC20.sol) | 110; 113 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
118
|
+
| [FindThisHash.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/front_running/FindThisHash.sol) | 17 | https://github.com/sigp/solidity-security-blog |
|
|
119
|
+
| [eth_tx_order_dependence_minimal.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/front_running/eth_tx_order_dependence_minimal.sol) | 23; 31 | https://github.com/ConsenSys/evm-analyzer-benchmark-suite |
|
|
120
|
+
| [odds_and_evens.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/front_running/odds_and_evens.sol) | 25; 28 | http://blockchain.unica.it/projects/ethereum-survey/attac... |
|
|
121
|
+
|
|
122
|
+
**4 contracts** in this category.
|
|
123
|
+
|
|
124
|
+
### Other / Uncategorized (DASP #10)
|
|
125
|
+
|
|
126
|
+
| Contract | Vulnerable Lines | Source |
|
|
127
|
+
|----------|-----------------|--------|
|
|
128
|
+
| [crypto_roulette.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/other/crypto_roulette.sol) | 40, 41, 42 | https://github.com/thec00n/smart-contract-honeypots/blob/... |
|
|
129
|
+
| [name_registrar.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/other/name_registrar.sol) | 23 | https://github.com/sigp/solidity-security-blog#storage-ex... |
|
|
130
|
+
| [open_address_lottery.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/other/open_address_lottery.sol) | 91 | https://etherscan.io/address/0x741f1923974464efd0aa70e778... |
|
|
131
|
+
|
|
132
|
+
**3 contracts** in this category.
|
|
133
|
+
|
|
134
|
+
### Reentrancy (DASP #1)
|
|
135
|
+
|
|
136
|
+
| Contract | Vulnerable Lines | Source |
|
|
137
|
+
|----------|-----------------|--------|
|
|
138
|
+
| [0x01f8c4e3fa3edeb29e514cba738d87ce8c091d3f.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x01f8c4e3fa3edeb29e514cba738d87ce8c091d3f.sol) | 54 | etherscan.io |
|
|
139
|
+
| [0x23a91059fdc9579a9fbd0edc5f2ea0bfdb70deb4.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x23a91059fdc9579a9fbd0edc5f2ea0bfdb70deb4.sol) | 38 | etherscan.io |
|
|
140
|
+
| [0x4320e6f8c05b27ab4707cd1f6d5ce6f3e4b3a5a1.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x4320e6f8c05b27ab4707cd1f6d5ce6f3e4b3a5a1.sol) | 55 | etherscan.io |
|
|
141
|
+
| [0x4e73b32ed6c35f570686b89848e5f39f20ecc106.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x4e73b32ed6c35f570686b89848e5f39f20ecc106.sol) | 54 | etherscan.io |
|
|
142
|
+
| [0x561eac93c92360949ab1f1403323e6db345cbf31.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x561eac93c92360949ab1f1403323e6db345cbf31.sol) | 54 | etherscan.io |
|
|
143
|
+
| [0x627fa62ccbb1c1b04ffaecd72a53e37fc0e17839.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x627fa62ccbb1c1b04ffaecd72a53e37fc0e17839.sol) | 94 | etherscan.io |
|
|
144
|
+
| [0x7541b76cb60f4c60af330c208b0623b7f54bf615.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x7541b76cb60f4c60af330c208b0623b7f54bf615.sol) | 29 | etherscan.io |
|
|
145
|
+
| [0x7a8721a9d64c74da899424c1b52acbf58ddc9782.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x7a8721a9d64c74da899424c1b52acbf58ddc9782.sol) | 52 | etherscan.io |
|
|
146
|
+
| [0x7b368c4e805c3870b6c49a3f1f49f69af8662cf3.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x7b368c4e805c3870b6c49a3f1f49f69af8662cf3.sol) | 29 | etherscan.io |
|
|
147
|
+
| [0x8c7777c45481dba411450c228cb692ac3d550344.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x8c7777c45481dba411450c228cb692ac3d550344.sol) | 41 | etherscan.io |
|
|
148
|
+
| [0x93c32845fae42c83a70e5f06214c8433665c2ab5.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x93c32845fae42c83a70e5f06214c8433665c2ab5.sol) | 29 | etherscan.io |
|
|
149
|
+
| [0x941d225236464a25eb18076df7da6a91d0f95e9e.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x941d225236464a25eb18076df7da6a91d0f95e9e.sol) | 44 | etherscan.io |
|
|
150
|
+
| [0x96edbe868531bd23a6c05e9d0c424ea64fb1b78b.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0x96edbe868531bd23a6c05e9d0c424ea64fb1b78b.sol) | 63 | etherscan.io |
|
|
151
|
+
| [0xaae1f51cf3339f18b6d3f3bdc75a5facd744b0b8.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0xaae1f51cf3339f18b6d3f3bdc75a5facd744b0b8.sol) | 54 | etherscan.io |
|
|
152
|
+
| [0xb5e1b1ee15c6fa0e48fce100125569d430f1bd12.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0xb5e1b1ee15c6fa0e48fce100125569d430f1bd12.sol) | 40 | etherscan.io |
|
|
153
|
+
| [0xb93430ce38ac4a6bb47fb1fc085ea669353fd89e.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0xb93430ce38ac4a6bb47fb1fc085ea669353fd89e.sol) | 38 | etherscan.io |
|
|
154
|
+
| [0xbaf51e761510c1a11bf48dd87c0307ac8a8c8a4f.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0xbaf51e761510c1a11bf48dd87c0307ac8a8c8a4f.sol) | 41 | etherscan.io |
|
|
155
|
+
| [0xbe4041d55db380c5ae9d4a9b9703f1ed4e7e3888.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0xbe4041d55db380c5ae9d4a9b9703f1ed4e7e3888.sol) | 63 | etherscan.io |
|
|
156
|
+
| [0xcead721ef5b11f1a7b530171aab69b16c5e66b6e.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0xcead721ef5b11f1a7b530171aab69b16c5e66b6e.sol) | 29 | etherscan.io |
|
|
157
|
+
| [0xf015c35649c82f5467c9c74b7f28ee67665aad68.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/0xf015c35649c82f5467c9c74b7f28ee67665aad68.sol) | 29 | etherscan.io |
|
|
158
|
+
| [etherbank.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/etherbank.sol) | 21 | https://github.com/seresistvanandras/EthBench/blob/master... |
|
|
159
|
+
| [etherstore.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/etherstore.sol) | 27 | https://github.com/sigp/solidity-security-blog |
|
|
160
|
+
| [modifier_reentrancy.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/modifier_reentrancy.sol) | 15 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
161
|
+
| [reentrance.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/reentrance.sol) | 24 | https://ethernaut.zeppelin.solutions/level/0xf70706db003e... |
|
|
162
|
+
| [reentrancy_bonus.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/reentrancy_bonus.sol) | 28 | https://consensys.github.io/smart-contract-best-practices... |
|
|
163
|
+
| [reentrancy_cross_function.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/reentrancy_cross_function.sol) | 24 | https://consensys.github.io/smart-contract-best-practices... |
|
|
164
|
+
| [reentrancy_dao.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/reentrancy_dao.sol) | 18 | https://github.com/ConsenSys/evm-analyzer-benchmark-suite |
|
|
165
|
+
| [reentrancy_insecure.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/reentrancy_insecure.sol) | 17 | https://consensys.github.io/smart-contract-best-practices... |
|
|
166
|
+
| [reentrancy_simple.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/reentrancy_simple.sol) | 24 | https://github.com/trailofbits/not-so-smart-contracts/blo... |
|
|
167
|
+
| [simple_dao.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/simple_dao.sol) | 19 | http://blockchain.unica.it/projects/ethereum-survey/attac... |
|
|
168
|
+
| [spank_chain_payment.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/reentrancy/spank_chain_payment.sol) | 426; 430 | https://github.com/trailofbits/not-so-smart-contracts/blo... |
|
|
169
|
+
|
|
170
|
+
**31 contracts** in this category.
|
|
171
|
+
|
|
172
|
+
### Short Addresses (DASP #9)
|
|
173
|
+
|
|
174
|
+
| Contract | Vulnerable Lines | Source |
|
|
175
|
+
|----------|-----------------|--------|
|
|
176
|
+
| [short_address_example.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/short_addresses/short_address_example.sol) | 18 | https://ericrafaloff.com/analyzing-the-erc20-short-addres... |
|
|
177
|
+
|
|
178
|
+
**1 contracts** in this category.
|
|
179
|
+
|
|
180
|
+
### Time Manipulation (DASP #8)
|
|
181
|
+
|
|
182
|
+
| Contract | Vulnerable Lines | Source |
|
|
183
|
+
|----------|-----------------|--------|
|
|
184
|
+
| [ether_lotto.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/time_manipulation/ether_lotto.sol) | 43 | https://etherscan.io/address/0xa11e4ed59dc94e69612f311194... |
|
|
185
|
+
| [governmental_survey.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/time_manipulation/governmental_survey.sol) | 27 | http://blockchain.unica.it/projects/ethereum-survey/attac... |
|
|
186
|
+
| [lottopollo.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/time_manipulation/lottopollo.sol) | 13; 27 | https://github.com/seresistvanandras/EthBench/blob/master... |
|
|
187
|
+
| [roulette.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/time_manipulation/roulette.sol) | 18; 20 | https://github.com/sigp/solidity-security-blog |
|
|
188
|
+
| [timed_crowdsale.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/time_manipulation/timed_crowdsale.sol) | 13 | https://github.com/SmartContractSecurity/SWC-registry/blo... |
|
|
189
|
+
|
|
190
|
+
**5 contracts** in this category.
|
|
191
|
+
|
|
192
|
+
### Unchecked Low Level Calls (DASP #4)
|
|
193
|
+
|
|
194
|
+
| Contract | Vulnerable Lines | Source |
|
|
195
|
+
|----------|-----------------|--------|
|
|
196
|
+
| [0x07f7ecb66d788ab01dc93b9b71a88401de7d0f2e.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x07f7ecb66d788ab01dc93b9b71a88401de7d0f2e.sol) | 201; 213 | etherscan.io |
|
|
197
|
+
| [0x0cbe050f75bc8f8c2d6c0d249fea125fd6e1acc9.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x0cbe050f75bc8f8c2d6c0d249fea125fd6e1acc9.sol) | 12 | etherscan.io |
|
|
198
|
+
| [0x19cf8481ea15427a98ba3cdd6d9e14690011ab10.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x19cf8481ea15427a98ba3cdd6d9e14690011ab10.sol) | 439; 465 | etherscan.io |
|
|
199
|
+
| [0x2972d548497286d18e92b5fa1f8f9139e5653fd2.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x2972d548497286d18e92b5fa1f8f9139e5653fd2.sol) | 14 | etherscan.io |
|
|
200
|
+
| [0x39cfd754c85023648bf003bea2dd498c5612abfa.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x39cfd754c85023648bf003bea2dd498c5612abfa.sol) | 44; 97 | etherscan.io |
|
|
201
|
+
| [0x3a0e9acd953ffc0dd18d63603488846a6b8b2b01.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x3a0e9acd953ffc0dd18d63603488846a6b8b2b01.sol) | 44; 97 | etherscan.io |
|
|
202
|
+
| [0x3e013fc32a54c4c5b6991ba539dcd0ec4355c859.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x3e013fc32a54c4c5b6991ba539dcd0ec4355c859.sol) | 29 | etherscan.io |
|
|
203
|
+
| [0x3f2ef511aa6e75231e4deafc7a3d2ecab3741de2.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x3f2ef511aa6e75231e4deafc7a3d2ecab3741de2.sol) | 45 | etherscan.io |
|
|
204
|
+
| [0x4051334adc52057aca763453820cb0e045076ef3.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x4051334adc52057aca763453820cb0e045076ef3.sol) | 16 | etherscan.io |
|
|
205
|
+
| [0x4a66ad0bca2d700f11e1f2fc2c106f7d3264504c.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x4a66ad0bca2d700f11e1f2fc2c106f7d3264504c.sol) | 19 | etherscan.io |
|
|
206
|
+
| [0x4b71ad9c1a84b9b643aa54fdd66e2dec96e8b152.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x4b71ad9c1a84b9b643aa54fdd66e2dec96e8b152.sol) | 17 | etherscan.io |
|
|
207
|
+
| [0x524960d55174d912768678d8c606b4d50b79d7b1.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x524960d55174d912768678d8c606b4d50b79d7b1.sol) | 21 | etherscan.io |
|
|
208
|
+
| [0x52d2e0f9b01101a59b38a3d05c80b7618aeed984.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x52d2e0f9b01101a59b38a3d05c80b7618aeed984.sol) | 27 | etherscan.io |
|
|
209
|
+
| [0x5aa88d2901c68fda244f1d0584400368d2c8e739.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x5aa88d2901c68fda244f1d0584400368d2c8e739.sol) | 29 | etherscan.io |
|
|
210
|
+
| [0x610495793564aed0f9c7fc48dc4c7c9151d34fd6.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x610495793564aed0f9c7fc48dc4c7c9151d34fd6.sol) | 33 | etherscan.io |
|
|
211
|
+
| [0x627fa62ccbb1c1b04ffaecd72a53e37fc0e17839.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x627fa62ccbb1c1b04ffaecd72a53e37fc0e17839.sol) | 44 | etherscan.io |
|
|
212
|
+
| [0x663e4229142a27f00bafb5d087e1e730648314c3.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x663e4229142a27f00bafb5d087e1e730648314c3.sol) | 1152; 1496; 2467 | etherscan.io |
|
|
213
|
+
| [0x70f9eddb3931491aab1aeafbc1e7f1ca2a012db4.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x70f9eddb3931491aab1aeafbc1e7f1ca2a012db4.sol) | 29 | etherscan.io |
|
|
214
|
+
| [0x78c2a1e91b52bca4130b6ed9edd9fbcfd4671c37.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x78c2a1e91b52bca4130b6ed9edd9fbcfd4671c37.sol) | 45 | etherscan.io |
|
|
215
|
+
| [0x7a4349a749e59a5736efb7826ee3496a2dfd5489.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x7a4349a749e59a5736efb7826ee3496a2dfd5489.sol) | 44 | etherscan.io |
|
|
216
|
+
| [0x7d09edb07d23acb532a82be3da5c17d9d85806b4.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x7d09edb07d23acb532a82be3da5c17d9d85806b4.sol) | 198; 210 | etherscan.io |
|
|
217
|
+
| [0x806a6bd219f162442d992bdc4ee6eba1f2c5a707.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x806a6bd219f162442d992bdc4ee6eba1f2c5a707.sol) | 44 | etherscan.io |
|
|
218
|
+
| [0x84d9ec85c9c568eb332b7226a8f826d897e0a4a8.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x84d9ec85c9c568eb332b7226a8f826d897e0a4a8.sol) | 56 | etherscan.io |
|
|
219
|
+
| [0x89c1b3807d4c67df034fffb62f3509561218d30b.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x89c1b3807d4c67df034fffb62f3509561218d30b.sol) | 162; 175; 180; 192 | etherscan.io |
|
|
220
|
+
| [0x8fd1e427396ddb511533cf9abdbebd0a7e08da35.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x8fd1e427396ddb511533cf9abdbebd0a7e08da35.sol) | 44; 97 | etherscan.io |
|
|
221
|
+
| [0x958a8f594101d2c0485a52319f29b2647f2ebc06.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x958a8f594101d2c0485a52319f29b2647f2ebc06.sol) | 55 | etherscan.io |
|
|
222
|
+
| [0x9d06cbafa865037a01d322d3f4222fa3e04e5488.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0x9d06cbafa865037a01d322d3f4222fa3e04e5488.sol) | 54; 65 | etherscan.io |
|
|
223
|
+
| [0xa1fceeff3acc57d257b917e30c4df661401d6431.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xa1fceeff3acc57d257b917e30c4df661401d6431.sol) | 31 | etherscan.io |
|
|
224
|
+
| [0xa46edd6a9a93feec36576ee5048146870ea2c3ae.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xa46edd6a9a93feec36576ee5048146870ea2c3ae.sol) | 16 | etherscan.io |
|
|
225
|
+
| [0xb0510d68f210b7db66e8c7c814f22680f2b8d1d6.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xb0510d68f210b7db66e8c7c814f22680f2b8d1d6.sol) | 69; 71; 73; 75; 102 | etherscan.io |
|
|
226
|
+
| [0xb11b2fed6c9354f7aa2f658d3b4d7b31d8a13b77.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xb11b2fed6c9354f7aa2f658d3b4d7b31d8a13b77.sol) | 14 | etherscan.io |
|
|
227
|
+
| [0xb37f18af15bafb869a065b61fc83cfc44ed9cc27.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xb37f18af15bafb869a065b61fc83cfc44ed9cc27.sol) | 33 | etherscan.io |
|
|
228
|
+
| [0xb620cee6b52f96f3c6b253e6eea556aa2d214a99.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xb620cee6b52f96f3c6b253e6eea556aa2d214a99.sol) | 100; 106; 133 | etherscan.io |
|
|
229
|
+
| [0xb7c5c5aa4d42967efe906e1b66cb8df9cebf04f7.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xb7c5c5aa4d42967efe906e1b66cb8df9cebf04f7.sol) | 25 | etherscan.io |
|
|
230
|
+
| [0xbaa3de6504690efb064420d89e871c27065cdd52.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xbaa3de6504690efb064420d89e871c27065cdd52.sol) | 14 | etherscan.io |
|
|
231
|
+
| [0xbebbfe5b549f5db6e6c78ca97cac19d1fb03082c.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xbebbfe5b549f5db6e6c78ca97cac19d1fb03082c.sol) | 14 | etherscan.io |
|
|
232
|
+
| [0xd2018bfaa266a9ec0a1a84b061640faa009def76.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xd2018bfaa266a9ec0a1a84b061640faa009def76.sol) | 44 | etherscan.io |
|
|
233
|
+
| [0xd5967fed03e85d1cce44cab284695b41bc675b5c.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xd5967fed03e85d1cce44cab284695b41bc675b5c.sol) | 16 | etherscan.io |
|
|
234
|
+
| [0xdb1c55f6926e7d847ddf8678905ad871a68199d2.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xdb1c55f6926e7d847ddf8678905ad871a68199d2.sol) | 39 | etherscan.io |
|
|
235
|
+
| [0xe09b1ab8111c2729a76f16de96bc86a7af837928.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xe09b1ab8111c2729a76f16de96bc86a7af837928.sol) | 150 | etherscan.io |
|
|
236
|
+
| [0xe4eabdca81e31d9acbc4af76b30f532b6ed7f3bf.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xe4eabdca81e31d9acbc4af76b30f532b6ed7f3bf.sol) | 44 | etherscan.io |
|
|
237
|
+
| [0xe82f0742a71a02b9e9ffc142fdcb6eb1ed06fb87.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xe82f0742a71a02b9e9ffc142fdcb6eb1ed06fb87.sol) | 39 | etherscan.io |
|
|
238
|
+
| [0xe894d54dca59cb53fe9cbc5155093605c7068220.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xe894d54dca59cb53fe9cbc5155093605c7068220.sol) | 17 | etherscan.io |
|
|
239
|
+
| [0xec329ffc97d75fe03428ae155fc7793431487f63.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xec329ffc97d75fe03428ae155fc7793431487f63.sol) | 30 | etherscan.io |
|
|
240
|
+
| [0xf2570186500a46986f3139f65afedc2afe4f445d.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xf2570186500a46986f3139f65afedc2afe4f445d.sol) | 18 | etherscan.io |
|
|
241
|
+
| [0xf29ebe930a539a60279ace72c707cba851a57707.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xf29ebe930a539a60279ace72c707cba851a57707.sol) | 16 | etherscan.io |
|
|
242
|
+
| [0xf70d589d76eebdd7c12cc5eec99f8f6fa4233b9e.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/0xf70d589d76eebdd7c12cc5eec99f8f6fa4233b9e.sol) | 44 | etherscan.io |
|
|
243
|
+
| [etherpot_lotto.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/etherpot_lotto.sol) | 109; 141 | https://github.com/etherpot/contract/blob/master/app/cont... |
|
|
244
|
+
| [king_of_the_ether_throne.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/king_of_the_ether_throne.sol) | 110; 118; 132; 174 | https://github.com/kieranelby/KingOfTheEtherThrone/blob/v... |
|
|
245
|
+
| [lotto.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/lotto.sol) | 20; 27 | https://github.com/sigp/solidity-security-blog |
|
|
246
|
+
| [mishandled.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/mishandled.sol) | 14 | https://github.com/seresistvanandras/EthBench/blob/master... |
|
|
247
|
+
| [unchecked_return_value.sol](https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/unchecked_low_level_calls/unchecked_return_value.sol) | 17 | https://smartcontractsecurity.github.io/SWC-registry/docs... |
|
|
248
|
+
|
|
249
|
+
**52 contracts** in this category.
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
## Key Vulnerability Patterns
|
|
254
|
+
|
|
255
|
+
### Reentrancy (DASP #1)
|
|
256
|
+
- State changes after external calls (check-effects-interactions violation)
|
|
257
|
+
- `call.value()` followed by state updates
|
|
258
|
+
- Cross-function reentrancy via shared state
|
|
259
|
+
|
|
260
|
+
### Arithmetic (DASP #3)
|
|
261
|
+
- Integer overflow/underflow in Solidity < 0.8.0 without SafeMath
|
|
262
|
+
- Unchecked arithmetic in token transfers and balance calculations
|
|
263
|
+
|
|
264
|
+
### Access Control (DASP #2)
|
|
265
|
+
- Missing access modifiers on critical functions
|
|
266
|
+
- Incorrect constructor names (pre-0.4.22)
|
|
267
|
+
- `tx.origin` used for authorization instead of `msg.sender`
|
|
268
|
+
- Unprotected `selfdestruct` / `delegatecall`
|
|
269
|
+
|
|
270
|
+
### Denial of Service (DASP #5)
|
|
271
|
+
- Unbounded loops over user-controlled arrays
|
|
272
|
+
- External call failures blocking contract execution
|
|
273
|
+
- Gas limit exhaustion via push-based payments
|
|
274
|
+
|
|
275
|
+
### Bad Randomness (DASP #6)
|
|
276
|
+
- `block.timestamp`, `block.difficulty`, `blockhash` used for randomness
|
|
277
|
+
- Predictable seed values from on-chain data
|
|
278
|
+
|
|
279
|
+
### Front Running (DASP #7)
|
|
280
|
+
- Transaction ordering dependence
|
|
281
|
+
- Unprotected `approve` + `transferFrom` pattern in ERC20
|
|
282
|
+
|
|
283
|
+
### Unchecked Low Level Calls (DASP #4)
|
|
284
|
+
- Return value of `send()`, `call()`, `delegatecall()` not checked
|
|
285
|
+
- Silent failures in ETH transfers
|
|
286
|
+
|
|
287
|
+
### Time Manipulation (DASP #8)
|
|
288
|
+
- `block.timestamp` dependence for critical logic
|
|
289
|
+
- Miner-manipulable time windows
|
|
290
|
+
|
|
291
|
+
## Usage
|
|
292
|
+
|
|
293
|
+
Reference a specific vulnerable contract:
|
|
294
|
+
```
|
|
295
|
+
https://github.com/smartbugs/smartbugs-curated/blob/master/dataset/{category}/{filename}
|
|
296
|
+
```
|