ContractScanner: Detecting and Localizing Vulnerabilities of Smart Contracts via Graph-Based Semantic Modeling of Source Code

Smart contract vulnerabilities pose persistent threats to decentralized applications, causing substantial financial losses across the Web 3.0 ecosystem. Although recent deep learning-based detectors improve scalability, they face two key limitations: (i) limited semantic fidelity because bytecode- or sequence-level representations fail to capture contextual dependencies; and (ii) inadequate vulnerability localization, as most approaches are confined to contract-level classification, limiting their audit utility. To address these challenges, we present ContractScanner for joint vulnerability detection and fine-grained localization directly from the source code. First, we propose an anchor-aware semantic slicing method to filter contracts into vulnerability-relevant regions by matching structural anchor patterns and preserving contextual dependencies. Second, we transform these slices into heterogeneous program graphs that encode control, data, and syntactic flows.We then apply a dual-stage reasoning pipeline. A Graph Isomorphism Network (GIN) extracts global structural features for contract-level classification, while a Graph Autoencoder (GAE) reconstructs fine-grained topological patterns to localize vulnerability-critical code regions. Third, to address data scarcity, we introduce anchor-guided G-Mixup, which generates augmented training samples by interpolating feature embeddings of contract slices with similar vulnerability semantics. We evaluate ContractScanner on two real-world benchmarks spanning five major vulnerability types—reentrancy, integer overflow/underflow, timestamp dependency, and callstack depth exhaustion. Our method achieves an average F1-score of 94.74%, significantly outperforming symbolic analyzers, classical learning models, and prior graph-based methods.

Authors

Institutions

Publication Details

Journal
IEEE Transactions on Network Science and Engineering
Published
2025-06-27
DOI
https://doi.org/10.1109/tnse.2025.3583926
Primary Topic
Blockchain Technology Applications and Security
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

ContractScanner: Detecting and Localizing Vulnerabilities of Smart Contracts via Graph-Based Semantic Modeling of Source Code

Xiaohan Yuan, Xueshuo Xie, Shan Li, Bin Wang et al.
IEEE Transactions on Network Science and Engineering
Blockchain Technology Applications and Security
article

ContractScanner: Detecting and Localizing Vulnerabilities of Smart Contracts via Graph-Based Semantic Modeling of Source Code

Xiaohan Yuan, Xueshuo Xie, Shan Li, Bin Wang, Wei Wang, Tao Li, Junyong Wang, Bin Wang
article en

Abstract

Smart contract vulnerabilities pose persistent threats to decentralized applications, causing substantial financial losses across the Web 3.0 ecosystem. Although recent deep learning-based detectors improve scalability, they face two key limitations: (i) limited semantic fidelity because bytecode- or sequence-level representations fail to capture contextual dependencies; and (ii) inadequate vulnerability localization, as most approaches are confined to contract-level classification, limiting their audit utility. To address these challenges, we present ContractScanner for joint vulnerability detection and fine-grained localization directly from the source code. First, we propose an anchor-aware semantic slicing method to filter contracts into vulnerability-relevant regions by matching structural anchor patterns and preserving contextual dependencies. Second, we transform these slices into heterogeneous program graphs that encode control, data, and syntactic flows.We then apply a dual-stage reasoning pipeline. A Graph Isomorphism Network (GIN) extracts global structural features for contract-level classification, while a Graph Autoencoder (GAE) reconstructs fine-grained topological patterns to localize vulnerability-critical code regions. Third, to address data scarcity, we introduce anchor-guided G-Mixup, which generates augmented training samples by interpolating feature embeddings of contract slices with similar vulnerability semantics. We evaluate ContractScanner on two real-world benchmarks spanning five major vulnerability types—reentrancy, integer overflow/underflow, timestamp dependency, and callstack depth exhaustion. Our method achieves an average F1-score of 94.74%, significantly outperforming symbolic analyzers, classical learning models, and prior graph-based methods.

IEEE Transactions on Network Science and EngineeringVol. 13
Beijing Jiaotong University (CN), Zhejiang Lab (CN), Tianjin haihe hospital (CN)
Openalex Percentile: Top 78%
Blockchain Technology Applications and Security
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.