If Borrowed Capital Can Settle as Truth, Flash Loans Will Beat You
Flash loans are not dangerous because money can be borrowed cheaply. They are dangerous because too many protocols let temporary capital settle as truth.
Establish the problem with technical depth
Most teams still describe flash loan exploits backwards.
Aave's documentation is clear about what a flash loan actually is: one-transaction access to liquidity, with the borrowed amount plus fee returned before the transaction ends. No upfront collateral is required. That means the attacker is not bringing long-term conviction or patient capital. They are renting size for a few hundred milliseconds and asking whether your protocol mistakes temporary influence for a legitimate state.
That distinction is why flash loans keep showing up in major losses without being the real root cause.
On April 17, 2022, Beanstalk disclosed that it was attacked through its governance mechanism, resulting in a theft of about $77 million in non-Beanstalk user assets. The critical detail was not merely that a flash loan was used. The critical detail was that borrowed voting power could become effective authority quickly enough to move real assets.
Mango Markets showed the same pattern through pricing and collateral instead of governance. On January 20, 2023, the SEC said Avraham Eisenberg allegedly manipulated the thinly traded MNGO token beginning on October 11, 2022, used that move to inflate the value of his MNGO perpetuals, and then borrowed and withdrew about $116 million in crypto assets from Mango. Again, the flash loan style capability mattered because it supplied scale. The actual failure was that the platform allowed temporary market conditions to become withdrawable truth.
That is the part both sides of the cap table should care about.
For founders and investors, these are not niche engineering stories. They are balance-sheet failures. If one block of borrowed capital can create real voting power, real borrow capacity, or real withdrawal rights, then the protocol's downside is not "we might eventually discover a bug." The downside is immediate insolvency at machine speed.
For CTOs and Solidity engineers, the lesson is harsher. Public chains do not let you depend on capital scarcity, slow reaction time, or the hope that a manipulative trade is too expensive to assemble. In DeFi, capital is rentable. Execution is composable. Attack paths can be rehearsed on mainnet forks before the first live attempt. If your security argument starts with "an attacker probably cannot get that much size that quickly," your security argument is already over.
The mechanism, the mistake, the misunderstanding
Flash loans only become dangerous when a protocol lets temporary power settle into a permanent right.
That happens in three common ways.
The first is when temporary price becomes collateral truth. A contract reads a spot price from a venue an attacker can move and uses that number inside the same execution path that releases value. The code often looks reasonable in isolation:
function borrow(uint256 amount) external {
uint256 collateralValue = collateral[msg.sender] * oracle.spotPrice();
require(collateralValue >= debt[msg.sender] + amount, "insolvent");
debt[msg.sender] += amount;
asset.transfer(msg.sender, amount);
}
The bug is not the flash loan. The bug is that spotPrice() can be turned into fiction inside the same transaction that mints borrow power. If the protocol accepts a manipulable price as final truth, borrowed capital becomes real withdrawal capacity.
The second is when temporary balances become governance authority. Beanstalk is the clean example. A protocol that treats current balances as legitimate voting weight, and allows proposals to move too quickly from approval to execution, is effectively saying that borrowed tokens can buy real control. OpenZeppelin's governance docs describe the safer model directly: voting delay fixes voting power at a timepoint, and timelock extensions add a queue step before execution. That separation exists for a reason. Governance should not instantly honor temporary ownership as durable authority.
The third is when an internally amplified mark becomes withdrawable value. Mango was brutal because the manipulated asset and the borrowing power were tied together. A thin market was pushed, the paper value of a position rose, and the protocol treated that temporary mark as if it represented defensible collateral. That is not just oracle risk. It is a reflexive balance-sheet design error.
The industry's biggest misunderstanding is calling these events "flash loan attacks" and stopping there. A flash loan is just the financing layer. The exploitable mistake sits deeper: a price that can be rented, a balance that can be borrowed into governance power, an internal mark that can be converted into real assets, or an invariant that only holds when markets behave politely.
That is why banning the label matters. Labels make teams patch the headline instead of the assumption.
If your protocol becomes unsafe the moment the attacker can access maximum capital for one transaction, then the protocol was never protected by logic. It was protected by a temporary market inconvenience.
What good looks like
Good flash loan defense starts by assuming the attacker already has all the relevant size they need.
That changes design decisions immediately.
For price-sensitive logic, stop letting same-transaction spot prices settle solvency. Borrow checks, mint limits, liquidation math, and redemption paths need delayed, averaged, bounded, or independently sourced price signals. Thin governance tokens, low-liquidity LP positions, and self-referential assets should not be treated like clean collateral simply because they have a visible onchain price. In some cases, the right answer is not a clever oracle patch. It is refusing to let a fragile asset determine its own borrow power.
For governance, separate ownership from execution. OpenZeppelin's governance guide explicitly recommends a timelock because it gives users time to exit before a decision is executed. That is not optional ceremony. It is a control against borrowed influence becoming immediate treasury authority. Historical voting power, proposal delay, queueing, and delayed execution are basic defenses, not polish for mature DAOs.
For testing, move up from function correctness to property correctness. Foundry's invariant testing guide is valuable because it frames security as properties that must always hold regardless of the sequence of actions taken, with Forge running random sequences of calls and checking those invariants after each one. That is much closer to how real exploit paths appear. The right invariant is not "borrow succeeds on the happy path." The right invariant is "manipulable state cannot create unbacked liabilities," or "temporary voting weight cannot execute treasury extraction," or "the protocol cannot release more realizable value than it actually owns."
Then test those properties against live assumptions. Foundry's fork testing guide matters because it lets teams run tests against real chain state without deploying to a live network. That means real liquidity profiles, real token behavior, real oracle surfaces, and real integrations instead of polite mocks. A system that only survives a laboratory version of the market is not secure. It is well-rehearsed.
Operationally, every change to oracles, collateral lists, liquidation parameters, governance thresholds, execution delay, or privileged permissions should be treated as security-critical. Flash loan exploits do not only emerge from untouched core contracts. They often emerge when a new asset is listed, a pricing shortcut is added, a governance path is accelerated, or a parameter is loosened because it looked commercially useful. In production, those are not small changes. They are new ways for borrowed capital to test your truth model.
Founders should update their diligence questions accordingly. Do not ask only whether the team was audited. Ask which prices the protocol trusts, whether any asset can influence its own borrowable value, whether governance uses historical voting power, whether execution is delayed, and which invariants are machine-checked before release. If nobody can answer clearly, the protocol is not capital-ready.
ChainShield's angle
ChainShield treats flash loans as baseline environment, not exotic edge case.
That means the review question is not "could someone use a flash loan here?" The answer is almost always yes. The real question is what that temporary capital can make the system believe.
Which price can become collateral truth? Which balance can become authority? Which accounting path can temporarily look solvent and still release permanent value? Which new diff widened the attack surface without anyone rewriting the threat model?
That is where ChainShield's view differs from checklist security. We care less about whether a protocol can name the bug class and more about whether it can defend the business truths that matter when the attacker has atomic liquidity, composable routing, and unlimited patience to rehearse the path.
The teams that survive flash-loan environments do not "handle flash loans" as a special case. They remove the shortcuts that let temporary power settle as final truth in the first place.
If borrowed capital can settle your risk model, the market is not your friend. It is your exploit harness.
ChainShield Discovery Runs are designed to identify high-risk issues quickly, validate what matters, and give engineering teams a faster path to remediation.
Request Security Quote