arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.02580cs.SEcs.AI
收藏

PropertyGPT:通过检索增强的属性生成实现由 LLM 驱动的智能合约形式化验证

PropertyGPT: LLM-driven Formal Verification of Smart Contracts through Retrieval-Augmented Property Generation

Singapore Management University(新加坡管理大学);MetaTrust Labs(MetaTrust实验室);The Hong Kong University of Science and Technology(香港科技大学);Nanyang Technological University(南洋理工大学);China-Singapore International Joint Research Institute (CSIJRI)(中新国际联合研究院(CSIJRI))

Ye Liu, Yue Xue, Daoyuan Wu, Yuqiang Sun, Yi Li, Miaolei Shi, Yang Liu

AI总结:

本文提出 PropertyGPT,结合检索增强生成、编译反馈迭代修订、多维度排序和专用形式化证明器,为智能合约自动生成可验证属性,并发现多个零日漏洞。

摘要:

随着大型语言模型(LLM)的最新进展,本文探索了利用 GPT-4 等最先进 LLM 的潜力,以迁移现有的人工编写属性(例如来自 Certora 审计报告的属性),并为未知代码自动生成定制属性。为此,我们将现有属性嵌入到向量数据库中,并检索一个参考属性,用于基于 LLM 的上下文学习,从而为给定代码生成新属性。尽管这一基本流程相对直接,但确保生成的属性具备(i)可编译性、(ii)适当性和(iii)可验证性仍存在挑战。为解决(i),我们使用编译和静态分析反馈作为外部预言机,引导 LLM 迭代修订生成的属性。对于(ii),我们考虑多个相似度维度对属性进行排序,并采用加权算法识别 top-K 属性作为最终结果。对于(iii),我们设计了专用证明器,以形式化验证生成属性的正确性。我们已将这些策略实现为一个名为 PropertyGPT 的新型基于 LLM 的属性生成工具。实验表明,PropertyGPT 能够生成全面且高质量的属性,与真实基准相比达到 80% 的召回率。它在 37 个受测对象中成功检测到 26 个 CVE/攻击事件,还发现了 12 个零日漏洞,并因此获得 8,256 美元的漏洞赏金奖励。

英文摘要:

With recent advances in large language models (LLMs), this paper explores the potential of leveraging state-of-the-art LLMs,such as GPT-4, to transfer existing human-written properties (e.g.,those from Certora auditing reports) and automatically generate customized properties for unknown code. To this end, we embed existing properties into a vector database and retrieve a reference property for LLM-based in-context learning to generate a new property for a given code. While this basic process is relatively straightforward, ensuring that the generated properties are (i) compilable, (ii) appropriate, and (iii) verifiable presents challenges. To address (i), we use the compilation and static analysis feedback as an external oracle to guide LLMs in iteratively revising the generated properties. For (ii), we consider multiple dimensions of similarity to rank the properties and employ a weighted algorithm to identify the top-K properties as the final result. For (iii), we design a dedicated prover to formally verify the correctness of the generated properties. We have implemented these strategies into a novel LLM-based property generation tool called PropertyGPT. Our experiments show that PropertyGPT can generate comprehensive and high-quality properties, achieving an 80% recall compared to the ground truth. It successfully detected 26 CVEs/attack incidents out of 37 tested and also uncovered 12 zero-day vulnerabilities, leading to $8,256 in bug bounty rewards.

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

↑