How Flash Loans Work and How They Can Be Used in Attacks

How Flash Loans Work and How They Can Be Used in Attacks

BACOOR NEWS5 min read

Flash loans let smart contracts borrow and repay within one blockchain transaction. Learn how atomic repayment enables trading, refinancing and some exploits.

In brief

  • A flash loan must be repaid, with any required fee, before its blockchain transaction completes.
  • Atomic execution makes temporary borrowing possible without ordinary long-term collateral.
  • Flash loans can support arbitrage and refinancing, but can also amplify price-manipulation and contract-design failures.

What makes a flash loan different

A flash loan is a form of borrowing that begins and ends inside one blockchain transaction.

A smart contract receives assets, performs a sequence of operations and must return the borrowed amount plus any required fee before the transaction completes.

If the conditions are not met, the transaction reverts under the blockchain's atomic execution rules.

The borrower therefore does not carry an unpaid loan into a later block in the usual flash-loan model.

This structure differs from a loan repaid over days or months.

Flash loans are typically offered by smart contracts that already manage pools of assets.

The maximum amount available depends on the pool's liquidity and its rules.

Borrowers generally need a contract or transaction path capable of executing the required steps, rather than a conventional credit score.

A flash loan of a token such as USD Coin does not transfer ownership of an unlimited pool of money.

Its use is temporary, and the protocol requires an acceptable repayment before the transaction can succeed.

Atomicity is the key technical feature.

A blockchain transaction can contain several contract calls that interact with exchanges, lending pools and other applications.

The chain ultimately records the state changes only if the whole transaction satisfies its execution conditions.

If a required repayment fails, the changes made within that transaction are rolled back.

However, a failed transaction can still incur network execution costs, depending on the chain.

On Ethereum, those costs are generally paid using Ether ETH; a reverted transaction does not necessarily mean the attempt was free.

Legitimate uses of short-lived liquidity

One legitimate use is arbitrage across trading venues.

The same asset can temporarily have different prices in different liquidity pools because trades and liquidity conditions vary.

A strategy can borrow an asset, trade through multiple pools and return the principal within one transaction.

Any remaining assets after fees and costs may form a trading profit.

This approach does not guarantee profits: prices can change before execution, liquidity can disappear and other traders may submit competing transactions.

Flash loans can also facilitate position management.

A borrower may use short-lived funds to repay an outstanding lending debt, release the associated collateral, exchange that collateral and settle the temporary loan.

In suitable protocols, this can make collateral changes or refinancing possible within one sequence.

The exact steps depend on permissions, market liquidity and contract interfaces.

Atomic repayment can reduce the need for a large separate starting balance, but it does not remove price impact, transaction costs or risks in the protocols involved.

Some lending systems allow third parties to repay debt for borrowers whose collateral has fallen below required thresholds.

A liquidator can use a flash loan to fund the repayment, receive collateral and sell enough of it to settle the temporary loan.

The remaining value, if any, compensates the liquidator under the protocol's rules.

Such liquidations can protect lenders from bad debt, but they may also create market pressure when many accounts become eligible at once.

Whether the operation succeeds depends on execution prices and available liquidity.

How flash loans can amplify attacks

The same temporary liquidity can be dangerous when another protocol assumes an observed market condition is difficult or expensive to manipulate.

Consider an application that uses the immediate price from a thin liquidity pool to value collateral.

An attacker may borrow a large amount, trade aggressively to move that pool's quoted price and interact with the vulnerable application while the price is distorted.

A later trade may restore the pool closer to its starting state before the attacker repays the flash loan.

In that scenario, the manipulated application may issue an oversized loan, accept undervalued collateral or settle an exchange at an unfavorable rate.

The attacker can extract value even though the flash-loan provider is repaid.

The critical weakness is the target application's trust in a price that can be changed during the same transaction.

This pattern explains why a loan that does not create unsecured long-term debt for its provider can still contribute to losses elsewhere in the DeFi ecosystem.

Flash loans have also featured in attacks involving unusual accounting assumptions, governance privileges or sequences of calls that developers did not anticipate.

For example, a system that counts temporarily borrowed voting power without adequate safeguards may be vulnerable to rapid influence over a decision.

Other exploits involve state changes across contracts, not simply moving the price of a token.

Flash-loan capital can help concentrate activity within a transaction, but the underlying failure is the unsafe rule or interaction being exploited.

Why the loan itself is not the vulnerability

Many protocols use safeguards against manipulation.

A time-weighted price oracle can reduce dependence on a single instantaneous swap, while multiple data sources and cautious collateral parameters can limit the effect of one bad market reading.

Controls on governance voting, interaction ordering and asset eligibility may address other weaknesses.

No one safeguard covers every possibility, however.

A historical price window can be inappropriate for fast-moving markets, and an external oracle can still have its own faults or delays.

A successful flash-loan transaction is not evidence that the activity was legitimate or harmful by itself.

The mechanism can be used for efficient trading or for abuse, depending on which contract functions are invoked and what the surrounding protocols permit.

Similarly, a protocol that offers flash loans is not necessarily the protocol whose design flaw caused a loss.

Incident reporting benefits from identifying the loan source, the vulnerable target, the manipulated assumption and the point where value left the affected system.

Flash loans illustrate a distinctive feature of programmable finance: a participant can temporarily control substantial liquidity without financing a long-term loan, provided the entire transaction settles under its rules.

That capability can improve market efficiency and support operations that would otherwise require more upfront capital.

It can also increase the scale of attacks when applications rely on manipulable prices or unsafe contract logic.

Understanding atomic repayment clarifies both why flash loans work and why safe protocol design matters.

Related articles

More in DeFi

Nothing on BACOOR NEWS is financial advice.

BACOOR NEWS is developed by BACOOR's Japan team and provides news, editorial content, and market data for informational purposes only. Nothing published constitutes financial or investment advice, or an offer, solicitation, or recommendation to buy, sell, or hold any financial product or digital asset. Coverage of any token, trading pair, company, protocol, or project does not imply endorsement or promotion. Digital asset markets involve significant risks. Always conduct your own research (DYOR) and review our Disclaimer before making investment decisions.

AI Content Transparency: Market Pulse summaries are automatically generated using artificial intelligence (AI) based on third-party information and market data. News articles and other editorial content may also be drafted, edited, or otherwise prepared with AI assistance. BACOOR does not independently verify all third-party information before publication. AI-generated or AI-assisted content may contain errors, omissions, or outdated information. Readers are encouraged to verify important claims against the original sources. BACOOR may correct, update, or remove inaccurate content when identified.

Product Promotions: BACOOR NEWS may display clearly identified promotional content about BACOOR's own products and services where permitted by applicable law. Crypto-related promotional banners are not displayed on the Vietnamese-language edition or to visitors in Vietnam. Such promotional material is separate from editorial news and market data.

Data and Information Sources: alternative.me, Bankless, Arkham, Binance, Bitget, Bybit, Coinbase, Coin Bureau, DefiLlama, DEX Screener, ExchangeRate-API, Farside Investors, U.S. Bureau of Labor Statistics, U.S. Bureau of Economic Analysis, Federal Reserve, Bank of Japan, Cabinet Office of Japan, Gate, Hyperliquid, Lookonchain, MEXC, OKX, PatternPlus, Forex Factory, SEC EDGAR, Solid Intel, SoSoValue, Trust Wallet assets, Wikidata, CoinGecko, GeckoTerminal, e-Stat, FRED (Federal Reserve Bank of St. Louis), Japan Customs (Ministry of Finance), Wikimedia Commons, the official blogs and GitHub releases of the projects we cover, and Watcher Guru. External information may be delayed, inaccurate, or incomplete. Source attribution does not imply affiliation or endorsement.

This service uses the API function of e-Stat (Portal Site of Official Statistics of Japan), but its content is not guaranteed by the Japanese government.

Build version: 11403dc · 2026-11-20 06:52 GMT+7