arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2307.08549cs.CR
收藏

G-Scan:用于智能合约行级漏洞识别的图神经网络

G-Scan: Graph Neural Networks for Line-Level Vulnerability Identification in Smart Contracts

Christoph Sendner, Ruisi Zhang, Alexander Hefter, Alexandra Dmitrienko, Farinaz Koushanfar

AI总结:

本文提出 G-Scan,通过保留依赖与层次结构的代码图和图神经网络实现智能合约重入漏洞的端到端行级定位,并在真实标注数据集上取得高 F1 分数与毫秒级检测效率。

摘要:

由于以太坊(ETH)平台具有不可篡改和去中心化的特性,智能合约容易受到安全风险影响,并可能导致经济损失。现有基于机器学习的漏洞检测算法虽然在合约级别取得了较高准确率,但仍需要开发者手动检查源代码以定位缺陷。为此,我们提出 G-Scan,这是首个在同类首个真实世界数据集上评估的端到端细粒度行级漏洞检测系统。G-Scan 首先以保留依赖关系和层次结构的方式将智能合约转换为代码图。随后,我们训练一个图神经网络来识别易受攻击的节点并评估安全风险。最后,带有节点漏洞预测结果的代码图被映射回智能合约,以实现行级定位。我们在一个收集得到的真实世界智能合约数据集上训练并评估 G-Scan,该数据集包含针对重入漏洞的行级标注;重入漏洞是最常见且最严重的智能合约漏洞类型之一。借助设计良好的图表示和高质量数据集,G-Scan 在合约级漏洞检测中取得 93.02% 的 F1 分数,在行级漏洞定位中取得 93.69% 的 F1 分数。此外,轻量级图神经网络使 G-Scan 能够在 1.2 秒内定位包含 6.1k 行代码的智能合约中的漏洞。

英文摘要:

Due to the immutable and decentralized nature of Ethereum (ETH) platform, smart contracts are prone to security risks that can result in financial loss. While existing machine learning-based vulnerability detection algorithms achieve high accuracy at the contract level, they require developers to manually inspect source code to locate bugs. To this end, we present G-Scan, the first end-to-end fine-grained line-level vulnerability detection system evaluated on the first-of-its-kind real world dataset. G-Scan first converts smart contracts to code graphs in a dependency and hierarchy preserving manner. Next, we train a graph neural network to identify vulnerable nodes and assess security risks. Finally, the code graphs with node vulnerability predictions are mapped back to the smart contracts for line-level localization. We train and evaluate G-Scan on a collected real world smart contracts dataset with line-level annotations on reentrancy vulnerability, one of the most common and severe types of smart contract vulnerabilities. With the well-designed graph representation and high-quality dataset, G-Scan achieves 93.02% F1-score in contract-level vulnerability detection and 93.69% F1-score in line-level vulnerability localization. Additionally, the lightweight graph neural network enables G-Scan to localize vulnerabilities in 6.1k lines of code smart contract within 1.2 seconds.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑