Flash Loan Attack
A flash loan attack exploits uncollateralized flash loans in DeFi to manipulate prices or drain funds within a single blockchain transaction that must repay the loan or revert.
What Is a Flash Loan Attack?
A flash loan attack is a DeFi exploit that uses a flash loan to supply the capital. A flash loan is borrowed and repaid within a single transaction, with no collateral; if repayment fails, the whole transaction is reverted as if it had never happened. This gives anyone temporary access to very large sums for the price of a fee and gas.
The loan itself is not the flaw. The attacker uses the borrowed funds to exploit a weakness somewhere else, all inside the same transaction. Typical patterns are moving the price in a thinly traded pool that another protocol reads as its price oracle and then borrowing against the distorted price, or borrowing governance tokens to pass a malicious vote.
The attack on bZx in 2020 was an early case of price manipulation. In 2022 Beanstalk lost about 182 million dollars when an attacker used flash-loaned voting power to approve a proposal that sent the protocol's funds to them. Common defences are time-weighted or external price oracles, delays between a vote and its execution, and audits.
A hardware wallet does not protect against this. Tokens deposited in a protocol are held by its contracts, and if those are drained, the keys on the device were never involved. The device secures what sits at your own addresses.
Real-World Examples
Example 1: An attacker borrows a large amount of a stablecoin, buys a small token in a shallow pool to push up its price, deposits the token as overvalued collateral in a lending protocol that reads its price from that pool, borrows other assets, repays the flash loan and leaves the protocol with bad debt.
Example 2: A user keeps part of their tokens in a lending protocol and part on a hardware wallet. The protocol is exploited with a flash loan. The deposited share is affected; the tokens at the user's own address are not.
Ready to Choose a Secure Wallet?
Use our tools to find the right hardware wallet for your needs.