DeFi Security: Risks and Controls by Protocol Type
Quick answer. DeFi lenders fail on collateral pricing and liquidations, perps on price feeds and margin math, AMMs and vaults on rounding. Liquid staking fails on mint rights, restaking on pricing and cross-chain routes, and bridges on message verification.
Video transcript
DeFi protocols hold user funds in code anyone can call. Each protocol type breaks in its own place, and needs its own controls.
Three things make DeFi different. Composability ties your solvency to every integration. Flash loans make attacks atomic. And one failure lands on every protocol that accepts its token.
Kelp DAO shows how. A forged cross-chain message released 116,500 rsETH, which the attacker posted as collateral on Aave to borrow WETH.
Lenders fail on health checks and liquidations, which cost Euler 197 million dollars. Perps fail on price feeds and margin math, AMMs and vaults on rounding.
Liquid staking fails on mint rights. Restaking fails on pricing and cross-chain routes. Bridges fail on message verification, which cost Nomad 190 million dollars.
Check health after collateral changes, verify every signed price, and round against the user. Seed vaults, timelock mint rights, and require multiple verifiers per route.
In Guardian's reports, a pending withdrawal could block liquidation at Dolomite. Synthetix traders could withdraw collateral while owing debt. At GMX, one bridged token could be credited as another.
Guardian's audit puts two competing teams on the same code, one manual and one AI-driven. Pentests cover keepers and APIs. After launch, Managed Security tracks signers and live risk.
Read the full guide for every vertical, or talk to Guardian at guardian.security to get your risks reviewed.
DeFi protocols hold user funds in code anyone can call, often priced by data they do not control.
Within each protocol type, the same few failures repeat. A lending market and an AMM break in different places, so they need different controls.
This guide maps seven verticals: what breaks, one public incident, and the controls that answer it. Each links to a deeper Resource Hub guide.
What Makes DeFi Different
- Composability: every token, oracle and protocol you integrate becomes part of your solvency.
- Atomic attacks: flash loans let an attacker borrow, manipulate and repay in one transaction.
- Shared losses: a failure in one protocol lands on every protocol that accepts its token.
Kelp DAO is the clearest recent case. Its stolen rsETH was posted as collateral on Aave, where the attacker borrowed WETH against it.
Risks by Vertical
| Vertical | What breaks | Public incident | Core controls |
|---|---|---|---|
| Lending | Collateral pricing, health checks, liquidations | Euler, March 2023: $197M | Health check after every collateral change; caps sized to liquidity |
| Perps | Price feeds, margin, funding and PnL math | KiloEx, April 2025: about $7.5M | Verify every signed price; fuzz funding and PnL |
| AMMs | Rounding, invariant math, hooks | Balancer V2, November 2025: about $128M | Round against the user; test extreme balances and decimals |
| Vaults | Share price inflation through donations | Resupply, June 2025: $10M bad debt | Seed vaults; never price collateral from an empty vault |
| Liquid staking | Mint authority, exchange rates, slashing | Ankr, December 2022: 60 trillion aBNBc minted | Timelocked mint and upgrade rights; slashes applied first |
| Restaking | Backing, pricing and every route the token travels | Kelp DAO, April 2026: 116,500 rsETH released | Multiple verifiers per route; caps sized to the weakest route |
| Bridges | Message verification, initialization, signer sets | Nomad, August 2022: $190M | Independent verifiers, rate limits, initializer tests |
Each row is covered below, with a finding from Guardian's public reports.
Lending and Perps
Lending and money markets
A lender prices collateral itself. If the price, the health check or the liquidation is wrong, depositors absorb the bad debt.
Euler lost $197M in March 2023. Rekt reports that its donateToReserves function did not check the health of the donor's position.
One attacker contract made itself insolvent with a donation. A second liquidated it at a discount.
In Dolomite's GMX V2 module, Guardian found that a pending withdrawal could block a position's liquidation (Critical).
Run a health check after every action that lowers collateral, and keep liquidations working on insolvent positions. The full list is in our lending protocol audit checklist.
Perpetuals and derivatives
A perp settles profit and loss on its price feed. A wrong price is a direct transfer to the attacker.
KiloEx lost about $7.5M in April 2025. Rekt reports its price updates trusted a forwarder that accepted forged signatures.
The attacker set ETH to $100, opened leveraged longs, then set it to $10,000.
Margin math fails more quietly. In Synthetix's BFP Market, Guardian found traders with no open position could withdraw collateral while still owing debt (Critical).
Verify every signed price update, and fuzz funding and PnL invariants. See perp DEX security for liquidations and keepers.
AMMs and Vaults
AMMs and DEXs
An AMM's safety rests on its invariant math. A small rounding error repeats on every swap.
On November 3, 2025, Balancer V2 Composable Stable Pools were drained on several chains. Rekt cites PeckShield's total of about $128M.
Rekt traces the flaw to a scaling function that always rounded down.
In Baseline's AMM, Guardian found reserve amounts rounded down for tokens under 18 decimals, so dust trades could collapse the pool price (Critical).
Round against the user everywhere, and test with low-decimal tokens and extreme balances. The math is in our constant product AMM guide.
Vaults
Vaults price shares from the assets they hold. Anyone who can donate assets can move that price.
Resupply took $10M of bad debt in June 2025. Its post-mortem says a donation inflated an empty vault used as collateral.
The exchange rate then rounded to zero, so the solvency check passed every borrow.
In Peapods' LendingAssetVault, Guardian found the classic first-deposit inflation attack (Critical).
Seed every vault at deployment, and use virtual shares or an offset. The ERC-4626 inflation attack guide walks through the exploit.
Staking, Restaking and Bridges
Liquid staking
A liquid staking token is a claim on staked assets. Whoever can mint it can print collateral.
In December 2022, Ankr's deployer key on BSC was compromised. Rekt reports a malicious upgrade let the attacker mint 60 trillion aBNBc.
Thin liquidity limited the attacker to about $5M. A separate user then borrowed 16M HAY on Helio against aBNBc before its oracle updated.
In Valantis' stHYPE contracts, Guardian found minting could go ahead while a slash was pending, shifting the loss to new minters (High).
Put mint and upgrade rights behind a timelocked multisig, and apply slashes before any mint or redeem.
Restaking
Restaking tokens add withdrawal queues, operator risk and, often, many chains.
On April 18, 2026, a forged cross-chain message released 116,500 rsETH from Kelp DAO's bridge, per Rekt. LayerZero says the route relied on a 1-of-1 DVN setup.
In Rest Finance's EigenLayer LST vault, Guardian found stETH priced at a hardcoded 1 ETH (High).
Require multiple verifiers on every route, and price each token from its own feed. Our Kelp DAO breakdown covers the route checks.
Bridges
A bridge mints or releases funds when a message verifies. If verification fails, an attacker can claim funds that were never sent.
Nomad lost $190M in August 2022. Rekt reports that after a June upgrade, the zero root was trusted, so every message read as valid by default.
Copycats then repeated the same call with their own addresses.
In GMX's cross-chain review, Guardian found an attacker could bridge one token and be credited for another (Critical).
Use independent verifiers and rate limits, and test every initializer after an upgrade. For how verifier sets compare, read LayerZero vs Chainlink CCIP.
How Guardian Reviews DeFi Protocols
Guardian's public reports cover every vertical above, and each finding links to its report.
Guardian's smart contract audit puts two competing teams on the same code, one manual and one AI-driven, with invariant fuzzing beneath both.
Pentests cover what sits around the contracts: keepers, APIs, web apps, SDKs and cloud.
After launch, Managed Security tracks contract inventory, signers and live risk. More on Guardian for onchain teams.
Frequently Asked Questions
What is DeFi security?
The controls that keep a decentralized finance protocol's contracts, prices, keys and integrations from losing user funds. It spans design, audits, invariant testing, deployment checks and monitoring after launch.
Why do DeFi exploits spread between protocols?
Because protocols accept each other's tokens. After a forged message released Kelp DAO's rsETH, the attacker posted it as collateral on Aave and borrowed WETH, leaving Aave facing estimated bad debt.
Does a forked DeFi protocol still need an audit?
Yes. A fork changes parameters, assets and integrations, and each change is new risk. Check every issue disclosed in the original codebase against your fork as well.
Which DeFi security controls matter most?
Invariant tests for accounting and solvency, oracle checks, caps sized to real liquidity, timelocked admin keys, multiple verifiers on bridges, and monitoring with a tested pause.
Sources
- Rekt: Euler Finance, Rekt (March 14, 2023)
- Rekt: KiloEx, Rekt (April 17, 2025)
- Rekt: Balancer, Rekt II (November 14, 2025)
- Resupply: crvUSD-wstUSR Market Post Mortem (June 28, 2025)
- Rekt: Ankr and Helio, Rekt (December 2, 2022)
- LayerZero: KelpDAO Incident Statement (April 19, 2026)
- Rekt: KelpDAO, Rekt (April 24, 2026)
- Rekt: Nomad Bridge, Rekt (August 2, 2022)
- Guardian: Public audit portfolio and report data (read November 5, 2026)
- Guardian: Security for Onchain Teams and DeFi Protocols
Get your protocol's vertical risks reviewed
Guardian audits lending markets, perps, AMMs, vaults, staking tokens and bridges against the failures that hit each one.