Attacking the DeFi Ecosystem with Flash Loans for Fun and Profit
arXiv:2003.03810
Abstract
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.
References in corpus (4)
- ContractFuzzer: Fuzzing Smart Contracts for Vulnerability Detection
- Vandal: A Scalable Security Analysis Framework for Smart Contracts
- Flash Boys 2.0: Frontrunning, Transaction Reordering, and Consensus Instability in Decentralized Exchanges
- Libra: Fair Order-Matching for Electronic Financial Exchanges
Cited by in corpus (18)
- SoK: Decentralized Exchanges (DEX) with Automated Market Maker (AMM) Protocols
- SoK: Oracles from the Ground Truth to Market Manipulation
- SoK: Yield Aggregators in DeFi
- From banks to DeFi: the evolution of the lending market
- DeFiRanger: Detecting Price Manipulation Attacks on DeFi Applications
- High-Frequency Trading on Decentralized On-Chain Exchanges
- A First Look into DeFi Oracles
- A2MM: Mitigating Frontrunning, Transaction Reordering and Consensus Instability in Decentralized Exchanges
- DeFi-ning DeFi: Challenges & Pathway
- Automated Market Makers for Decentralized Finance (DeFi)
- Trade or Trick? Detecting and Characterizing Scam Tokens on Uniswap Decentralized Exchange
- Analysis of Cryptocurrency Transactions from a Network Perspective: An Overview
- Formal Analysis of Composable DeFi Protocols
- Flashot: A Snapshot of Flash Loan Attack on DeFi Ecosystem
- Flash Crash for Cash: Cyber Threats in Decentralized Finance
- Optimal Bidding Strategy for Maker Auctions
- BLOCKEYE: Hunting For DeFi Attacks on Blockchain
- A Case for a Currencyless Economy Based on Bartering with Smart Contracts