arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2411.09217cs.SEcs.CRcs.PL
收藏

SmartInv:用于智能合约不变量推断的多模态学习

SmartInv: Multimodal Learning for Smart Contract Invariant Inference

Sally Junsong Wang, Kexin Pei, Junfeng Yang

AI总结:

提出多模态智能合约不变量推断框架SmartInv,利用思维层级提示策略结合源代码与自然语言生成不变量并检测违例,在真实合约中高效发现119个零日漏洞。

摘要:

智能合约是在区块链上实现各种业务活动的软件程序。最近的研究发现了由交易上下文和源代码共同引发的新型“机器不可审计”漏洞。现有的检测方法需要人工理解底层交易逻辑,并跨不同上下文来源(即模态)进行人工推理,例如代码、动态交易执行以及指定预期交易行为的自然语言。为了自动化检测“机器不可审计”漏洞,我们提出了SmartInv,一个准确且快速的智能合约不变量推断框架。我们的核心洞察是,由不变量指定的智能合约预期行为依赖于跨多模态信息(如源代码和自然语言)的理解与推理。我们提出了一种面向基础模型的新提示策略——思维层级(Tier of Thought, ToT),以跨智能合约的多种模态进行推理,并最终生成不变量。通过检查这些生成不变量的违例情况,SmartInv能够识别潜在漏洞。我们在真实合约上评估了SmartInv,并重新发现了在过去2.5年(从2021年1月1日至2023年5月31日)导致数百万美元损失的漏洞。我们广泛的评估表明,与最先进的工具相比,SmartInv生成了(3.5倍)更多与漏洞相关的关键不变量,检测出(4倍)更多的关键漏洞,且耗时显著减少(150倍)。该系统从89,621个真实合约中发现了119个零日漏洞。其中五个被开发者确认为“高严重性”的关键零日漏洞。

英文摘要:

Smart contracts are software programs that enable diverse business activities on the blockchain. Recent research has identified new classes of "machine un-auditable" bugs that arise from both transactional contexts and source code. Existing detection methods require human understanding of underlying transaction logic and manual reasoning across different sources of context (i.e. modalities), such as code, dynamic transaction executions, and natural language specifying the expected transaction behavior. To automate the detection of ``machine un-auditable'' bugs, we present SmartInv, an accurate and fast smart contract invariant inference framework. Our key insight is that the expected behavior of smart contracts, as specified by invariants, relies on understanding and reasoning across multimodal information, such as source code and natural language. We propose a new prompting strategy to foundation models, Tier of Thought (ToT), to reason across multiple modalities of smart contracts and ultimately to generate invariants. By checking the violation of these generated invariants, SmartInv can identify potential vulnerabilities. We evaluate SmartInv on real-world contracts and re-discover bugs that resulted in multi-million dollar losses over the past 2.5 years (from January 1, 2021 to May 31, 2023). Our extensive evaluation shows that SmartInv generates (3.5X) more bug-critical invariants and detects (4$\times$) more critical bugs compared to the state-of-the-art tools in significantly (150X) less time. \sys uncovers 119 zero-day vulnerabilities from the 89,621 real-world contracts. Among them, five are critical zero-day bugs confirmed by developers as ``high severity.''

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

↑