Onchain vs Offchain Attacks: Where Hack Losses Came From
Quick answer. Most crypto hack losses come from offchain attacks, not contract bugs. Per Guardian's analysis of DefiLlama data, keys, signers, infrastructure and people caused 72% to 74% of losses in 2024 and 2025, and 82% in 2026 so far.
Video transcript
Most crypto hack losses do not come from smart contract bugs. They come from compromised keys, signers, infrastructure and people.
In Guardian's analysis of DefiLlama data, offchain attacks caused 72 to 74 percent of reported losses in 2024 and 2025, and 82 percent in 2026 so far.
Code bugs cause most incidents, but most are small. TRM Labs finds code exploits were 49 percent of classified incidents since 2022, and only 15 percent of value.
One event dominates 2026: about 6.36 billion dollars left Binance wallets. Without it, offchain is still 63 percent of 2026 losses when incidents are filed by root cause.
For DeFi protocols alone, the split is closer. In 2025, bugs at Cetus and Balancer made contract code the bigger loss. Either side can produce the year's largest loss.
The biggest offchain losses came through signers producing valid signatures, as at Bybit and WazirX. People are the entry point, through compromised devices. Front end and DNS attacks are frequent but small.
North Korea, the largest attacker, prefers keys to code. Centralized targets hold more value in one place. And offchain systems rarely get the scrutiny contracts do.
So list every key that can move funds. Check what signers see before they sign. Trace cloud paths to signing keys. And fuzz accounting invariants in your contracts.
Guardian tests both sides, including an offchain pentest practice led by Carlos Polop, creator of HackTricks. Read the full analysis, or talk to Guardian at guardian.security.
Onchain vs offchain attacks is the question that decides where a security budget goes. If losses come from contract logic, audits and fuzzing are the answer.
If they come from keys, signers, cloud accounts and front ends, an audit alone misses most of the risk.
We split three years of reported hack losses into the two buckets, using DefiLlama's public hacks dataset. We compare it with annual reports from CertiK, Chainalysis, Immunefi and TRM Labs.
Every onchain and offchain share and DefiLlama total here is Guardian's own computation, which anyone can rebuild from DefiLlama's public API. Figures attributed to other firms are their own.
This is the companion to our report on how fast crypto hacks are detected.
How We Classify Attacks
We use a root-cause test: did the attacker need a flaw in deployed code, or did they get control of something around it?
- Onchain: a flaw in contract or protocol code or its economic design, such as logic, accounting, oracles or bridge verification.
- Offchain: control of keys, signers or systems the code trusts, such as hot wallets, devices, cloud, front ends and DNS.
- Other: rug pulls, insiders and exchange trading incidents, which we keep out of both buckets.
We mapped each DefiLlama classification to a bucket. Key Compromise, Social Engineering and Frontend & Infrastructure count as offchain; the code classifications count as onchain.
Labels describe the mechanism, and the mechanism is not always the root cause. DefiLlama files Drift (April 2026) under Access Control and Kelp DAO (April 2026) under Bridge & Cross-Chain.
Yet its own descriptions say Drift's Security Council members were tricked into pre-signing an admin transfer. Kelp's bridge accepted messages after LayerZero RPC nodes were compromised through social engineering.
So we report two versions: the labels as published, and an adjusted view that moves eight incidents whose DefiLlama description names a key, signer, infrastructure or insider cause.
Data and limits
- Data. DefiLlama's hacks dataset, pulled November 4, 2026 (latest entry November 2), summed by calendar year in UTC.
- Adjusted view. Eight incidents of $5M or more: Gala, UPCX, Drift, Kelp DAO, SUPERFORTUNE AI, Mercado Bitcoin and THORChain to offchain, Munchables to other.
- Limits. One incident can swing a year: Binance is 72% of 2026's total.
- Amounts are reported losses before recoveries and freezes. Root causes are often unconfirmed when an incident is labeled.
- Not included: Hacken's annual report, which blocked automated reading.
The Loss Split by Year
| Year | Reported losses | Offchain share (labels) | Offchain share (adjusted) | Onchain share of incidents |
|---|---|---|---|---|
| 2024 | $1.67B across 217 incidents | 73.5% | 74.8% | 72% (157) |
| 2025 | $2.72B across 148 incidents | 72.1% | 74.7% | 69% (102) |
| 2026 to Nov 2 | $8.78B across 328 incidents | 82.4% | 89.8% | 81% (266) |
| 2026 without Binance | $2.42B across 327 incidents | 36.0% | 63.1% | 81% (266) |
Code exploits are the majority of incidents in every year, and offchain compromises are the majority of dollars.
TRM Labs reports a similar pattern since 2022: code exploits were 49% of incidents with a classified attack type, but only 15% of value.
The three largest losses of 2024, DMM Bitcoin ($305M), PlayDapp ($290M) and WazirX ($234.9M), were all offchain compromises. In 2025, Bybit alone accounted for $1.4B of DefiLlama's $2.72B.
2026 is dominated by one event. On October 29, about $6.36B left Binance wallets across ten blockchains, according to TRM Labs.
TRM assesses that Binance's hot wallet signing infrastructure was compromised, and notes that Binance had not yet published a root cause.
Remove Binance and the 2026 label-based split flips toward onchain, largely because Drift and Kelp DAO, together $588M in DefiLlama, carry onchain labels.
File them and three smaller incidents by root cause, and offchain is still 63% of 2026 losses without Binance.
DeFi protocols only: a closer split
Centralized exchanges took 44% of DefiLlama's reported losses in 2024, 70% in 2025 and 78% in 2026. Almost all of those losses carry offchain labels.
Without exchanges, 2025 was a contract-code year: 78.8% of losses carry onchain labels. Cetus on Sui ($223M) and Balancer V2 ($128M) made up much of it.
2026 for DeFi turns on Drift and Kelp DAO. Under the published labels it is 76.1% onchain; in the adjusted view, 54.5% is offchain.
For protocols, contract bugs and offchain compromises are both material, and either can produce the year's largest loss.
Why the Reports Disagree
The reports count different things. CertiK's 760 incidents in 2024 include 296 phishing incidents, and its count is more than three times DefiLlama's.
Chainalysis's 2025 total also counts personal wallet compromises. Immunefi counts hacks and fraud, and DefiLlama lists the protocol and exchange incidents it can document.
They also label the same incident differently. DefiLlama files Bybit under Social Engineering.
CertiK puts $1.45B of 2025 losses under supply chain across two incidents it does not name. A total that size only works with Bybit inside it.
The Drift and Kelp DAO choice alone moves close to $600M between onchain and offchain. Each choice is defensible.
Guardian's own tally of 2026's ten largest losses, published at the Vanguard launch in August 2026, found $729M of the $769M came from offchain gaps.
Recomputed on DefiLlama's data through November 2, the ten largest 2026 incidents total $8.08B. In our adjusted view, seven of them and 94% of the value are offchain.
Keys, Signers and Code
The largest offchain losses came through signing systems and signers that produced valid signatures, as at Binance, Bybit, WazirX and Radiant.
In DefiLlama's technique labels for 2024 to 2026, keys leaked via infrastructure cost $6.48B in 13 incidents, and signer phishing $1.64B in 3.
People are the entry point. Step Finance's loss followed compromised executive devices, according to DefiLlama's description.
TRM describes North Korean operators posing as recruiters or investors who get a target to download a coding test.
Front end, DNS and social account attacks are frequent but small: $25M across 15 incidents. Our guide to signing interface security covers the Bybit pattern.
Onchain, accounting and arithmetic flaws are the costliest class: Cetus, Balancer, Truebit ($26.4M from an integer overflow) and Tectonic ($124.5M from a donation attack).
Why the offchain share keeps rising
First, the largest attacker prefers keys to code. TRM attributes about $7.4B of 2026's $8.7B in hack value to North Korea.
It says only 13 of the 100 incidents it attributes to North Korea were code exploits, worth about 1% of their value.
Second, centralized targets hold more value in one place. Exchange losses rose from 44% to 78% of DefiLlama's annual total between 2024 and 2026.
Third, scrutiny. As our 2025 post on the Web2 layer of DeFi risk argued, offchain systems are rarely audited with the same scrutiny as contracts.
Our offchain pentest findings report shows what that side looks like: web apps, APIs, keepers and cloud.
What to Test
Offchain
- List every key that can move funds or change contracts. Flag any single key with no timelock.
- Check what signers see: decode and simulate every admin transaction on a device the signer controls.
- Prohibit pre-signed or durable-nonce transactions for admin actions.
- Trace cloud paths to signing keys: IAM roles, KMS policies and who can call them.
- Review CI/CD runners and secrets, and the laptops of staff with production access.
- Check verifier and RPC setups for single points of failure, such as a 1-of-1 bridge verifier.
- Lock registrar and DNS accounts, and detect when the served bundle changes.
- For exchanges and custodians, reconcile balances and block withdrawals automatically on a mismatch.
Onchain
- Write accounting, rounding and solvency invariants, and fuzz them.
- Test every privileged function and callback for missing access control and input validation.
- Test new and empty markets for donation and first-depositor attacks before they take deposits.
- Re-review every upgrade: see smart contract upgrade bugs.
How Guardian Covers Both Sides
Guardian's audits and pentests cover the contracts and the systems around them. That includes infrastructure, web app, API, browser extension and offchain automation pentests and SDK audits.
The offchain department is led by Carlos Polop, creator of HackTricks and the PEASS privilege escalation suite. Vanguard returns half the package cost as credits toward offchain assessments.
After launch, Managed Security maps every path to a protocol's funds and reviews multisig transactions before they are signed. For the monitoring side, read what Web3 MDR is.
Frequently Asked Questions
Are most crypto losses caused by smart contract bugs or offchain attacks?
By value, offchain attacks. In Guardian's analysis of DefiLlama data, keys, signers, infrastructure and people caused 72% to 74% of reported losses in 2024 and 2025 and 82% in 2026 so far.
What is the difference between an onchain and an offchain attack?
An onchain attack exploits a flaw in deployed code or its economic design. An offchain attack compromises what sits around the code, such as keys, signers, cloud, front ends and people, while the contracts usually behave as written.
Is the offchain share the same for DeFi protocols?
No: exchanges were 44% to 78% of DefiLlama's yearly losses, nearly all offchain. Without them, contract exploits were the larger share of DeFi losses in 2025, and 2026 turns on how Drift and Kelp DAO are filed.
Does a smart contract audit cover offchain attacks?
No: an audit reviews the code at a given commit, not who holds the keys or how signers verify transactions. Those need offchain pentests, operational security review and monitoring.
Sources
- DefiLlama: Hacks dataset API (pulled November 4, 2026)
- Chainalysis: North Korea Drives Record $2 Billion Crypto Theft Year (December 18, 2025)
- CertiK: Hack3d, The Web3 Security Report 2024 (January 2, 2025)
- CertiK: Hack3d, The Web3 Security Report 2025 (December 23, 2025)
- Immunefi: Crypto Losses 2024 Report (January 1, 2025)
- TRM Labs: North Korea Has Stolen USD 12.8 Billion in Crypto, USD 7.4 Billion of It in 2026 (October 30, 2026)
- TRM Labs: North Korea Steals USD 6.36 Billion From Binance in the Largest Hack in History (October 29, 2026)
- Aave governance forum: rsETH Incident Report (April 20, 2026)
- Rekt: Drift Protocol, Rekt (April 2026)
- Rekt: KelpDAO, Rekt (April 2026)
- Guardian: Guardian Announces Vanguard (August 2026)
- Guardian: Top 10 Smart Contract Auditors and Digital Asset Security Firms in 2026
Test the side of your stack attackers use most
Guardian audits your contracts and pentests the keys, signers, cloud, keepers and web apps around them, so both halves of this split are covered.