SmartAxe: Detecting Cross-Chain Vulnerabilities in Bridge Smart Contracts via Fine-Grained Static Analysis

Zeqin Liao, Yuhong Nan, Henglong Liang, Sicheng Hao, Juan Zhai, Jiajing Wu, Zibin Zheng

Abstract

With the increasing popularity of blockchain, diverse platforms such as Ethereum, BNB, and EOSIO coexist, driving high demand for cross-chain communication. Cross-chain bridges serve as critical infrastructure for asset exchange across these platforms. However, securing bridge smart contracts is an urgent challenge; recent security incidents involving Cross-Chain Vulnerabilities (CCVs) have resulted in massive financial losses. Automatically identifying CCVs is difficult due to the need to identify application-specific access control constraints and inconsistent cross-chain semantics. This paper introduces SmartAxe, a framework designed to identify CCVs through fine-grained static analysis. SmartAxe models heterogeneous access control implementations via probabilistic pattern inference and constructs cross-chain control-flow (xCFG) and data-flow (xDFG) graphs to detect semantic inconsistencies. Evaluated on a dataset of 88 known CCVs, SmartAxe achieved a precision of 84.95% and a recall of 89.77%. Furthermore, it identified 232 previously unknown CCVs in real-world applications, affecting assets worth approximately $1.88 million.

Introduction

As the blockchain ecosystem fragments into multiple specialized platforms, cross-chain bridges have become the glue holding the decentralized economy together. These bridges allow users to lock assets on one chain and receive equivalent tokens on another. However, their complexity and high liquidity make them prime targets for attackers. A single vulnerability in a bridge, such as the infamous PolyNetwork exploit, can lead to losses exceeding $600 million.

Traditional smart contract security tools are often ill-equipped for this task. They typically focus on single-contract vulnerabilities (like reentrancy or integer overflows) and fail to account for the unique logic required to synchronize states across two different blockchain environments. SmartAxe addresses this gap by focusing specifically on the unique semantics of cross-chain communication.

The Challenges of Cross-Chain Security

The authors identify two primary hurdles that prevent standard security tools from protecting bridges effectively:

  1. Heterogeneous Access Control: Unlike standard ERC-20 tokens that follow predictable patterns, bridges utilize highly diverse security checks. These might include comparing liquidity thresholds, verifying multi-signature approvals, or checking balances before and after a transaction. Existing tools cannot easily recognize these non-standard patterns.
  2. Cross-Bridge Semantic Inconsistency: Vulnerabilities often arise from a "lost in translation" effect. A bridge might correctly execute a lock function on the source chain but fail to parse the resulting event correctly on the destination chain, leading to an imbalance in asset valuation or unauthorized minting. Analyzing one side of the bridge in isolation misses these multi-chain logic errors.

The SmartAxe Framework

SmartAxe introduces a multi-stage pipeline to perform fine-grained static analysis directly on contract bytecode, allowing it to analyze contracts even when source code is unavailable.

Canonical Security Modeling

To handle the variety of bridge implementations, SmartAxe normalizes diverse security checks into a canonical form. It categorizes bridge operations into three primary workflows: asset deposit, cross-chain routing, and asset withdrawal. By standardizing how these workflows are represented, the tool can apply consistent analysis across different bridge architectures.

Probabilistic Pattern Inference

Linking a specific resource (such as a withdrawal function) to its required security check is a complex task. SmartAxe utilizes a probabilistic model to associate resources with checks based on control-flow and data-flow dependencies. This allows the framework to infer what a "correct" security check should look like for a specific function and flag instances where those checks are missing or incomplete.

Cross-Chain Graphs (xCFG & xDFG)

The core innovation of SmartAxe is the construction of cross-chain control-flow graphs (xCFG) and data-flow graphs (xDFG). These graphs align the execution logic of both sides of the bridge. By linking "event emission" on the source chain to "event parsing" on the destination chain, SmartAxe creates a unified view of the data's journey across the bridge, enabling the detection of semantic inconsistencies.

Taint Analysis

Finally, SmartAxe employs taint propagation to determine if an external attacker can reach these vulnerable functions. If a user-controlled input can manipulate state variables or bypass the inferred security checks, the tool flags a potential CCV.

Experimental Evaluation

The researchers evaluated SmartAxe using two distinct datasets:

  • $D_{manual}$: A ground-truth dataset of 88 known CCVs collected from 16 real-world bridge applications.
  • $D_{large}$: A large-scale dataset containing 1,703 smart contracts from 129 real-world bridge applications, covering over 87% of mainstream bridges listed on major aggregation sites.

Key Results

SmartAxe demonstrated significant improvements over state-of-the-art (SOTA) tools. While tools like Ethainter and AChecker showed recall rates as low as 3-6% on bridge-specific logic, SmartAxe achieved a precision of 84.95% and a recall of 89.77%.

In the large-scale study, SmartAxe identified 232 new vulnerabilities across 126 contracts. These vulnerabilities were not merely theoretical; they affected digital assets totaling $1,885,250 USD, demonstrating the framework's practical utility in securing the blockchain ecosystem.

Discussion and Limitations

While SmartAxe represents a significant step forward, it has limitations. Currently, the analyzer is optimized for the Ethereum Virtual Machine (EVM). While many bridges are EVM-compatible, extending support to non-EVM chains like Solana or Cosmos is a necessary future direction. Additionally, as a static analysis tool, SmartAxe cannot account for vulnerabilities that depend on real-time on-chain state (e.g., dynamic blacklists).

Conclusion

SmartAxe proves that the "semantic gap" between chains is the root cause of many bridge exploits. By using probabilistic inference and cross-chain graph construction, SmartAxe can identify complex logic errors that traditional tools miss. The release of the $D_{manual}$ and $D_{large}$ datasets provides a valuable resource for the community to continue improving the security of cross-chain infrastructure.

Summary updated

Abstract

With the increasing popularity of blockchain, different blockchain platforms coexist in the ecosystem (e.g., Ethereum, BNB, EOSIO, etc.), which prompts the high demand for cross-chain communication. Cross-chain bridge is a specific type of decentralized application for asset exchange across different blockchain platforms. Securing the smart contracts of cross-chain bridges is in urgent need, as there are a number of recent security incidents with heavy financial losses caused by vulnerabilities in bridge smart contracts, as we call them Cross-Chain Vulnerabilities (CCVs). However, automatically identifying CCVs in smart contracts poses several unique challenges. Particularly, it is non-trivial to (1) identify application-specific access control constraints needed for cross-bridge asset exchange, and (2) identify inconsistent cross-chain semantics between the two sides of the bridge. In this paper, we propose SmartAxe, a new framework to identify vulnerabilities in cross-chain bridge smart contracts. Particularly, to locate vulnerable functions that have access control incompleteness, SmartAxe models the heterogeneous implementations of access control and finds necessary security checks in smart contracts through probabilistic pattern inference. Besides, SmartAxe constructs cross-chain control-flow graph (xCFG) and data-flow graph (xDFG), which help to find semantic inconsistency during cross-chain data communication. To evaluate SmartAxe, we collect and label a dataset of 88 CCVs from real-attacks cross-chain bridge contracts. Evaluation results show that SmartAxe achieves a precision of 84.95% and a recall of 89.77%. In addition, SmartAxe successfully identifies 232 new/unknown CCVs from 129 real-world cross-chain bridge applications (i.e., from 1,703 smart contracts). These identified CCVs affect a total amount of digital assets worth 1,885,250 USD.
BibTeX
@article{liao2024smartaxe,
  author = {Zeqin Liao and Yuhong Nan and Henglong Liang and Sicheng Hao and Juan Zhai and Jiajing Wu and Zibin Zheng},
  title = {{SmartAxe: Detecting Cross-Chain Vulnerabilities in Bridge Smart Contracts via Fine-Grained Static Analysis}},
  journal = {Proc. ACM Softw. Eng.},
  year = {2024},
  doi = {10.1145/3643738},
}
Figure