信息网络安全 ›› 2024, Vol. 24 ›› Issue (11): 1624-1631.doi: 10.3969/j.issn.1671-1122.2024.11.002

• 入选论文 • 上一篇    下一篇

基于双注意力机制图神经网络的智能合约漏洞检测方法

李鹏超1,2(), 张全涛1, 胡源3   

  1. 1.重庆警察学院信息安全系,重庆 401331
    2.西南大学计算机信息科学学院,重庆 400715
    3.重庆市公安局合川分局,重庆 400153
  • 收稿日期:2024-08-10 出版日期:2024-11-10 发布日期:2024-11-21
  • 通讯作者: 李鹏超 lipengchao61@qq.com
  • 作者简介:李鹏超(1983—),男,重庆,副教授,博士研究生,主要研究方向为电子数据取证、区块链犯罪侦查|张全涛(1984—),男,重庆,教授,博士,主要研究方向为大数据犯罪侦查、区块链犯罪侦查、人工智能法学|胡源(2001—),男,重庆,本科,主要研究方向为网络犯罪侦查与取证
  • 基金资助:
    重庆市教育委员会科学技术研究项目(KJQN202301701);重庆市教育委员会科学技术研究项目(KJZD-K202201701)

Smart Contract Vulnerability Detection Method Based on Graph Convolutional Network with Dual Attention Mechanism

LI Pengchao1,2(), ZHANG Quantao1, HU Yuan3   

  1. 1. Department of Information Security, Chongqing Police College, Chongqing 401331, China
    2. School of Computer and Information Science, Southwest University, Chongqing 400715, China
    3. Hechuan Branch of Chongqing Public Security Bureau, Chongqing 400153, China
  • Received:2024-08-10 Online:2024-11-10 Published:2024-11-21

摘要:

随着区块链技术的广泛应用,智能合约的内部逻辑越来越复杂。然而,目前大多数智能合约漏洞检测方法存在假阳性率高、检测准确率低等问题。为此,文章提出一种基于双注意力机制图神经网络的智能合约漏洞检测方法,用于智能合约漏洞检测,旨在提升检测的准确性和效率。文章在图卷积网络的卷积层中引入了多头注意力机制,并在特征传播阶段动态计算邻接节点信息对应的注意力权重。该机制使模型在特征聚合时更加关注与当前节点最相关的邻居节点,从而提升对重要特征的辨识能力。在图池化阶段,采用注意力池化机制选择和聚合节点特征,进一步提升对关键节点的关注度,提高了对漏洞检测影响较大特征的识别能力。文章采用以太坊智能合约漏洞样本数据集(ESC)进行实验,实验结果表明,与其他检测技术相比,文章所提方法在识别复杂智能合约漏洞方面具有更快的检测速度和更高的准确性。

关键词: 智能合约, 漏洞检测, 注意力机制, 图神经网络

Abstract:

With the widespread adoption of blockchain technology, an increasing number of smart contracts exhibiting complex internal logic are being deployed. However, most existing methods for detecting vulnerabilities in smart contracts suffer from high false positive rates and low detection accuracy. To address these challenges, this paper proposed a smart contract vulnerability detection method based on graph convolutional network with dual attention mechanism, aiming to improve both the accuracy and efficiency of the detection process. Initially, a multi-head attention mechanism was integrated into the convolutional layer of the graph convolutional network, enabling the dynamic calculation of attention weights based on the information from adjacent nodes during the feature propagation stage. This enhancement allowed the model to concentrate more on the neighbors most relevant to the current node during each feature aggregation, thereby improving the recognition of critical features. Subsequently, during the graph pooling stage, an attention-based pooling mechanism was employed to select and aggregate node features, further emphasizing key nodes and enhancing the identification of features that significantly influence vulnerability detection. The proposed method was evaluated using the ethereum smart contract (ESC) vulnerability sample dataset. Experimental results demonstrate that compared to other detection techniques, the proposed method can identify complex smart contract vulnerabilities with greater speed and accuracy.

Key words: smart contract, vulnerability detection, attention mechanism, graph convolutional network

中图分类号: