[论文解读] Attacking the DeFi Ecosystem with Flash Loans for Fun and Profit
本论文分析闪电贷和事物原子性如何促成高收入的去中心化金融攻击,解构了两个真实攻击,并提出一个参数化优化框架以最大化攻击利润。
Credit allows a lender to loan out surplus capital to a borrower. In the traditional economy, credit bears the risk that the borrower may default on its debt, the lender hence requires upfront collateral from the borrower, plus interest fee payments. Due to the atomicity of blockchain transactions, lenders can offer flash loans, i.e., loans that are only valid within one transaction and must be repaid by the end of that transaction. This concept has lead to a number of interesting attack possibilities, some of which were exploited in February 2020. This paper is the first to explore the implication of transaction atomicity and flash loans for the nascent decentralized finance (DeFi) ecosystem. We show quantitatively how transaction atomicity increases the arbitrage revenue. We moreover analyze two existing attacks with ROIs beyond 500k%. We formulate finding the attack parameters as an optimization problem over the state of the underlying Ethereum blockchain and the state of the DeFi ecosystem. We show how malicious adversaries can efficiently maximize an attack profit and hence damage the DeFi ecosystem further. Specifically, we present how two previously executed attacks can be "boosted" to result in a profit of 829.5k USD and 1.1M USD, respectively, which is a boost of 2.37x and 1.73x, respectively.
研究动机与目标
- 解释闪电贷如何在原子交易中消除违约风险和对抵押品的需求。
- 量化交易原子性如何增加套利收益并分析实际攻击的投资回报率。
- 在链上状态和DeFi原语给定的前提下,开发一个受约束的优化框架以最大化攻击利润。
- 在两个有据可查的攻击上评估该框架并估算潜在的错失利润(机会损失)。
- 讨论对DeFi安全与价格源/价格操纵风险的更广泛影响。
提出的方法
- 描述闪电贷及其使能的三个新性质:无违约风险、无抵押品、基于资金池的贷款规模。
- 将DeFi操作建模为带参数的状态转移函数,从而在攻击参数上构建优化问题。
- 将攻击向量形式化为带约束的转移序列,并定义一个目标以最大化对手利润。
- 使用带参数的优化器(SLSQP)在给定区块链状态和DeFi模型下求解最优攻击参数。
- 通过分叉区块链(Ganache)并在Solidity中实现优化后的攻击以实现部分复制来验证优化结果。
- 通过比较原子执行与非原子执行场景,分析原子性对套利的影响。
实验结果
研究问题
- RQ1区块链交易原子性如何影响闪电贷驱动的DeFi攻击的盈利能力与风险?
- RQ2在给定DeFi状态和平台的情况下,哪些攻击参数(如贷款规模、抵押品、杠杆等)能最大化收入?
- RQ3若攻击者使用最优参数而非历史观测参数,能够获得多少额外利润?
- RQ4在现实世界攻击中由于非最优参数选择导致的机会损失有多大的上限?
- RQ5当使用闪电贷和原子交易时,对DeFi生态系统的更广泛安全影响是什么?
主要发现
- 两个由闪电贷驱动的攻击的投资回报率超过50万%的ROI(泵送攻击并伴随套利与预言机操纵)。
- .优化参数可将 PA&A 利润提升至 2,778.94 ETH(较原始的1,193.69 ETH增加约829.5k USD),以及对预言机操纵至6,323.93 ETH(较原始的634.9k USD增加约110万USD)。
- 在本地分叉验证PA&A时,优化后的第一部分收入达到1,958.01 ETH,而原始为1,193.69 ETH。
- 预言机操纵显示攻击者可以扭曲价格预言机(Uniswap/Kyber)并以膨胀的抵押品借款,在原始攻击中产生2,381.41 ETH,优化在约束下最终收入可达到4,167.01 ETH。
- 原子交易分析表明,当中间交易插入时套利收入下降,体现原子性对价格波动的保护作用。
- 该框架使在现实区块链状态下的攻击参数优化在毫秒级内完成。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。