DeFi protocols have lost billions of dollars to smart contract exploits. Not to market downturns or regulatory action, but to code that did not behave the way its developers expected when someone deliberately pushed it sideways. Understanding how these attacks work is not just an academic exercise. If you use DeFi, your money is sitting inside these contracts.

The Ethereum ETH$2,129ETH$2,12924h-0.08%7d-3.71%30d-15.52%1y-8.74%MCap: N/AVol: N/Avia Statility ecosystem alone has seen over $5 billion drained through exploits since DeFi began scaling in 2020. Some of these were sophisticated zero-day attacks. Many were well-known vulnerability patterns that auditors missed or that were introduced after the audit was complete. Here are the attack vectors that keep showing up.

ETH Price (365 days)$2,129 Analyze

Live data via Statility

The Usual Suspects

Reentrancy

Reentrancy is the oldest smart contract vulnerability and it still works. The attack exploits a simple logic flaw: a contract sends funds to an external address before updating its own internal balance. The attacker's contract receives the funds, then immediately calls back into the original contract to withdraw again. Since the balance has not been updated yet, the contract thinks the attacker still has funds and sends more.

The most famous reentrancy attack was The DAO hack in 2016, which drained roughly $60 million in ETH and ultimately led to the Ethereum hard fork that created Ethereum Classic. You might assume the industry learned its lesson. It did not.

In July 2023, a reentrancy vulnerability in the Vyper compiler (not in any individual protocol's code, but in the programming language itself) led to exploits across multiple Curve Finance pools, draining over $60 million. The bug had been present in Vyper versions 0.2.15 through 0.3.0 for years. This matters because it shows that reentrancy can hide in layers of the stack that protocol developers and auditors are not even looking at.

Oracle Manipulation

DeFi protocols need price data to function. Lending platforms need to know collateral values. DEXs need reference prices for slippage protection. This price data comes from oracles, and manipulating the oracle means manipulating the protocol.

The Mango Markets exploit in October 2022 is a textbook case. Avraham Eisenberg used $5 million to artificially pump the price of MNGO tokens on Mango's own exchange, which inflated the value of his collateral position. He then borrowed $114 million against that inflated collateral and withdrew it. Technically, the protocol worked exactly as designed. The oracle reported the price it saw. The lending logic followed its rules. But the system assumed the oracle price reflected real market value, and that assumption was wrong.

Protocols that use a single on-chain source for price data, especially a low-liquidity token's own trading pool, are inherently vulnerable to this. Chainlink★★★★4.3Chainlinkservice★★★★4.3/51 AI reviewChainlink is a decentralized blockchain oracle network that enables smart contracts to securely connect to external d...via Rexiew Chainlink and other decentralized oracle networks exist to mitigate this by aggregating data across multiple sources, but not every protocol uses them, and even aggregated feeds can be manipulated under extreme conditions.

Flash Loan Attacks

Flash loans are uncollateralized loans that must be borrowed and repaid within a single transaction. If the repayment does not happen, the entire transaction reverts as if it never occurred. This is a genuinely novel financial primitive that has no equivalent in traditional finance.

It is also the tool that makes many exploits economically viable. Before flash loans, an attacker who wanted to manipulate a $50 million pool needed $50 million. With flash loans, they need enough ETH to cover gas fees and the flash loan premium, often just a few hundred dollars.

The pattern repeats across dozens of exploits: borrow a massive amount via flash loan, use it to manipulate a price oracle or drain a vulnerable pool, repay the loan, keep the profit. The bZx attacks in 2020 were among the first to demonstrate this pattern. Pancake Bunny in 2021 lost $45 million to a flash-loan-powered price manipulation. The list keeps growing.

Flash loans do not create the vulnerability. They amplify it. Any protocol that is vulnerable to large capital movements was already broken. Flash loans just made it possible for anyone to be the large capital, for free.

What Audits Actually Do (and Do Not Do)

A smart contract audit is a line-by-line code review, usually performed by a specialized security firm, that looks for known vulnerability patterns, logic errors, and deviations from the specification. Good auditors also test edge cases, simulate attack scenarios, and review the economic incentive structure.

Here is what audits are not: a guarantee. Audited protocols get hacked regularly. There are several reasons for this.

First, the code that was audited may not be the code that is deployed. Protocols often make changes after an audit, sometimes significant ones, and deploy without re-auditing. Second, audits examine a contract in isolation or within a limited scope. DeFi protocols are composable, meaning they interact with other protocols in ways that create emergent behaviors no single audit can predict. A lending protocol might be secure on its own but become vulnerable when someone creates a new pool that interacts with it in an unexpected way.

Third, many exploits are economic rather than technical. The code does what it was written to do, but the economic incentive structure has a flaw that an attacker can exploit. Auditors with a pure engineering background may not catch these. This is why some security firms now include economists and mechanism designers on their audit teams.

What Audits Catch vs. What They Miss

Audits typically catchAudits often miss
Reentrancy patternsPost-audit code changes
Integer overflow/underflowCross-protocol composability risks
Access control errorsEconomic or incentive design flaws
Known vulnerability patternsNovel attack vectors
Gas optimization issuesGovernance attack surfaces
Standard compliance (ERC-20, etc.)Infrastructure-layer bugs (compiler, EVM)

Post-Mortem Patterns

After enough exploit post-mortems, patterns emerge. Most exploits are not novel. They are variations on known themes applied to protocols that had blind spots.

Unverified assumptions are the most common root cause. The developer assumed the oracle price would be accurate. They assumed only the intended contracts would call a particular function. They assumed no one would have enough capital to move a market by 40% in a single block. Every assumption is a potential attack surface.

Upgradeable contracts and admin keys are another recurring theme. Many protocols use proxy patterns that allow the team to upgrade contract logic after deployment. This is intended as a safety mechanism, letting developers fix bugs quickly. But it also means a compromised admin key can be used to replace a working contract with a malicious one. The Ronin Bridge hack in 2022, which lost $625 million, was ultimately an admin key compromise rather than a smart contract logic flaw.

Notable DeFi Exploits

ProtocolYearAmount lostAttack type
The DAO2016$60MReentrancy
Ronin Bridge2022$625MValidator key compromise
Wormhole2022$320MSignature verification bypass
Mango Markets2022$114MOracle / price manipulation
Curve (Vyper)2023$60MCompiler-level reentrancy
Euler Finance2023$197MLiquidation logic flaw

Protecting Yourself

You cannot audit smart contracts yourself unless you are a Solidity developer, and even then you would probably miss things. But you can assess risk more clearly by asking the right questions.

Check whether a protocol has been audited, by whom, and how recently. An audit from two years ago on a codebase that has been updated fifty times is not providing much assurance. Multiple audits from independent firms are better than one. Bug bounty programs are a good sign because they create ongoing incentive for white-hat researchers to find problems before attackers do.

Understand who holds the admin keys. If a multisig with three signers controls the ability to upgrade the contracts, that is a meaningful centralization risk. If those keys sit behind a timelock that gives users 48 hours to exit before changes take effect, that is a better design.

Be cautious with forks. When a team copies another protocol's code and launches a new version, they often modify pieces without fully understanding the security implications. Some of the worst exploits have hit poorly-executed forks of otherwise secure protocols.

Diversify across protocols. The same logic that applies to not keeping all your fiat in one bank applies here. If a protocol you are using gets exploited, exposure limited to a fraction of your portfolio is a survivable loss. Concentration is not.

DeFi security is improving. Formal verification tools, more sophisticated audit practices, and battle-tested codebases like Uniswap★★★★4.3Uniswapservice★★★★4.3/51 AI reviewUniswap is a decentralized finance protocol that facilitates automated trading of cryptocurrency tokens on the Ethere...via Rexiew Uniswap and Aave★★★★★4.4Aaveservice★★★★★4.4/51 AI reviewAave is a decentralized finance (DeFi) protocol that allows users to lend and borrow cryptocurrencies without interme...via Rexiew Aave have proven that well-built contracts can secure billions of dollars over years without incident. But the frontier is always messy, and new code carries new risk. The protocols offering the highest yields are often the ones least tested by time and adversarial conditions. That is not a coincidence.

Looking for crypto platforms, exchanges, and DeFi apps? Browse our curated directory: