Hybrid Graph-Transformer Vulnerability Detection with Control-Data Flow Fusion and Counterfactual Explanation for Smart Contracts

Penulis

  • Siti Rahmawati Universitas Methodist Indonesia Penulis
  • Budi Santoso Universitas Methodist Indonesia Penulis

Kata Kunci:

Smart Contract Security, Vulnerability Detection, Graph Neural Networks, Graph Transformer, Code Property Graph, Explainable AI, Static Analysis

Abstrak

The rapid expansion of Decentralized Finance (DeFi) and Web3 ecosystems has elevated smart contracts into high-value financial infrastructure, making software vulnerabilities catastrophic and irreversible upon deployment. Existing static analysis tools rely on rigid, manually crafted expert rules that suffer from high false-negative rates against novel attack vectors, while conventional deep learning models treat source code as flat token sequences, overlooking complex execution semantics and inter-procedural state dependencies. This paper introduces VulnGraphFormer, a hybrid neural architecture combining Relational Graph Convolutional Networks (R-GCN) with structure-aware Graph Transformers to detect multi-class vulnerabilities in Solidity smart contracts. VulnGraphFormer constructs a unified Multi-Relation Code Property Graph (MR-CPG) integrating Abstract Syntax Trees (AST), Control Flow Graphs (CFG), and Data Dependency Graphs (DDG), while embedding edge-type biases directly into multi-head self-attention to capture both local control jumps and long-range state variable mutations. Furthermore, an integrated counterfactual subgraph explainer isolates the minimal vulnerable code slice responsible for each prediction. Evaluated on a curated benchmark of 42,850 real-world Ethereum smart contracts spanning six critical vulnerability categories, VulnGraphFormer achieves a macro-F1 score of 91.84%, outperforming state-of-the-art static analyzers by 28.4% and existing Graph Neural Network baselines by 7.6%.These results demonstrate that fusing multi-relational structural inductive biases with global self-attention yields accurate,interpretable, and scalable smart contract auditing.

Referensi

G. Wood, ”Ethereum: A Secure Decentralised Generalised Transaction Ledger,” Ethereum Project Yellow Paper,vol. 151, pp. 1–32, 2014 (rev. 2022).

N. Atzei, M. Bartoletti, and T. Cimoli, ”A Survey of Attacks on Ethereum Smart Contracts (SoK),” in Proc. 6th International Conference on Principles of Security and Trust (POST), Uppsala, Sweden, Apr. 2017, pp. 164–186.

H. Chen, M. Pendleton, L. Njilla, and S. Xu, ”A Survey on Ethereum Systems Security: Vulnerabilities, Attacks,and Defenses,” ACM Computing Surveys, vol. 53, no. 3, pp. 1–43, Jun. 2020.

L. Luu, D.-H. Chu, H. Olickel, P. Saxena, and A. Hobor, ”Making Smart Contracts Smarter,” in Proc. ACM SIGSAC Conference on Computer and Communications Security (CCS), Vienna, Austria, Oct. 2016, pp. 254–269.

J. Feist, G. Grieco, and A. Groce, ”Slither: A Static Analysis Framework for Smart Contracts,” in Proc. IEEE/ACM 2nd International Workshop on Emerging Trends in Software Engineering for Blockchain (WETSEB), Montreal, QC,Canada, May 2019, pp. 8–15.

B. Mueller, ”Smashing Ethereum Smart Contracts for Fun and Real Profit,” in Proc. 9th Annual HITB Security Conference, Amsterdam, Netherlands, Apr. 2018, pp. 1–54.

T. Durieux, J. F. Ferreira, R. Abreu, and P. Cruz, ”Empirical Review of Automated Analysis Tools on 47,587 Ethereum Smart Contracts,” in Proc. ACM/IEEE 42nd International Conference on Software Engineering (ICSE),Seoul, South Korea, Jun. 2020, pp. 530–541.

P. Tsankov, A. Dan, D. Drachsler-Cohen, A. Gervais, F. Bünzli, and M. Vechev, ”Securify: Practical Security Analysis of Smart Contracts,” in Proc. ACM SIGSAC Conference on Computer and Communications Security (CCS),Toronto, ON, Canada, Oct. 2018, pp. 67–82.

W. J. Tann, X. J. Han, S. S. Gupta, and Y.-S. Ong, ”Towards Safer Smart Contracts: A Sequence Learning Approach to Detecting Security Threats,” IEEE Transactions on Dependable and Secure Computing, vol. 18, no. 5, pp. 2110–2124, Sep.–Oct. 2021.

Z. Gao, L. Jiang, X. Xia, D. Lo, and J. Grundy, ”Checking Smart Contracts With Structural Code Embedding,” IEEE Transactions on Software Engineering, vol. 47, no. 12, pp. 2874–2891, Dec. 2021.

Z. Feng et al., ”CodeBERT: A Pre-Trained Model for Programming and Natural Languages,” in Findings of the Association for Computational Linguistics: EMNLP 2020, Nov. 2020, pp. 1536–1547.

Y. Zhuang, Z. Liu, P. Qian, Q. Liu, X. Wang, and Q. He, ”Smart Contract Vulnerability Detection Using Graph Neural Networks,” in Proc. 29th International Joint Conference on Artificial Intelligence (IJCAI), Yokohama, Japan,Jul. 2020, pp. 3283–3290.

Y. Zhou, S. Liu, J. Siow, X. Du, and Y. Liu, ”Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networks,” in Advances in Neural Information Processing Systems (NeurIPS), Vancouver, BC, Canada, Dec. 2019, vol. 32, pp. 10197–10207.

Z. Liu, P. Qian, X. Wang, Y. Zhuang, L. Qiu, and X. Wang, ”Combining Graph Neural Networks with Expert Knowledge for Smart Contract Vulnerability Detection,” IEEE Transactions on Knowledge and Data Engineering, vol.35, no. 2, pp. 1296–1310, Feb. 2023.

U. Alon and E. Yahav, ”On the Bottleneck of Graph Neural Networks and its Practical Implications,” in Proc. International Conference on Learning Representations (ICLR), May 2021, pp. 1–16.

Z. Ying, D. Bourgeois, J. You, M. Zitnik, and J. Leskovec, ”GNNExplainer: Generating Explanations for Graph Neural Networks,” in Advances in Neural Information Processing Systems (NeurIPS), Vancouver, BC, Canada, Dec.2019, vol. 32, pp. 9240–9251.

M. Schlichtkrull, T. N. Kipf, P. Bloem, R. van den Berg, I. Titov, and M. Welling, ”Modeling Relational Data with Graph Convolutional Networks,” in Proc. 15th Extended Semantic Web Conference (ESWC), Heraklion, Greece, Jun.2018, pp. 593–607.

C. Ying et al., ”Do Transformers Really Perform Bad for Graph Representation?,” in Advances in Neural Information Processing Systems (NeurIPS), Dec. 2021, vol. 34, pp. 28877–28888.

T. Ridnik et al., ”Asymmetric Loss For Multi-Label Classification,” in Proc. IEEE/CVF International Conference on Computer Vision (ICCV), Montreal, QC, Canada, Oct. 2021, pp. 82–91.

A. Lucic, M. A. Ter Hoeve, G. Tolomei, M. De Rijke, and F. Silvestri, ”CF-GNNExplainer: Counterfactual Explanations for Graph Neural Networks,” in Proc. 25th International Conference on Artificial Intelligence and Statistics (AISTATS), Mar. 2022, pp. 4499–4511.

Diterbitkan

2026-08-31

Cara Mengutip

Rahmawati, S., & Santoso, B. (2026). Hybrid Graph-Transformer Vulnerability Detection with Control-Data Flow Fusion and Counterfactual Explanation for Smart Contracts. Journal of Technology and Computer, 3(3), 301-309. https://journal.technolabs.co.id/index.php/jotechcom/article/view/111