计算机工程与应用 ›› 2025, Vol. 61 ›› Issue (16): 283-291.DOI: 10.3778/j.issn.1002-8331.2405-0424

• 网络、通信与安全 • 上一篇    下一篇

DcRD:聚合图信息流的双通道重入漏洞检测

苗春雨,林浩,王春东,牛德合,方顺尧   

  1. 1.天津理工大学 计算机科学与工程学院,天津 300380 
    2.天津市智能计算及软件新技术重点实验室,天津 300380
    3.学习型智能系统教育部工程研究中心,天津 300380
  • 出版日期:2025-08-15 发布日期:2025-08-15

Dual-Channel Reentrancy Vulnerability Detection with Aggregated Graph Information Flow

MIAO Chunyu, LIN Hao, WANG Chundong, NIU Dehe, FANG Shunyao   

  1. 1.School of Computer Science and Engineering, Tianjin University of Technology, Tianjin 300380, China
    2.Tianjin Key Laboratory of Intelligence Computing and Novel Software Technology, Tianjin 300380, China
    3.Engineering Research Center of Learning-Based Intelligent System (Ministry of Education), Tianjin 300380, China
  • Online:2025-08-15 Published:2025-08-15

摘要: 随着区块链技术的成熟和智能合约的广泛应用,保证其安全性已经成为重要的研究方向。在合约部署前有效检测漏洞可以防止用户资产受损。目前,基于深度学习的研究取得了初步成功,但由于未能充分考虑代码的不同表示的信息对漏洞检测的贡献,其准确率仍然有提升空间。提出了一种聚合图信息流的双通道重入漏洞检测方法(dual-channel reentrancy vulnerability detection with aggregated graph information flow,DcRD)。其中上侧通道基于专家知识利用模式匹配获取模式特征。下侧通道针对合约代码的非欧图表示,使用关系图神经网络(relational graph neural network,R-GNN)加权聚合图中不同信息流,获取更先进的图特征。结合注意力机制对双通道特征赋权融合用于漏洞检测。同时关注了通道内和通道层的不同特征对检测结果的差异性影响,以提高检测准确率。通过与多个基线模型进行比较实验以及搭建多个DcRD的变体模型进行消融实验,证明了DcRD模型在多个检测指标上均优于基线模型,平均准确率达到了98.50%,平均精确率为99.09%,平均召回率为96.46%,平均F1分数为97.76%。

关键词: 重入漏洞检测, 关系图神经网络(R-GNN), 图信息流, 双通道特征, 注意力机制

Abstract: With the maturation of blockchain technology and the widespread application of smart contracts, ensuring their security has become a crucial research direction. Effectively detecting vulnerabilities before contract deployment can prevent user asset loss. Currently, research based on deep learning has achieved preliminary success, but there is still room for improvement in accuracy due to insufficient consideration of the contribution of different information in code representations to vulnerability detection. A dual-feature reentrancy vulnerability detection with aggregated graph information flow (DcRD) is proposed, whose core idea is to pay different attention to different representation features of the contract to improve the detection accuracy. Among them, the upper side channel obtains pattern features based on expert knowledge using pattern matching. The lower channel uses relational graph neural network (R-GNN) to weight and aggregate different information flows in the graph for the non-Euclidean graph representation of the contract code to obtain more advanced graph features. The dual-channel features are empowered and fused through attention mechanism and then are fed into the model for vulnerability detection. Attention is paid to the differential impact of different features within the channel and at the channel layer on the detection results to improve the detection accuracy. Through comparison experiments with multiple baseline models and ablation experiments by building DcRD variant models, it is proved that the DcRD model outperforms the baseline model in all detection metrics. The average accuracy is 98.50%, the average precision is 99.09%, the average recall is 96.46%, and the average F1 score is 97.76%.

Key words: reentrancy vulnerability detection, relational graph neural network (R-GNN), graph information flow, dual-channel features, attention mechanism