Adversarial smart contracts, mostly on EVM-compatible chains like Ethereum and BSC, are deployed as EVM bytecode to exploit vulnerable smart contracts for financial gain. Detecting such malicious contracts at the time of deployment is an important proactive strategy to prevent losses from victim contracts. It offers a better cost-benefit ratio than detecting vulnerabilities on diverse potential victims. However, existing works are not generic with limited detection types and effectiveness due to imbalanced samples, while the emerging LLM technologies, which show their potential in generalization, have two key problems impeding its application in this task: hard digestion of compiled-code inputs, especially those with task-specific logic, and hard assessment of LLM's certainty in its binary (yes-or-no) answers. Therefore, we propose a generic adversarial smart contracts detection framework FinDet, which leverages LLM with two enhancements addressing the above two problems. FinDet takes as input only the EVM bytecode contracts and identifies adversarial ones among them with high balanced accuracy. The first enhancement extracts concise semantic intentions and high-level behavioral logic from the low-level bytecode inputs, unleashing the LLM reasoning capability restricted by the task input. The second enhancement probes and measures the LLM uncertainty to its multi-round answering to the same query, improving the LLM answering robustness for binary classifications required by the task output. Our comprehensive evaluation shows that FinDet achieves a BAC of 0.9374 and a TPR of 0.9231, significantly outperforming existing baselines. It remains robust under challenging conditions including unseen attack patterns, low-data settings, and feature obfuscation. FinDet detects all 5 public and 20+ unreported adversarial contracts in a 10-day real-world test, confirmed manually.


翻译:对抗性智能合约主要部署于以太坊和币安智能链等EVM兼容区块链上,以EVM字节码形式存在,旨在利用易受攻击的智能合约谋取经济利益。在部署阶段检测此类恶意合约是防止受害合约损失的重要主动防御策略,其成本效益优于在多样化潜在受害合约中检测漏洞。然而,现有研究因样本不平衡导致检测类型有限且效果不足,缺乏普适性;而新兴的大语言模型虽展现出泛化潜力,却因两个关键问题阻碍其在该任务中的应用:难以消化编译代码输入(尤其是包含任务特定逻辑的代码),以及难以评估大语言模型对二元(是/否)答案的确定性。为此,我们提出了一种通用的对抗性智能合约检测框架FinDet,通过两项增强技术利用大语言模型解决上述问题。FinDet仅以EVM字节码合约为输入,能以高平衡精度识别其中的对抗性合约。第一项增强从低级字节码输入中提取简洁的语义意图与高层行为逻辑,释放了大语言模型受任务输入限制的推理能力;第二项增强通过探测和量化大语言模型对同一查询多轮回答的不确定性,提升了模型对任务所需的二元分类的回答鲁棒性。综合评估表明,FinDet实现了0.9374的平衡准确率和0.9231的真实阳性率,显著优于现有基线方法。该框架在未见攻击模式、低数据场景和特征混淆等挑战性条件下仍保持稳健。在为期10天的真实环境测试中,FinDet成功检测出全部5个公开及20余个未公开报告的对抗性合约,并经人工验证确认。

0
下载
关闭预览

相关内容

【ICML2022】可达性约束强化学习
专知会员服务
23+阅读 · 2022年5月18日
LibRec 每周算法:LDA主题模型
LibRec智能推荐
29+阅读 · 2017年12月4日
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
VIP会员
相关基金
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
Top
微信扫码咨询专知VIP会员