arXiv:2508.01371cs.CRcs.AI2025-08被引 9

用大模型自动生成智能合约漏洞攻击代码,验证了可行性但暴露了局限。

Prompt to Pwn: Automated Exploit Generation for Smart Contracts

  • 基于大模型与Foundry工具链,实现漏洞利用代码的自动合成与验证。
  • 主流大模型可稳定生成单合约漏洞的确定性攻击代码,但对跨合约攻击效果差。
  • 适合安全研究人员和智能合约开发者,用于评估防御能力与测试漏洞真实性。

智能合约在数字金融中至关重要,但部署后难以修补。以往研究多聚焦于大模型在漏洞检测上的应用,而对端到端自动化漏洞利用(AEG)关注不足。本文提出ReX框架,将大模型驱动的漏洞利用生成与Foundry开发栈结合,实现从生成、编译、执行到验证的全流程自动化。在8类常见漏洞上评估了5个前沿大模型,使用包含38+真实事件攻击样本的数据集及三项自动化辅助工具:提示重构、编译器反馈回路和模板化测试套件。结果表明,当前先进大模型能有效生成单合约漏洞的确定性攻击代码,但在跨合约攻击上表现较弱;性能主要取决于模型与漏洞类型,代码结构与提示调优影响较小。研究还揭示了大模型生成攻击在预言机验证与真实经济攻击之间的差距,强调需加强防御机制并构建更真实的评估体系。

原文摘要 · Abstract (English)

Smart contracts are important for digital finance, yet they are hard to patch once deployed. Prior work has mainly explored LLMs for smart contract vulnerability detection, leaving end-to-end automated exploit generation (AEG) much less understood. We study that gap with \textsc{ReX}, an execution-grounded framework that links LLM-based exploit synthesis to the Foundry stack for end-to-end generation, compilation, execution, and validation. Five recent LLMs are evaluated across eight common vulnerability classes, supported by a curated dataset of 38{+} real incident PoCs and three automation aids: prompt refactoring, a compiler feedback loop, and templated test harnesses. Results indicate that current frontier LLMs can often produce deterministic PoCs for single-contract vulnerabilities, but remain weak on cross-contract attacks; outcomes depend mainly on the model and bug type, while code structure and prompt tuning contribute less in our setting. The study also surfaces important boundary conditions of LLM-driven AEG, including gaps between oracle-validated exploitability and real-world economic attacks, pointing to the need for stronger defenses and more realistic evaluation.

智能合约漏洞利用大模型安全自动化攻防

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。