arXiv:2512.09385cs.CRcs.AI2025-12AAAI被引 1

用图神经网络直接检测智能合约漏洞,无需人工规则

BugSweeper: Function-Level Detection of Smart Contract Vulnerabilities Using Graph Neural Networks

  • 将函数抽象为结合语法与数据流的图结构
  • 两阶段GNN模型在真实合约上准确率显著领先
  • 适合需要自动化安全检测的区块链开发者

以太坊的快速发展使得快速准确地检测智能合约漏洞变得愈发重要。尽管基于机器学习的方法已初显成效,但许多方法仍依赖领域专家设计的规则化预处理,这类方法常会丢弃源码中的关键上下文信息,导致某些漏洞被遗漏,并限制对新兴威胁的适应能力。本文提出BugSweeper,一种端到端的深度学习框架,可直接从源码中检测漏洞而无需人工特征工程。BugSweeper将每个Solidity函数表示为函数级抽象语法图(FLAG),这是一种融合抽象语法树(AST)与增强的控制流和数据流语义的新图结构。随后,采用两阶段图神经网络(GNN)分析这些图:第一阶段GNN过滤语法图中的噪声,第二阶段GNN进行高层次推理以检测多种漏洞。在真实世界合约上的大量实验表明,BugSweeper显著优于所有现有最先进检测方法。通过消除对手工规则的依赖,该方法提供了一种鲁棒、自动且可扩展的智能合约安全解决方案,无需依赖安全专家。

原文摘要 · Abstract (English)

The rapid growth of Ethereum has made it more important to quickly and accurately detect smart contract vulnerabilities. While machine-learning-based methods have shown some promise, many still rely on rule-based preprocessing designed by domain experts. Rule-based preprocessing methods often discard crucial context from the source code, potentially causing certain vulnerabilities to be overlooked and limiting adaptability to newly emerging threats. We introduce BugSweeper, an end-to-end deep learning framework that detects vulnerabilities directly from the source code without manual engineering. BugSweeper represents each Solidity function as a Function-Level Abstract Syntax Graph (FLAG), a novel graph that combines its Abstract Syntax Tree (AST) with enriched control-flow and data-flow semantics. Then, our two-stage Graph Neural Network (GNN) analyzes these graphs. The first-stage GNN filters noise from the syntax graphs, while the second-stage GNN conducts high-level reasoning to detect diverse vulnerabilities. Extensive experiments on real-world contracts show that BugSweeper significantly outperforms all state-of-the-art detection methods. By removing the need for handcrafted rules, our approach offers a robust, automated, and scalable solution for securing smart contracts without any dependence on security experts.

智能合约图神经网络漏洞检测

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。