Security

Smart contract risk: how DeFi protocols break, and how to judge one before you deposit

In DeFi, the code is the bank, the vault and the security guard. When the code has a flaw, there's no branch manager to call. Billions have been lost to exploits. Here's how protocols actually break, and a practical way to judge one before you trust it with your money.

By the soop.wiki teamPublished 5 min read

{}



Jump to the protocol risk checklist

Traditional finance has many layers of protection: banks have risk teams, trades can be cancelled, courts can freeze accounts, and deposit insurance backs savings. DeFi strips most of that away. A smart contract does exactly what its code says, for anyone who interacts with it, around the clock.

That's the point, and it's also the danger. If the code allows something the developers never intended, an attacker can do it, and it's usually final.



How protocols actually break

Logic bugs
The code does something unexpected, like letting a user withdraw more than they deposited or call a function twice before balances update. The 2016 DAO hack, which drained millions of ether and led to Ethereum's controversial hard fork, was this kind of bug.
Oracle manipulation
Protocols need prices from outside data sources, or oracles. If an attacker can distort the price a protocol sees, for example in a thinly traded pool, they can borrow far too much or trigger unfair liquidations.
Flash loan attacks
Flash loans let anyone borrow huge sums for a single transaction. They're not a bug themselves, but they let attackers amplify other weaknesses without needing their own capital.
Admin key compromise
Many protocols have privileged keys that can upgrade contracts or move funds. If those keys are stolen, or the holders act badly, the code's safety doesn't matter.
Bridge exploits
Bridges hold large pools of assets to move value between chains. They've been among the largest single targets, with individual hacks running into hundreds of millions of dollars.
Front-end attacks
The smart contracts are fine, but the website is hijacked to make users sign malicious transactions.
Real talk

When a hack makes the news, the code that failed was often audited, and often by a reputable firm. That's not a scandal. It's a reminder of what an audit is.

What an audit is, and isn't

An audit is a review of a specific version of the code, by a specific team, over a limited time, usually a few weeks. Auditors look for known vulnerability patterns and logic errors and report what they find.

An audit does An audit doesn't
Catch many common bugs Guarantee no bugs remain
Show the team takes security seriously Cover code changed after the audit
Produce a public report you can read Usually assess economic design or market conditions
Make obvious mistakes less likely Protect against admin key misuse or front-end attacks

Better signals than "audited" on a homepage:

  • Several audits from different firms, with findings published and fixed.
  • A meaningful bug bounty, big enough that finding a bug pays more honestly than exploiting it.
  • Formal verification of critical components, for some protocols.
  • Time and value. Code that's held large sums for years without incident has been tested by every attacker watching.

Upgradeability and governance

Many protocols can change their code. That's useful for fixing bugs and dangerous if misused.

  1. Who can upgrade?

    One developer key, a multisig of several people, or a token vote?

  2. Is there a timelock?

    A delay between an upgrade being proposed and taking effect gives users time to leave.

  3. Can someone pause or seize funds?

    Emergency powers can stop a hack, or freeze you out.

  4. How concentrated is governance?

    If a few wallets control most of the votes, "decentralised" is a label, not a fact.

Check a protocol before you deposit

Protocol risk checklist

Your score0 / 16
Rating-

A structured way to think about risk, not a guarantee. A high score lowers the odds of loss; it never removes them.

How to limit the damage

  • Size for total loss. Treat any single protocol deposit as money that could vanish.
  • Spread out. Several smaller positions across unrelated protocols beat one big one.
  • Revoke old approvals. Token approvals you granted months ago can still be used if a contract is compromised. Approval-checker tools let you review and revoke them.
  • Bookmark front-ends. Many losses come from fake sites, not broken contracts.
  • Watch for stacked risk. A deposit into a vault, that uses a liquid staking token, bridged from another chain, carries the risk of every layer. Our DeFi yield guide and staking guide explain how layers add up.

"Code is law" sounds reassuring until you remember that the attacker is also following the law, to the letter.

The honest summary

DeFi has matured. The biggest protocols have survived years of attacks and market crashes, and security practices are far better than in DeFi's early days. But the basic trade-off hasn't changed: you get transparency and open access in exchange for carrying risks a bank would normally carry for you. Go in with eyes open, use the checklist, and never deposit more than the protocol's track record has earned.

Questions people ask

If a protocol is audited, is it safe?

No. An audit is a time-limited review by a specific team of a specific version of the code. Bugs can be missed, code can change after the audit, and many risks, like admin keys or oracle design, sit partly outside the code reviewed.

What happens to my funds if a protocol is hacked?

It depends. Sometimes funds are frozen, negotiated back or reimbursed from a treasury; often they're simply gone. There's usually no insurer of last resort, unless you bought cover separately.

What is DeFi insurance?

Some protocols let you buy cover against specific events, such as a smart-contract exploit. Read exactly what's covered, how claims are decided, and whether the insurer itself can pay out in a large event.

Are bigger protocols always safer?

Generally, protocols that have held large sums for years without incident have been tested hard. But size also makes them targets, and upgrades can introduce new bugs. Treat track record as evidence, not a guarantee.

Sources and further reading

  • Post-mortem reports published by exploited protocols, including bridge and lending exploits from 2016 to 2025.
  • Independent research on DeFi exploits and hack statistics from blockchain analytics firms.
  • Audit reports and bug bounty programmes published by protocols (read the scope and findings, not just the badge).

Written by the soop.wiki team and checked against the sources above on 22 November 2026. Crypto changes fast; if something here is out of date, tell us. How we work: editorial policy.

This article is general education about how things work. It is not financial, investment or tax advice, and it doesn't consider your circumstances. Do your own research and talk to a licensed professional before making decisions with money.

Up next in the JournalSelf-custody done right: backups, multisig and what happens to your crypto if you die