Reentrancy vulnerabilities pose a pervasive threat to blockchain ecosystems, demanding detection methods that are both highly accurate and produce trustworthy, human-verifiable explanations. While Large Language Models (LLMs) show promise, their opaque decision-making processes limit their reliability in this security-critical domain. We address this challenge by systematically evaluating two competing guidance strategies: grounding LLM analysis in external, structural evidence (via Retrieval-Augmented Generation) versus prescribing a human-expert-crafted, internal thought process (via Chain of Thought). A reasoning-optimized model enhanced by a Structurally-Aware RAG pipeline establishes a new state-of-the-art, surpassing traditional static analysis, deep learning, and other LLM baselines on a curated dataset of manually verified contracts. This evidence-grounded approach not only yields superior classification accuracy but, critically, produces transparent and actionable explanations that human experts judged as maximally correct and informative. By grounding automated analysis in verifiable evidence, our work delivers a validated blueprint for the next generation of AI-powered security tools.

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

Advanced Large Language Models Prompting Strategies for Reentrancy Classification and Explanation in Smart Contracts

  • Matteo Rizzo,
  • Alvise Spanò,
  • Lorenzo Benetollo,
  • Dalila Ressi,
  • Andrea Gasparetto,
  • Sabina Rossi

摘要

Reentrancy vulnerabilities pose a pervasive threat to blockchain ecosystems, demanding detection methods that are both highly accurate and produce trustworthy, human-verifiable explanations. While Large Language Models (LLMs) show promise, their opaque decision-making processes limit their reliability in this security-critical domain. We address this challenge by systematically evaluating two competing guidance strategies: grounding LLM analysis in external, structural evidence (via Retrieval-Augmented Generation) versus prescribing a human-expert-crafted, internal thought process (via Chain of Thought). A reasoning-optimized model enhanced by a Structurally-Aware RAG pipeline establishes a new state-of-the-art, surpassing traditional static analysis, deep learning, and other LLM baselines on a curated dataset of manually verified contracts. This evidence-grounded approach not only yields superior classification accuracy but, critically, produces transparent and actionable explanations that human experts judged as maximally correct and informative. By grounding automated analysis in verifiable evidence, our work delivers a validated blueprint for the next generation of AI-powered security tools.