# StateGuard: Detecting State Derailment Defects in Decentralized Exchange Smart Contract

arXiv: https://arxiv.org/abs/2405.09181 · HTML: https://mlsanity.com/paper/2405.09181/

## Key facts

- Cited by 8 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 15 May 2024.

## Built on by (most cited first, 8 of 8)

- [SCALM: Detecting Bad Practices in Smart Contracts Through LLMs](https://mlsanity.com/paper/2502.04347/) (2025)
- [AI-Based Vulnerability Analysis of NFT Smart Contracts](https://mlsanity.com/paper/2504.16113/) (2025)
- [A Comprehensive Study of Exploitable Patterns in Smart Contracts: From Vulnerability to Defense](https://mlsanity.com/paper/2504.21480/) (2025)
- [Information Security Based on LLM Approaches: A Review](https://mlsanity.com/paper/2507.18215/) (2025)
- [UEChecker: Detecting Unchecked External Call Vulnerabilities in DApps via Graph Analysis](https://mlsanity.com/paper/2508.01343/) (2025)
- [Towards Understanding Deep Learning Model in Image Recognition via Coverage Test](https://mlsanity.com/paper/2505.08814/) (2025)
- [Facial Recognition Leveraging Generative Adversarial Networks](https://mlsanity.com/paper/2505.11884/) (2025)
- [SILS: Strategic Influence on Liquidity Stability and Whale Detection in Concentrated-Liquidity DEXs](https://mlsanity.com/paper/2507.19411/) (2025)

## Abstract (arXiv)

Decentralized Exchanges (DEXs), leveraging blockchain technology and smart contracts, have emerged in decentralized finance. However, the DEX project with multi-contract interaction is accompanied by complex state logic, which makes it challenging to solve state defects. In this paper, we conduct the first systematic study on state derailment defects of DEXs. These defects could lead to incorrect, incomplete, or unauthorized changes to the system state during contract execution, potentially causing security threats. We propose StateGuard, a deep learning-based framework to detect state derailment defects in DEX smart contracts. StateGuard constructs an Abstract Syntax Tree (AST) of the smart contract, extracting key features to generate a graph representation. Then, it leverages a Graph Convolutional Network (GCN) to discover defects. Evaluating StateGuard on 46 DEX projects with 5,671 smart contracts reveals its effectiveness, with a precision of 92.24%. To further verify its practicality, we used StateGuard to audit real-world smart contracts and successfully authenticated multiple novel CVEs.
