计算机科学 ›› 2026, Vol. 53 ›› Issue (10): 464-475.doi: 10.11896/jsjkx.250800080

• 信息安全 • 上一篇    下一篇

融合时序特征图神经网络的智能合约漏洞检测方法

陈虹1, 王明君1, 金海波1, 武聪2, 芦奇1   

  1. 1 辽宁工程技术大学软件学院 辽宁 葫芦岛 125105
    2 辽宁工程技术大学创新实践学院 辽宁 阜新 123000
  • 收稿日期:2025-08-18 修回日期:2025-11-29 发布日期:2026-10-13
  • 通讯作者: 王明君(15241970548@163.com)
  • 作者简介:(chh3188@163.com)
  • 基金资助:
    国家自然科学基金(62173171);辽宁省教育厅科研项目(LJKFZ20220198);广东省普通高校重点领域专项项目(2021ZDZX1027)

Smart Contract Vulnerability Detection Method Based on Temporal Feature Graph NeuralNetwork

CHEN Hong1, WANG Mingjun1, JIN Haibo1, WU Cong2, LU Qi1   

  1. 1 School of Software,Liaoning Technical University,Huludao,Liaoning 125105, China
    2 School of Innovation Practice,Liaoning Technical University,Fuxin,Liaoning 123000, China
  • Received:2025-08-18 Revised:2025-11-29 Online:2026-10-13
  • About author:CHEN Hong,born in 1967,postgra-duate,associate professor,master’s supervisor,is a member of CCF(No.46268M).Her main research interests include information security and network security.
    WANG Mingjun,born in 2001,postgraduate.Her main research interest is network and information security.
  • Supported by:
    National Natural Science Foundation of China(62173171),Scientific Research Project of Liaoning Provincial Department of Education(LJKFZ20220198) and Scientific Research Project of Colleges and Universities in Guangdong Province(2021ZDZX1027).

摘要: 针对智能合约安全漏洞检测中静态分析高误报与动态分析低效率导致准确率低的问题,提出一种融合时序特征图神经网络(Fusion of Temporal-Feature Graph Neural Network,FTF-GNN)的智能合约漏洞检测方法。首先,通过静态分析提取专家模式特征Pr与图特征Gr,Pr降低盲目检测导致的误报,Gr避免全图遍历瓶颈;其次,基于风险概率阈值λ筛选高危函数,提升整体分析效率;再次,构建时序图神经网络,通过自注意力机制强化复杂漏洞捕捉能力;最后,聚焦于可重入漏洞和时间戳依赖漏洞检测。在以太坊和VNT链双平台真实合约数据集上进行评估,实验表明,该模型对可重入漏洞检测准确率达93.12%、F1值达94.41%,比现有对比方法最优者提升0.31个百分点和2.73个百分点,对检测时间戳依赖漏洞准确率达91.71%、F1值达92.47%,比现有对比方法最优者提升0.07个百分点和1.10个百分点。

关键词: 区块链, 智能合约, 漏洞检测, 时序特征, 图神经网络

Abstract: Aiming at the problem of low accuracy caused by high false positives in static analysis and low efficiency in dynamic analysis in smart contract security vulnerability detection,a smart contract vulnerability detection method based on fusion of temporal-feature graph neural network(FTF-GNN) is proposed.Firstly,pattern-based features Pr and graph-based features Gr are extracted through static analysis,which pattern-based features Pr reduce false positives caused by blind detection and graph-based features Gr avoid the bottleneck of whole graph traversal.Secondly,the high-risk functions are screened based on the risk probability threshold λ to improve the overall analysis efficiency.Thirdly,a temporal graph neural network is constructed to enhance the ability to capture complex vulnerabilities through the self-attention mechanism.Finally,it focuses on reentrant vulnerability and timestamp dependency vulnerability detection.Experiments on the real contract datasets of Ethereum and VNT chain show that the accuracy of the proposed model for reentry vulnerability detection reaches 93.12% and the F1 value reaches 94.41%,which are 0.31 percentage points and 2.73 percentage points higher than the best of the existing comparison methods.The ac-curacy of detecting timestamp dependence vulnerability reaches 91.71% and the F1 value reaches 92.47%.Compared with the existing comparison methods,the best ones increase by 0.07 percentage points and 1.10 percentage points.

Key words: Blockchain, Smart contract, Vulnerability detection, Temporal feature, Graph neural network

中图分类号: 

  • TP393
[1] SZABO N.Formalizing andsecuring relation-ships on public networks [J].First Monday,1997,2:9.
[2] CHEN J F,WANG Z X,CAI S H,et al.Vulnerability detection method for blockchain smart contracts based on metamorphic testing[J].Journal on Communications,2023,44(10):164-176.
[3] WANG Z X,WEN B.Smart Contract Vulnerability Detection of Symbol Execution with Critical Path Pre-Searching [J].Journal of Applied Sciences,2024,42(2):364-374.
[4] MUELLER B.Mythril-reversing and bug hunting frameworkfor the ethereum blockchain[EB/OL].[2022-01-16].https://pypi.org/project/mythril/0.8.2,2017.
[5] BAI Y M,SHI Z B,XIN W G,et al.Research on Smart Contract Vulnerability Detection Method Based on Word Embedding and Shapelet Time Series Features [J].Journal of North University of China(Natural Science Edition),2023,44(4):381-387.
[6] MA F,XU Z,REN M,et al.Pluto:Exposing vulnerabilities in intercontract scenarios [J].IEEE Transactions on Software Engineering,2021,48(11):4380-4396.
[7] LIU Z,QIAN P,YANG J,et al.Rethinking smart contractfuzzing:Fuzzing with invocation ordering and important branch revisiting [J].IEEE Transactions on Information Forensics and Security,2023,18:1237-1251.
[8] CHEN K X,LIU J Y,JIA P.An Score Oriented Fuzzing Method for Smart Contracts [J].Modern Computer,2022,28(8):36-41.
[9] XIAO P,ZHANG X S,YANG F Y,et al.Vulnerability Detection Based on Deep Graph Convolutional Network and Attention Mechanism [J].Computer Engineering and Applications,2024,60(3):292-298.
[10] LIU Z,QIAN P,WANG X,et al.Combining graph neural networks with expert knowledge for smart contract vulnerability detection [J].IEEE Transactions on Knowledge and Data Engineering,2021,35(2):1296-1310.
[11] FAN Y Q,SHANG S Y,DING X.Smart Contract Vulnerability Detection Based on Dual Attention Graph Convolutional Network[C]//Proceedings of the International Conference on Collaborative Computing:Networking,Applications and Worksharing.Berlin:Springer,2021:335-351.
[12] CHEN D,FENG L,FAN Y,et al.Smart contract vulnerability detection based on semantic graph and residual graph convolutional networks with edge attention [J].Journal of Systems and Software,2023,202:111705.
[13] HE L,ZHAO X,WANG Y,et al.Graphsa:Smart contract vulnerability detection combining graph neural networks and static analysis[C]//26th European Conference on Artificial Intelligence(ECAI).IOS Press,2023:1020-1027.
[14] HUANG J,HAN S M,YOU W,et al.Hunting vulnerable smart contracts via graph embedding based bytecode matching [J].IEEE Transactions on Information Forensics and Security,2021,16:2144-2156.
[15] LIN Y J,ZHANG Y.Integer Overflow Vulnerability Detection Based on the Fusion of Semantics and Structural Features [J].Journal of Hubei University(Natural Science Edition),2024,46(4):531-539.
[16] XUE J L,LI B,ZHANG J L,et al.A smart Contract Defect Detection Method Based on Transfer Learning [J].Journal of Yang-zhou University(Natural Science Edition),2023,26(4):25-30.
[17] KIPF T N.Semi-supervised classification with graph convolu-tional networks[J].arXiv:1609.02907,2016.
[18] ZHUANG Y,LIU Z,QIAN P,et al.Smart Contract Vulnerabi-lity Detection Using Graph Neural Networks[C]//Proceedings of the Twenty-ninth International Conference on International Joint Conferences on Artificial Intelligence.2021:3283-3290.
[19] LI X,DU J L,CHEN Z W,et al.Smart Contract Vulnerability Detection Method Based on Dual Channel [J].Science Techno-logy and Engineering,2023,23(34):14651-14659.
[20] SHI Z T,SHI Z B,LIU D M,et al.Feature-Wise ModulationGraph Neural Network Smart Contract Vulnerability Detection Based on Source Code [J].Journal of North University of China(Natural Science Edition),2024,45(5):601-607.
[21] LI X H,YANG Y B,ZHANG J W,et al.Graph Neural Network Vulnerability Detection for Ethernet Smart Contracts [J].Journal of Xidian University,2024,51(4):139-150.
[22] ZHOU T,DU Y P,XIE R F,et al.Vulnerability Detection Method Based on Deep Fusion of Multi-dimensional Features from Heterogeneous Contract Graphs [J].Computer Science,2025,52(9):368-375.
[23] LI C Y,HUANG K,ZHANG R H,et al.A Heterogeneous Graph Attention Network-Based Approach for Smart Contract Vulnerability Detection [J].Computer Science,2026,53(2):423-430.
[24] SONG J H,CAO K,ZHANG Y.Smart Contract Bytecode Vulnerability Detection Method Based on Heterogeneous Graphs and Instruction Sequences [J].Computer Science,2025,52(12):367-373.
[25] ANTONOPOULOS A M,WOOD G.Mastering ethereum:buil-ding smart contracts and dapps[M].O’reilly Media,2018.
[26] ZENG Q R,HE J H,ZHAO G S,et al.EtherGIS:A Vulnerability Detection Framework for Ethereum Smart Contracts Based on Graph Learning Features [C]//Proceedings of the 2022 IEEE 46th Annual Computers,Software,and Applications Conference(COMPSAC).Piscataway,NJ:IEEE,2022:1742-1749.
[27] WANG S L.A Source Code Vulnerability Detection SchemeBased on Code Sequence and Graph Structure [J].Journal of North University of China(Natural Science Edition),2023,44(6):641-653.
[28] YING Z B,SONG L C,CHEN D,et al.AWIBS:An adaptive weight incentive for blockchain sharding [J].Journal of Information and Intelligence,2023,1(2):87-103.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!