Source-linked AI summary

SoK: Decentralized Finance (DeFi) Attacks

Liyi Zhou, Xihan Xiong, Jens Ernstberger, Stefanos Chaliasos, Zhipeng Wang, Ye Wang, Kaihua Qin, Roger Wattenhofer, Dawn Song, Arthur Gervais

arXiv:2208.13035v3cs.CR

TL;DR

DeFi's rapid growth and mounting losses motivate systematic ways to compare incidents and strengthen security. The paper constructs a reference frame from academic papers, audit reports, and real-world incidents, then evaluates defense mechanisms. It finds gaps between research and practice alongside detectable contracts, rescue windows, and attacker links to centralized exchanges.

  • Problem

    DeFi incidents caused substantial losses, creating a need to systematically measure, evaluate, compare, and learn from attacks and accidents.

  • Method

    The paper constructs a reference frame from 77 academic papers, 30 audit reports, and 181 incidents, and investigates bytecode comparison, attack time frames, and source-of-funds tracing.

  • Results

    The data identifies gaps between academia and practitioners and reports defenses including 31 exactly matching vulnerable and 23 exactly matching adversarial contracts.

  • Takeaways & Limitations

    DeFi security remains nascent, with many potential defense mechanisms requiring further research and implementation.

  • Takeaways & Limitations

    The paper's structural equation modeling is limited by its relatively small sample size and should be re-evaluated and cross-validated with additional causal experiments as incidents increase.

Abstract

from arXiv · show

Within just four years, the blockchain-based Decentralized Finance (DeFi) ecosystem has accumulated a peak total value locked (TVL) of more than 253 billion USD. This surge in DeFi's popularity has, unfortunately, been accompanied by many impactful incidents. According to our data, users, liquidity providers, speculators, and protocol operators suffered a total loss of at least 3.24 billion USD from Apr 30, 2018 to Apr 30, 2022. Given the blockchain's transparency and increasing incident frequency, two questions arise: How can we systematically measure, evaluate, and compare DeFi incidents? How can we learn from past attacks to strengthen DeFi security? In this paper, we introduce a common reference frame to systematically evaluate and compare DeFi incidents, including both attacks and accidents. We investigate 77 academic papers, 30 audit reports, and 181 real-world incidents. Our data reveals several gaps between academia and the practitioners' community. For example, few academic papers address "price oracle attacks" and "permissonless interactions", while our data suggests that they are the two most frequent incident types (15% and 10.5% correspondingly). We also investigate potential defenses, and find that: (i) 103 (56%) of the attacks are not executed atomically, granting a rescue time frame for defenders; (ii) SoTA bytecode similarity analysis can at least detect 31 vulnerable/23 adversarial contracts; and (iii) 33 (15.3%) of the adversaries leak potentially identifiable information by interacting with centralized exchanges.

I. INTRODUCTION

DeFi’s rapid growth has produced a broad, multi-layer attack surface and substantial losses, motivating a common reference frame for comparing incidents and defenses. The paper systematizes DeFi architecture, threats, incidents, research, and audits, then evaluates practical detection, rescue, and tracing mechanisms.

  • Reference frame: The reference frame specifies adversarial goals, assumptions, knowledge, capabilities, and common incident causes for comparing DeFi attacks and related research.It is intended to provide a standard model for academic works, audit reports, and real-world incidents.
  • Empirical analysis: 181 incidents, academic papers, and audit reports are organized into a taxonomy that exposes differences between academia, industry practice, and in-the-wild adversaries.The paper specifically identifies unsafe DeFi protocol dependencies as underdeveloped in academia and industry practice relative to observed adversaries.
  • Incident defense: Bytecode similarity analysis identifies 31 exactly matching vulnerable contracts and 23 exactly matching adversarial contracts, while fund tracing links adversaries to exchange wallets and mixers.The reported matches have a bytecode similarity score of 100%; tracing finds direct withdrawals from exchange wallets on Ethereum and BNB Smart Chain.
  • Incident defense: 103 (56%) of attacks are non-atomic, leaving a rescue time frame in which defenders can potentially analyze publicly available adversarial bytecode before harm occurs.The paper discusses symbolic analysis, static analysis, and fuzzing as possible tools during this interval.
  • System model: The five-layer DeFi model spans network, consensus, smart contract, protocol, and auxiliary services, enabling incidents to be categorized across system layers.Auxiliary services include off-chain oracles, cross-chain bridges, centralized exchanges, and transaction-propagation services.

B. Threat Model Taxonomy

The paper defines a common reference frame for DeFi incidents by specifying incident categories, adversarial utilities, knowledge, and capabilities. It distinguishes attacks from accidents and organizes vulnerabilities across system layers.

  • DeFi incidents are actions causing unexpected financial loss to users, liquidity providers, speculators, or operators.
  • Attacks involve adversaries exploiting vulnerabilities to disable, delay, or alter a protocol’s expected state transition.
  • Accidents are incidents without proactive adversaries, such as funds becoming permanently locked through unintentional coding mistakes.
  • The framework models adversaries as rational agents maximizing monetary or non-monetary utility.
  • Adversarial knowledge ranges from public information to sequencer access and privileged insider information.
  • Capabilities can arise from different knowledge levels; sequencers can order transactions, while public-network adversaries can front-run or back-run.

III. DATA

The study constructs a manually labeled dataset spanning academic work, audits, and disclosed incidents, then measures incident characteristics, losses, defenses, and methodological limitations. Its dataset covers 181 incidents on Ethereum and BSC over four years.

  • Dataset construction: The dataset combines research papers, security tools, audit reports, and real-world incidents, with manual labeling of incident types.
  • Dataset construction: 181 incidents comprise 117 Ethereum incidents and 69 BSC incidents collected from Apr 30, 2018 to Apr 30, 2022.
  • Measured features: The analysis records incident causes, adversaries, monetary losses, cumulative abnormal returns, TVL, audit status, and reactive defenses.
  • Measured features: Reactive defense measures include disclosure within 20 days, reimbursement within 20 days, and emergency pauses or circuit breakers.
  • Limitations: Manual crawling can introduce human errors, although incidents are cross-validated and reviewed by at least two authors.
  • Limitations: The incident dataset is incomplete because it focuses on Ethereum and BSC and includes only fully disclosed incidents found through public sources.
  • Limitations: The incident sources do not document their collection processes, so the dataset may inherit their sampling bias.

A. Incident Frequency

DeFi incident frequency and losses rise over the study period, with the highest monthly loss occurring in August 2021. Incident frequency increased across all incident groups, while vulnerabilities clustered in three system layers.

  • Nearly 600 million dollars were lost in August 2021, the peak monthly loss in the dataset.
  • 69 BSC incidents were recorded, including 29 exploiting protocol-layer design flaws.
  • A 15-day sequence of recurring exploits on forked protocols suggests attackers lacked automated tools to scan and reproduce similar incidents.
  • Incident frequency rose from 3.1 per month in 2020 to 8.5 per month in the first four months of 2022, a 2.74× increase.
  • The most common incident causes were SC Layer vulnerabilities at 42%, PRO Layer vulnerabilities at 40%, and AUX Layer vulnerabilities at 30%.

B. DeFi Protocol Types

Incident losses vary substantially by DeFi application type: yield farming and cross-chain bridges account for the largest loss share despite lower TVL than DEX protocols. Vulnerability distributions also differ across protocol categories.

  • Yield farming protocols and cross-chain bridges incurred 44% of total monetary loss despite representing 30.2% of TVL.
  • Figure 4 groups incidents by cause, with each circle representing one incident and circle size proportional to estimated monetary loss.
  • DEX protocols held 27.7 billion USD in TVL, or 40.6%, but incurred 450 million USD in losses, or 12%.
  • Protocol vulnerability distributions differ by application type, with PRO-layer vulnerabilities affecting 86% of stablecoin incidents and 59% of lending incidents.

C. Structural Equation Modeling

The paper applies Structural Equation Modeling to measure relationships among latent DeFi incident variables, including harm, asset exposure, preventive defense, and reactive defense. The fitted model finds that harm increases with asset exposure and decreases with reactive defense, while evidence for preventive defense reducing harm is weak.

  • Method: Structural Equation Modeling measures causal relationships among latent variables that cannot be directly observed.The paper combines confirmatory factor analysis with latent structural regression.
  • Model specification: The model contains four latent variables: harm, asset exposure, preventive defense, and reactive defense.Harm is endogenous, while the other three variables are exogenous; observed variables measure each latent variable.
  • Findings: Harm increases with asset exposure and decreases as reactive defense increases.These findings conform to the paper’s stated interpretation of the fitted structural relationships.
  • Findings: The model finds no strong evidence that preventive defense reduces harm, with p-value 0.21.This result is reported as a model finding rather than a general claim that preventive defense is ineffective.
  • Limitations: The primary limitation is the relatively small sample size, requiring future re-evaluation and cross-validation with additional causal experiments.The authors identify this as the main limitation of the analysis.

D. Emergency Pause

The paper examines emergency pauses as a potential defense against DeFi incidents and evaluates both their availability and activation speed. Although 87 of 183 victims support emergency pauses, activation is generally slow, limiting their effectiveness.

  • Availability: 87 of 183 victims support an emergency pause mechanism, representing 47.5% of victims.The mechanism is compared with circuit breakers in conventional centralized exchanges.
  • Effectiveness: The paper suggests that DeFi protocols may lack just-in-time intrusion detection for abnormal states or malicious transactions.This limitation reduces the practical effectiveness of emergency pauses as a defense.
  • Audit analysis: Security-audit effectiveness is estimated using additional crawling, protocol matching, and merged audit datasets.The analysis maps DeFiLlama protocols to incidents and combines DeFiLlama and DeFiYield audit databases.
  • Audit results: 23 of 563 audited protocols 4.09% and 33 of 213 non-audited protocols 15.49% were attacked at least once.The authors state that the data indicate audits may decrease average exploit probability by a factor of four, but characterize the estimate as rough because only 56 incidents were matched.

B. Bytecode Similarity Analysis

The paper uses deployed-bytecode similarity analysis to identify clusters of vulnerable and adversarial DeFi contracts. The analysis reveals exact and high-similarity matches that could support detection, while compiler, optimization, and obfuscation differences limit coverage.

  • Detection: 31 vulnerable and 23 adversarial contracts are identified as exactly matching previously known contracts.The paper reports these as detectable through bytecode similarity, including pairwise similarity scores of 100% for exact-match clusters.
  • Method: The method compares deployed bytecode rather than source code because developers can keep smart-contract source code closed.It removes Swarm code and PUSH arguments, disassembles bytecode, and computes opcode n-gram hypervectors with n = 5.
  • Clustering results: At an 80% similarity threshold, 173 vulnerable and 155 adversarial contracts form 26 and 23 clusters, respectively.The clustering is applied to contracts in the incident dataset.
  • Adversarial patterns: Similar adversarial contracts can target distinct DeFi protocols with similar vulnerabilities, including oracle manipulation.The paper suggests historical blockchain data could reveal additional adversarial contracts.
  • Limitations: The method cannot cluster similar contracts using different compilers or optimization choices.Bytecode obfuscation, such as injecting unused function code, also makes the method less effective.

D. Money Tracing

The paper proposes tracing pre-incident fund flows from adversarial addresses to identify funding sources and possible links to exchanges, mixers, bridges, and other incidents. Results show both measurable source-of-funds patterns and important limits on attribution.

  • Method: The money-tracing methodology iteratively follows pre-incident transfers from an adversarial address to identify the initial funding source.The paper applies this approach to an account-based ledger and describes it as novel relative to prior literature.
  • Funding sources: 73 of 261 adversaries 28.0% source funds directly from a mixer, accounting for 92 incidents 50.8%.Direct mixer sourcing is defined using one-hop transfers and relayer-based withdrawal behavior.
  • Centralized exchanges: 12 Ethereum adversaries 7.3% and 21 BSC adversaries 8.0% directly withdraw funds from exchange wallets.Exchange KYC may reveal identities for direct withdrawals, whereas indirect withdrawals establish linkage without proving that the withdrawer is the attacker.
  • Other links: Four attackers directly withdraw their source of funds from a blockchain bridge, and 13 adversaries can be linked to another incident within three hops.The dataset inherits possible completeness issues because exchange and bridge addresses are identified using Ether- and Bscscan.
  • Broader implications: The paper identifies limited coverage for network and consensus incidents, with 2% and 0% of in-the-wild incidents assigned to those layers.It also reports that available tools cover only 52% of PRO-layer incident types on average and that oracle-manipulation detection remains limited.

VII. RELATED WORKS

The paper situates DeFi security within prior cyber-risk and DeFi-security research, then introduces a five-layer model and taxonomy for measuring and comparing incidents. It also identifies differences between academic and practitioner approaches and examines defense mechanisms.

  • The paper proposes a five-layer system model and comprehensive threat-model taxonomy to measure and compare DeFi incidents.
  • The reference frame categorizes 77 academic papers, 30 audit reports, and 181 incidents to compare academic and practitioner approaches.
  • The authors investigate defenses based on bytecode comparison, attack-time-frame quantification, and tracing attackers’ funding sources.

APPENDIX A LINKED ADVERSARIES

The paper identifies linked adversary clusters through source-of-funds tracing and describes the CAR procedure used to measure token-price changes around anomalies.

  • Six adversary clusters were identified, with adversaries in five clusters linked through three hops.
  • CAR estimation fits a β coefficient using ordinary least squares over a pre-event window.The model uses token price, market price, and risk-free rate variables.
  • Abnormal returns are calculated for each tick during the event timeframe using the fitted β coefficient and expected token return.
  • The minimal CAR is reported to capture the token-price change pattern during an anomaly.
  • Token prices come from on-chain smart contracts, while average Bitcoin and Ethereum prices proxy the market price.The risk-free rate is assumed to be zero because high-frequency yield data is unavailable.
Loading 2208.13035v3…