Security vulnerabilities in smart contracts pose significant risks to blockchain ecosystems. Traditional mitigation strategies, including static analysis, formal verification, and pattern-based detection, often suffer from high false positives, limited scalability, and dependency on expert-curated rules. To address these limitations, this paper proposes an innovative approach that integrates Large Language Models (LLMs) with contract analysis results to establish a multistage collaborative framework for smart contract vulnerability repair. The LLMfram first generates Control Flow Graphs (CFGs) and Call Graphs, capturing critical code logic. Then, the contract is segmented based on the function. Subsequently, it leverages multiround LLM interactions for hierarchical tasks, including vulnerability detection, root cause analysis, and patch generation. Finally, the generated repair code undergoes LLM-human collaborative verification to ensure functional correctness. Experimental results demonstrate that the LLMfram improves vulnerability localization and repair accuracy by dynamically coordinating LLMs with static analysis results and employing hierarchical diagnostic mechanisms. This work offers a scalable and explainable solution for smart contract repair.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

A Large Language Models-Powered Framework for Smart Contract Repair

  • Peicheng Miao,
  • Ziling Pan

摘要

Security vulnerabilities in smart contracts pose significant risks to blockchain ecosystems. Traditional mitigation strategies, including static analysis, formal verification, and pattern-based detection, often suffer from high false positives, limited scalability, and dependency on expert-curated rules. To address these limitations, this paper proposes an innovative approach that integrates Large Language Models (LLMs) with contract analysis results to establish a multistage collaborative framework for smart contract vulnerability repair. The LLMfram first generates Control Flow Graphs (CFGs) and Call Graphs, capturing critical code logic. Then, the contract is segmented based on the function. Subsequently, it leverages multiround LLM interactions for hierarchical tasks, including vulnerability detection, root cause analysis, and patch generation. Finally, the generated repair code undergoes LLM-human collaborative verification to ensure functional correctness. Experimental results demonstrate that the LLMfram improves vulnerability localization and repair accuracy by dynamically coordinating LLMs with static analysis results and employing hierarchical diagnostic mechanisms. This work offers a scalable and explainable solution for smart contract repair.