Share on XShare on LinkedInShare on Telegram
Web3 Security

Flash Loan Attacks and the DeFi Assumptions They Expose

Discover how flash loan attacks exploit weak DeFi assumptions around price oracles, temporary balances, accounting, governance, and liquidity. Learn why flash loans themselves are not vulnerabilities, how attackers amplify short-term capital, and what DeFi founders and CTOs can test before launch, including oracle protection, fuzz testing, accounting invariants, transaction limits, and adversarial smart contract audits.

Author
QuillAudits Team
January 1, 1970
Flash Loan Attacks and the DeFi Assumptions They Expose
Share on XShare on LinkedInShare on Telegram

At 3:17 a.m., a lending protocol's dashboard shows a transaction that should not be possible.

An anonymous wallet borrowed a large amount, drove the price of a lightly traded asset higher, used that short-term move as collateral for a disproportionately high loan, unwound the initial trades and paid back the original debt. The wallet entered with very few funds and exited with the protocol's funds. Every step occurred before having the block finished.

This is what the team refers to as a flash loan attack. This is mostly true. Though, this underestimates the magnitude of the attack. It was not only a flash loan, but the magnitude of that loan that was the key. The loss resulted from a protocol assumption that broke down once a user could grab such a large loan in one go.

This is where it's relevant for founders and CTOs. This difference means that blocking out a known flashloan provider won't solve existing price oracle, accounting formula or governance rule which rely on ephemeral balances.

 

What a Flash Loan Attack Actually Does

Flash loan A one time loan that can be taken by a borrower without collateral as long as the entire borrowed amount + fee is paid back before the end of the transaction. Aave's docs state that the whole borrow/use/return flow is a single atomic transaction. If it cannot be repaid, this one fails.

That feature enables real arbitrage, liquidations and collateral swaps. The flash loan itself is not an exploit.

The 2026 smart contract guidance from OWASP refers to these attack types as flash loan enabled attacks. With an amplified "underlying weakness" liquidity sourced, the attacker has the maximum leverage for maximum gain.

The attacker's advantage (temporary pur-chasing power) is the impact he has created through manipulation, which can be used to experiment on transactions that would have otherwise needed millions of committed capital. A transaction fee and a deadline contract is all needed, and novice attack efforts can practically hold billions.

 

The Weak Assumptions Flash Loans Reveal

The first weak assumption will be a large balance shows long-term economic exposure. It may be just a few internal calls of the funds.

The other is that an on-chain observed market price reflects a stable market. If a protocol observes a spot price from one of many pools of liquidity, borrowed capital may move that price long enough to change pricing on collateral, shares issuance or liquidation.

Accounting offers an additional avenue. – By copying the operation, round errors which seem insignificant at small scale can be made beneficial for a large transient position. deposit withdraw donate and rebalance must all be tested in a chain, not as separated calls.

The Impermax V3 exploit is a good example. As explained in the Impermax flash loan attack analysis from QuillAudits, the attacker leveraged credit, exploited the fee and position logic and exploited the protocol with bad debt. The gainful technique was based on business logic, not a broken flash loan contract.

Governance can fail for the same reason too. If a voting power originates from a live token balance, then borrowed tokens could sway a proposal, without conferring permanent ownership.

 

Why Common Defences Miss the Real Risk

A blocklist of known flash loan providers is fragile. Attackers can source funds from an alternative source, combine multiple pools or even use their own capital if the profit is large enough.

When does a time-weighted average price mitigate manipulation? For time-weighted average prices to mitigate manipulation, the observation window, sources of liquidity and fallback should be based around the protocol's threat model. An ill armed oracle can continue to report a stale, shallow or manipulable price.

Per-transaction limits do limit damages, but don't fix the wrong share accounting. These restrictions are just layers with rate limits, borrowing limits and slip checks. The formula underneath them still must be safe for extreme inputs.

This is where a useful DeFi audit considers an attacker who enters a position by borrowing any amount of the free market. What values can be manipulated in one txn? What functions are manipulated if called in a different order?

 

What DeFi Teams Should Test Before Launch

The security review of a flash loan should trace the value through the entire protocol. It should include all external pools tokens oracles, vaults and governance contract used on the way.

• Manage all pricing sources on the platform with possible market-makers in a realistic       liquidity range 

• Fuzz the overall deposit and withdrawal sequence at very large values 1e+06 or 1e+07

• Pay test rounding direction for shares fees interest and liquidation math

• Check forward and backward collateral integrity, before and after each call to an external component.

• Cap the amount of debt exposure or protocol state that can change at the same time

• Employanindependentpricesourcesandcheckfreshnessanddeviation

• Conduct fork tests based on real pool depth and the behaviour of the tokens

• Define invariants for reserves assets liabilities, and total shares

 

The multi-layer smart contract audit offered by QuillAudits manual check of the business logic plus fuzzing and third-party validation. For flash loan risk, that is significant because the exploitable flow usually involves multiple contracts and seems innocuous when each function is examined in isolation.

Teams should also observe abnormal borrowings, oracle aberrant, fast share-price fluctuation and recurring high impacts calls after implementation. An audit tests the designed system. Observation alerts identification of all unexpected behavior in live market state.

Conclusion

Flash loans make capital cheap for one transaction. They do not make secure protocols unsafe by themselves.

The protocols that failed usually trusted a spot price, a temporary balance, a rounding rule or a call sequence that had never been tested under adversarial scale. Founders should treat unlimited short-term liquidity as part of the normal threat model.

If your protocol depends on lending, vault accounting, AMM liquidity or on-chain pricing, speak with QuillAudits about an adversarial smart contract audit before mainnet. One transaction is enough to test every assumption at once.

Contents

Tell Us About Your Project
Subscribe to Newsletter
hashing bits image
Loading...
Loading...

WE SECURE EVERYTHING YOU BUILD.

From day-zero risk mapping to exchange-ready audits, QuillAudits helps projects grow with confidence. Smart contracts, dApps, infrastructure, compliance: secured end to end.

QuillAudits Logo


ISO 27001Circle Alliance Program
Uniswap FoundationAethiropt-collectivePolygon SPNBNB Chain Kickstart

All Rights Reserved. © 2026. QuillAudits - LLC