NATLM:利用大语言模型检测NFT智能合约中的缺陷
NATLM: Detecting Defects in NFT Smart Contracts Leveraging LLM
AI总结:
NATLM利用大语言模型和静态分析检测NFT智能合约中的四种常见漏洞,实验结果显示高精度和召回率。
摘要:
随着非同质化代币(NFT)的快速演变,安全问题变得越来越重要。由于NFT作为数字资产进行交易,它们已成为网络攻击者的主要目标。在NFT智能合约的开发过程中,可能存在未被发现的缺陷,如果被利用,可能导致重大经济损失。为了解决这一问题,本文提出了一种名为NATLM(NFT助手LLM)的框架,旨在检测NFT智能合约中的潜在缺陷。该框架有效识别了NFT智能合约中四种常见的漏洞类型:ERC-721重入、公共销毁、高风险可变代理和无限铸造。仅依靠大语言模型(LLM)进行缺陷检测可能导致较高的误报率。为了提高检测性能,NATLM集成了静态分析与LLM,具体使用Gemini Pro 1.5。最初,NATLM利用静态分析从代码中提取结构、语法和执行流程信息,通过抽象语法树(AST)和控制流图(CFG)表示。这些提取的特征随后与已知缺陷示例的向量结合,形成输入知识库的矩阵。接着,分析合约的特征向量和代码向量与知识库内容进行比较。最后,LLM进行深度语义分析以增强检测能力,提供更全面和准确的潜在安全问题识别。实验结果表明,NATLM分析了8672个收集的NFT智能合约,达到了整体精度87.72%、召回率89.58%、F1分数88.94%。结果优于其他基线实验,成功识别了四种常见类型的缺陷。
英文摘要:
Security issues are becoming increasingly significant with the rapid evolution of Non-fungible Tokens (NFTs). As NFTs are traded as digital assets, they have emerged as prime targets for cyber attackers. In the development of NFT smart contracts, there may exist undiscovered defects that could lead to substantial financial losses if exploited. To tackle this issue, this paper presents a framework called NATLM(NFT Assistant LLM), designed to detect potential defects in NFT smart contracts. The framework effectively identifies four common types of vulnerabilities in NFT smart contracts: ERC-721 Reentrancy, Public Burn, Risky Mutable Proxy, and Unlimited Minting. Relying exclusively on large language models (LLMs) for defect detection can lead to a high false-positive rate. To enhance detection performance, NATLM integrates static analysis with LLMs, specifically Gemini Pro 1.5. Initially, NATLM employs static analysis to extract structural, syntactic, and execution flow information from the code, represented through Abstract Syntax Trees (AST) and Control Flow Graphs (CFG). These extracted features are then combined with vectors of known defect examples to create a matrix for input into the knowledge base. Subsequently, the feature vectors and code vectors of the analyzed contract are compared with the contents of the knowledge base. Finally, the LLM performs deep semantic analysis to enhance detection capabilities, providing a more comprehensive and accurate identification of potential security issues. Experimental results indicate that NATLM analyzed 8,672 collected NFT smart contracts, achieving an overall precision of 87.72%, a recall of 89.58%, and an F1 score of 88.94%. The results outperform other baseline experiments, successfully identifying four common types of defects.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。