Files
nexus/wiki/entities/Curve-Finance.md

42 lines
2.2 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: "Curve Finance"
type: entity
tags: [blockchain, defi, amm, exploit, compiler-bug]
sources: [blockchain-security-auditor]
last_updated: 2026-04-25
---
## 基本信息
- **时间**2023 年 7 月 30 日
- **平台**Ethereum多链影响 ETH、ARB、CRV、MSRP 等池)
- **损失**:超过 7,000 万美元
- **根本原因**Vyper 0.3.0 编译器的重入锁Reentrancy Guard实现 bug
- **特点**:这是 DeFi 历史上罕见的**编译器 bug 导致的安全事件**,而非业务逻辑漏洞
## 攻击原理
Curve Finance 使用 Vyper 语言编写合约Vyper 0.3.0 的 `nonreentrant` 修饰符存在 bug当合约存在多个相同名称的回调函数`receive()``fallback()`)时,重入锁未能正确生效。
攻击者利用此漏洞对多个 Curve 池发起攻击:
1. 在 AMM 池中进行兑换swap
2. 触发 `receive()` 回调
3. 在回调中调用池的敏感函数(添加流动性/移除流动性)
4. 由于重入锁失效,攻击者可以在单笔交易内重复执行操作
5. 操纵池子的虚拟价格后执行大额提款,获取超额资产
CRV 池的流动性枯竭(攻击者大量提取 CRV导致 Curve 创始人 Michael Egorov 的健康仓位差点被清算,引发 CRV 价格闪崩。
## 关键教训
- **编译器不等于安全**:开发者通常信任编译器后端,但 Vyper 0.3.0 的 bug 打破了这一假设
- **语言级安全机制不可信**:即使合约使用了 `nonreentrant` 修饰符,编译器实现 bug 可使其完全失效
- **多池风险传染**Curve 的池共享相同的合约模板,一个漏洞影响多条链上的多个池
- **DeFi 可组合性放大风险**CRV 池的风险传导至借贷协议Aave引发连环清算风险
## 关联漏洞类型
- [[Reentrancy]] — 核心漏洞类型,虽然是编译器 bug 导致,但最终表现为重入攻击
- AMM Invariant ViolationAMM 不变量破坏):攻击者在交易中操纵价格
## 关联页面
- [[blockchain-security-auditor]] — 区块链安全审计 Agent将 Curve Finance 作为关键记忆模式收录于 Pattern Library
- [[The-DAO-2016]] — 同为重入攻击案例,但前者是智能合约逻辑漏洞,后者是编译器 bug