We introduce the Deep Learning Vulnerability Analyzer (DLVA) for Ethereum smart contracts based on neural networks. We train DLVA to judge bytecode even though the supervising oracle can only judge source. DLVA's training algorithm is general: we extend a source code analysis to bytecode without any manual feature engineering, predefined patterns, or expert rules. DLVA's training algorithm is also robust: it overcame a 1.25% error rate mislabeled contracts, and--the student surpassing the teacher--found vulnerable contracts that Slither mislabeled. DLVA is much faster than other smart contract vulnerability detectors: DLVA checks contracts for 29 vulnerabilities in 0.2 seconds, a 10-1,000x speedup. DLVA has three key components. First, Smart Contract to Vector (SC2V) uses neural networks to map smart contract bytecode to a high-dimensional floating-point vector. We benchmark SC2V against 4 state-of-the-art graph neural networks and show that it improves model differentiation by 2.2%. Second, Sibling Detector (SD) classifies contracts when a target contract's vector is Euclidian-close to a labeled contract's vector in a training set; although only able to judge 55.7% of the contracts in our test set, it has a Slither-predictive accuracy of 97.4% with a false positive rate of only 0.1%. Third, Core Classifier (CC) uses neural networks to infer vulnerable contracts regardless of vector distance. We benchmark DLVA's CC with 10 ML techniques and show that the CC improves accuracy by 11.3%. Overall, DLVA predicts Slither's labels with an overall accuracy of 92.7% and associated false positive rate of 7.2%. Lastly, we benchmark DLVA against nine well-known smart contract analysis tools. Despite using much less analysis time, DLVA completed every query, leading the pack with an average accuracy of 99.7%, pleasingly balancing high true positive rates with low false positive rates.
翻译:我们提出了基于神经网络的以太坊智能合约深度学习漏洞分析器(DLVA)。即使监督预言机仅能判断源代码,我们仍训练DLVA分析字节码。DLVA的训练算法具有通用性:无需任何手工特征工程、预定义模式或专家规则,即可将源代码分析扩展至字节码。DLVA的训练算法同样具备鲁棒性:它克服了1.25%的错误标注合约,且实现了"学生超越老师"——发现了Slither误标注的脆弱合约。DLVA的速度远超其他智能合约漏洞检测器:可在0.2秒内检测合约的29类漏洞,实现10-1000倍的加速。DLVA包含三个关键组件。首先,智能合约到向量(SC2V)模块利用神经网络将智能合约字节码映射为高维浮点向量。我们将其与4种前沿图神经网络进行基准测试,结果表明模型区分度提升2.2%。其次,兄弟检测器(SD)在目标合约向量与训练集中已标注合约向量欧氏距离相近时进行分类;尽管仅能判定测试集中55.7%的合约,但其对Slither标签的预测准确率达97.4%,假阳性率仅0.1%。第三,核心分类器(CC)通过神经网络推断脆弱合约,不受向量距离限制。我们采用10种机器学习技术对DLVA的CC进行基准测试,结果显示CC准确率提升11.3%。整体而言,DLVA对Slither标签的预测总体准确率为92.7%,对应的假阳性率为7.2%。最后,我们与9款知名智能合约分析工具进行对比测试。尽管分析耗时更少,DLVA完成了所有查询任务,以平均准确率99.7%领先,在高真阳性率与低假阳性率之间实现了令人满意的平衡。