面向Solana与Algorand智能合约LLM漏洞检测的提示工程与微调对比研究
Prompt Engineering vs. Fine-Tuning for LLM-Based Vulnerability Detection in Solana and Algorand Smart Contracts
AI总结:
针对Solana与Algorand非EVM智能合约漏洞检测场景,本文构建专属标注数据集,对比提示工程、微调及混合方案的LLM检测性能,验证了整合领域数据的LLM方案的可行性。
摘要:
智能合约已成为去中心化环境中的核心组件,可通过自执行程序实现交易自动化。这类创新具备显著优势,但如果智能合约代码未经过严谨设计与实现,也会带来潜在风险。本文研究大语言模型(LLM)检测以太坊虚拟机(EVM)生态之外智能合约中OWASP类漏洞的能力,重点聚焦Solana与Algorand平台。针对非EVM平台标注数据集缺失的问题,本文构建了合成数据集,包含基于OWASP漏洞分类体系标注的Rust(面向Solana)与PyTeal(面向Algorand)智能合约代码片段。本文在三种配置下评估LLM性能:提示工程、微调以及二者混合方案,对比其在不同漏洞类别上的检测表现。实验结果显示,提示工程可实现通用鲁棒性,而微调能够提升模型在TEAL这类语义丰富度较低语言上的检测精确率与召回率。此外,本文分析了Solana与Algorand的架构差异对漏洞表现形式与可检测性的影响,给出了凸显现有安全工具局限性的平台专属映射关系。研究结果表明,只要在训练流水线中整合领域专属数据与分类体系,基于LLM的方法可有效应用于智能合约静态漏洞检测场景。
英文摘要:
Smart contracts have emerged as key components within decentralized environments, enabling the automation of transactions through self-executing programs. While these innovations offer significant advantages, they also present potential drawbacks if the smart contract code is not carefully designed and implemented. This paper investigates the capability of large language models (LLMs) to detect OWASP-inspired vulnerabilities in smart contracts beyond the Ethereum Virtual Machine (EVM) ecosystem, focusing specifically on Solana and Algorand. Given the lack of labeled datasets for non-EVM platforms, we design a synthetic dataset of annotated smart contract snippets in Rust (for Solana) and PyTeal (for Algorand), structured around a vulnerability taxonomy derived from OWASP. We evaluate LLMs under three configurations: prompt engineering, fine-tuning, and a hybrid of both, comparing their performance on different vulnerability categories. Experimental results show that prompt engineering achieves general robustness, while fine-tuning improves precision and recall on less semantically rich languages such as TEAL. Additionally, we analyze how the architectural differences of Solana and Algorand influence the manifestation and detectability of vulnerabilities, offering platform-specific mappings that highlight limitations in existing security tooling. Our findings suggest that LLM-based approaches are viable for static vulnerability detection in smart contracts, provided domain-specific data and categorization are integrated into training pipelines.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。