Files
nexus/wiki/entities/The-DAO-2016.md

48 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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 导致类似重入攻击