A large majority of DeFi hacks are flash loan attacks. Since the technology is new, vulnerabilities are not readily apparent and may require skilled developers to identify.
Flash loan attacks can cost DeFi protocols and their users hundreds of millions. As such, safeguards must be put into place to ensure that a protocol is robust and sanitized.
Decentralized pricing oracles to protect against slippage
Tools for detecting possible attacks
Flash loan arbitrage
Collateral swaps
Debt refinancing
- Borrow assets from Aave liquidity
- Payback debt on Compound
- Withdraw collateral from Compound
- Deposit collateral on Dydx
- Mint debt on Dydx
- Return liquidity to Aave
- The borrower applies for a flash loan on Aave.
- The borrower creates a logic of exchanges to try making a profit, such as sales, DEX purchases, trades, etc.
- The borrower repays the loan, makes a profit, and pays a 0.09% fee.
- If any of the following conditions occur, the transaction is reversed, and the funds are returned to the lender: