josmiles/smart-contract-security
GitHub: josmiles/smart-contract-security
一份系统化的智能合约安全学习笔记与作品集,涵盖主流靶场挑战的漏洞分析与利用演示。
Stars: 0 | Forks: 0
# 智能合约安全 — Joseph Kamanja
## 适用人群
这是我的公开学习日志和作品集。每个文件夹包含:
- 存在漏洞的合约(如适用)
- 我的漏洞利用
- 关于漏洞的书面解释
- 修复方案
如果你是一个正在寻找审计员的协议团队——这就是我的简历。
## 仓库结构
```
smart-contract-security/
│
├── ethernaut/ ← OpenZeppelin's 30-level hacking challenges
│ ├── 01-fallback/
│ ├── 02-fallout/
│ └── ...
│
├── damn-vulnerable-defi/ ← Advanced DeFi-specific challenges
│ ├── 01-unstoppable/
│ └── ...
│
├── audit-reports/ ← Full audit reports (mock + real)
│ ├── mock-audits/
│ └── templates/
│
├── foundry-exploits/ ← Forge test exploits (runnable proof of concepts)
│ ├── src/ ← Vulnerable contracts
│ ├── test/ ← Exploit tests
│ └── script/ ← Deployment scripts
│
├── tools-and-references/ ← Slither notes, Foundry cheatsheet, EVM reference
│
├── resources/ ← Key links, reading list, vulnerability database
│
└── writeups/ ← Deep-dive writeups on real DeFi hacks
```
## 进度追踪
### Ethernaut
| 关卡 | 名称 | 漏洞 | 状态 |
|-------|------|--------------|--------|
| 00 | Hello Ethernaut | 教程 | ⬜ |
| 01 | Fallback | Fallback 函数所有权接管 | ✅ |
| 02 | Fallout | 构造函数命名 Bug | ✅ |
| 03 | Coin Flip | 弱随机性(区块变量) | ⬜ |
| 04 | Telephone | tx.origin vs msg.sender | ⬜ |
| 05 | Token | 整数下溢(0.8 版本之前) | ⬜ |
| 06 | Delegation | Delegatecall 存储冲突 | ⬜ |
| 07 | Force | Selfdestruct 强制推送 ETH | ⬜ |
| 08 | Vault | 私有变量可见性 | ⬜ |
| 09 | King | 通过 revert 导致的拒绝服务 | ⬜ |
| 10 | Reentrancy | 经典重入攻击 | ✅ |
### Damn Vulnerable DeFi
| 关卡 | 名称 | 漏洞 | 状态 |
|-------|------|--------------|--------|
| 01 | Unstoppable | 闪电贷 Griefing 攻击 | ✅ |
| 02 | Naive Receiver | 未受保护的闪电贷接收者 | ⬜ |
| 03 | Truster | 闪电贷中的任意 calldata | ⬜ |
| 04 | Side Entrance | 闪电贷记账缺陷 | ⬜ |
| 05 | The Rewarder | 闪电贷奖励操纵 | ⬜ |
| 06 | Selfie | 治理 + 闪电贷攻击 | ⬜ |
| 07 | Compromised | 预言机价格操纵 | ⬜ |
| 08 | Puppet | AMM 价格预言机操纵 | ⬜ |
### 撰写的审计报告
| 项目 | 类型 | 发现 | 日期 |
|---------|------|----------|------|
| — | — | — | — |
### Code4rena 竞赛
| 协议 | 日期 | 发现 | 收益 |
|----------|------|----------|---------|
| — | — | — | — |
## 工具栈
| 工具 | 用途 | 安装 |
|------|---------|---------|
| Foundry (forge/cast/anvil) | 编译、测试、漏洞利用、本地链 | `curl -L https://foundry.paradigm.xyz \| bash` |
| Slither | 静态分析 / 自动化漏洞检测 | `pip install slither-analyzer` |
| Echidna | 基于属性的模糊测试 | GitHub releases |
| Chisel | Solidity REPL | 包含在 Foundry 中 |
| Cast | CLI 区块链交互 | 包含在 Foundry 中 |
| Anvil | 本地 Ethereum 节点 | 包含在 Foundry 中 |
## 正在研究的漏洞类别
- [ ] 重入
- [ ] 整数溢出/下溢
- [ ] 访问控制
- [ ] 预言机操纵
- [ ] 闪电贷攻击
- [ ] 抢跑 / MEV
- [ ] 签名重放
- [ ] 不安全的 Delegatecall
- [ ] 未检查的返回值
- [ ] 通过 AMM 的价格操纵
- [ ] 逻辑错误
- [ ] Griefing / DoS
## 资源
完整列表请参阅 `/resources/reading-list.md`。
关键链接:
- [Ethernaut](https://ethernaut.openzeppelin.com)
- [Damn Vulnerable DeFi](https://damnvulnerabledefi.xyz)
- [Solodit](https://solodit.xyz) — 真实的审计发现数据库
- [Immunefi](https://immunefi.com) — 漏洞赏金
- [Code4rena](https://code4rena.com) — 审计竞赛
- [Rekt News](https://rekt.news) — DeFi 黑客事件复盘
- [SWC Registry](https://swcregistry.io) — 智能合约弱点分类
## 联系方式
Joseph Kamanja · 肯尼亚,内罗毕
- GitHub: [github.com/josmiles](https://github.com/josmiles)
- LinkedIn: [linkedin.com/in/jkamanja](https://www.linkedin.com/in/jkamanja)
- Email: josephkamanja433@gmail.com
标签:CISA项目, Damn Vulnerable DeFi, DeFi安全, Ethernaut, EVM, Foundry, Slither, Solidity安全, Web3安全, Web3开发, 代码安全, 区块链安全, 去中心化金融漏洞, 安全测试, 安全研究员, 审计报告, 开发者作品集, 攻击性安全, 智能合约安全, 智能合约漏洞分析, 漏洞枚举, 漏洞验证(POC), 网络安全学习