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

利用 LLM 上下文学习实现智能合约的安全程序划分

Towards Secure Program Partitioning for Smart Contracts with LLM's In-Context Learning

Singapore Management University(新加坡管理大学);Nanyang Technological University(南洋理工大学)

Ye Liu, Yuqing Niu, Chengyan Ma, Ruidong Han, Wei Ma, Yi Li, Debin Gao, David Lo

AI总结:

本文提出 PartitionGPT,结合静态分析与 LLM 上下文学习,将智能合约按敏感变量划分为特权与普通代码,实验表明其可有效减少代码并防御真实操纵攻击。

摘要:

智能合约由于敏感信息泄露,极易受到操纵攻击。解决操纵漏洞尤其具有挑战性,因为这些漏洞源于固有的数据机密性问题,而非简单的实现缺陷。为通过防止敏感信息泄露来应对该问题,我们提出 PartitionGPT,这是首个由 LLM 驱动的方法,将静态分析与大型语言模型(LLM)的上下文学习能力相结合,在少量已标注敏感数据变量的引导下,将智能合约划分为特权代码库和普通代码库。我们在包含 99 个敏感函数的 18 个已标注智能合约上评估了 PartitionGPT。结果表明,PartitionGPT 成功为 78% 的敏感函数生成可编译且经过验证的划分,同时与函数级划分方法相比减少约 30% 的代码。此外,我们在 9 起真实世界操纵攻击上评估了 PartitionGPT,这些攻击共造成 2500 万美元损失;PartitionGPT 有效阻止了其中 8 起,凸显了其广泛适用性的潜力,以及在智能合约开发过程中进行安全程序划分以减少操纵漏洞的必要性。

英文摘要:

Smart contracts are highly susceptible to manipulation attacks due to the leakage of sensitive information. Addressing manipulation vulnerabilities is particularly challenging because they stem from inherent data confidentiality issues rather than straightforward implementation bugs. To tackle this by preventing sensitive information leakage, we present PartitionGPT, the first LLM-driven approach that combines static analysis with the in-context learning capabilities of large language models (LLMs) to partition smart contracts into privileged and normal codebases, guided by a few annotated sensitive data variables. We evaluated PartitionGPT on 18 annotated smart contracts containing 99 sensitive functions. The results demonstrate that PartitionGPT successfully generates compilable, and verified partitions for 78% of the sensitive functions while reducing approximately 30% code compared to function-level partitioning approach. Furthermore, we evaluated PartitionGPT on nine real-world manipulation attacks that lead to a total loss of 25 million dollars, PartitionGPT effectively prevents eight cases, highlighting its potential for broad applicability and the necessity for secure program partitioning during smart contract development to diminish manipulation vulnerabilities.

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

↑