Journal of Information Security Reserach ›› 2026, Vol. 12 ›› Issue (9): 842-849.DOI: 10.12379/j.issn.2096-1057.2026.09.07

Previous Articles     Next Articles

SAFE-SCVDM: Sequence Feature-Enhanced Smart Contract Vulnerability Detection Model

Cai Lizhi, Ma Yuan, Yang Kang   

  • Online:2026-09-02 Published:2026-09-02

基于序列特征增强的智能合约漏洞检测模型

蔡立志,马原,杨康   

  • 作者简介:蔡立志,马原,杨康

Abstract: Aiming at the insufficient integration of local features and global features in existing smart contract vulnerability detection methods, as well as inadequate modeling of code contextual dependencies, this paper proposes a sequence feature-enhanced vulnerability detection model for smart contracts-SAFE-SCVDM. The model innovatively integrates multi-dimensional code representations through a three-stage feature extraction architecture to improve detection accuracy. First, we design a structured traversal based transformation strategy for abstract syntax trees , converting AST into sequential structures that preserve lexical and hierarchical features. Second, a node extraction script is developed to mine token-level information from smart contract code, retaining semantic characteristics. Subsequently, global contextual dependencies are captured by leveraging a large-scale code model to generate code comments from source code, thereby preserving cross-function semantic relationships. Finally, an enhanced LoRA detection model is proposed, utilizing a self-attention mechanism to jointly model textual sequences (code tokens), structural sequences (SBT-AST), and global annotations (code comments). Experimental results demonstrate that the proposed method achieves an accuracy of 88.41% in smart contract vulnerability detection, outperforming state-of-the-art baseline models by 9.8%.

Key words: deep learning, vulnerability detection, abstract syntax trees, sequence structures;large models

摘要: 针对现有智能合约(Smart Contract, SC)漏洞检测方法中局部特征与全局特征融合不足、代码上下文依赖建模不充分等问题,本文提出一种基于序列特征增强的智能合约漏洞检测模型SAFE-SCVDM。该模型创新性地融合代码多维度表征,通过三阶段特征提取架构实现漏洞检测精度提升:首先,设计基于结构遍历(Structure-Based Traversal,SBT)的抽象语法树(Abstract Syntax Tree,AST)转化策略,将抽象语法树转化为含有词汇与层次特征的序列结构;其次,构建节点提取脚本从智能合约代码中挖掘代码的token信息,保留代码的语义特征;随后,提取智能合约全局上下文信息,利用CodeBERT模型将智能合约的源代码转换为代码注释特征,保留代码的全局依赖信息;最后,利用代码注释、SBT方式遍历后的AST序列结构及代码的token序列来作为微调数据集,并对大语言模型进行微调。实验结果表明,SAFE-SCVDM在公开的智能合约漏洞检测数据集上的准确率达到88.41%,比最先进的基准模型提高了9.8%。

关键词: 深度学习, 漏洞检测, 抽象语法树, 序列结构, 大模型

CLC Number: