- Source: blockchain-security-auditor.md (The Agency Specialized, smart contract security audit agent) - Entities: The-DAO-2016, Euler-Finance, Nomad-Bridge, Curve-Finance - Concepts: Reentrancy, Oracle-Manipulation - Updated: index.md (消除了source missing标记), overview.md, log.md
48 lines
2.0 KiB
Markdown
48 lines
2.0 KiB
Markdown
---
|
||
title: "The DAO (2016)"
|
||
type: entity
|
||
tags: [blockchain, defi, exploit, reentrancy, ethereum]
|
||
sources: [blockchain-security-auditor]
|
||
last_updated: 2026-04-25
|
||
---
|
||
|
||
## Aliases
|
||
- The DAO
|
||
- Decentralized Autonomous Organization (the original)
|
||
|
||
## 基本信息
|
||
- **时间**:2016 年 6 月 17 日
|
||
- **平台**:Ethereum
|
||
- **损失**:约 360 万 ETH(当时价值约 5,000 万美元)
|
||
- **根本原因**:重入攻击(Reentrancy)
|
||
- **历史地位**:以太坊历史上首次重大安全事件,直接导致以太坊硬分叉(ETH/ETC 分裂)
|
||
|
||
## 攻击原理
|
||
|
||
攻击者利用DAO合约的 `withdraw()` 函数,在向攻击者合约转账时触发 `receive()` 回调。由于状态更新(`balances[msg.sender] = 0`)在外部调用之后执行,攻击者合约可以在余额清零前回拨 `withdraw()` 重复提取资金:
|
||
|
||
```solidity
|
||
// 漏洞代码(简化)
|
||
function withdraw() external {
|
||
uint256 amount = balances[msg.sender];
|
||
// BUG: 外部调用在状态更新之前
|
||
(bool success,) = msg.sender.call{value: amount}("");
|
||
require(success);
|
||
balances[msg.sender] = 0; // 攻击者在此行执行前已再次调用 withdraw()
|
||
}
|
||
```
|
||
|
||
## 关键影响
|
||
- **技术层面**:开创了智能合约安全研究领域,Reentrancy 成为最经典的漏洞类型之一
|
||
- **以太坊层面**:引发 ETH/ETC 硬分叉,Coinbase 等交易所拒绝支持 ETC 引发争议
|
||
- **行业层面**:推动了安全审计行业(Trail of Bits、OpenZeppelin)的兴起,Solidity 编译器加强了对重入的检查
|
||
|
||
## 关联漏洞类型
|
||
- [[Reentrancy]]:核心漏洞类型,The DAO 是该漏洞类型的"教科书案例"
|
||
- Checks-Effects-Interactions Pattern:修复方案——先更新状态,再执行外部调用
|
||
|
||
## 关联页面
|
||
- [[Reentrancy]] — 通用漏洞概念,The DAO 是其首个重大案例
|
||
- [[blockchain-security-auditor]] — 区块链安全审计 Agent,将 The DAO 作为关键记忆模式
|
||
- [[Curve Finance]] — 2023 年 Vyper 编译器 bug 导致类似重入攻击
|