一句话:定义 NFT 智能合约中的 5 类缺陷,并提出基于符号执行的检测工具 NFTGuard。
NFT 的高价值使其智能合约成为攻击目标,合约缺陷可能被利用并破坏 NFT 生态的安全与可靠性,但目前缺乏对 NFT 智能合约的系统分析。本文定义 5 类 NFT 智能合约缺陷,每类均以代码示例说明特征、后果及修复方案。作者提出基于符号执行框架的检测工具 NFTGuard:它从合约抽象语法树中提取状态变量信息,以识别符号执行中的变量加载与存储操作;同时从字节码恢复源码级特征,并按预定义检测模式定位和报告缺陷。在 16,527 个真实合约上评估,结果显示 1,331 个合约至少包含一种缺陷,工具总体精确率为 92.6%。
Recently, the birth of non-fungible tokens (NFTs) has attracted great attention. NFTs are capable of representing users’ ownership on the blockchain and have experienced tremendous market sales due to their popularity. Unfortunately, the high value of NFTs also makes them a target for attackers. The defects in NFT smart contracts could be exploited by attackers to harm the security and reliability of the NFT ecosystem. Despite the significance of this issue, there is a lack of systematic work that focuses on analyzing NFT smart contracts, which may raise worries about the security of users’ NFTs. To address this gap, in this paper, we introduce 5 defects in NFT smart contracts. Each defect is defined and illustrated with a code example highlighting its features and consequences, paired with possible solutions to fix it. Furthermore, we propose a tool named NFTGuard to detect our defined defects based on a symbolic execution framework. Specifically, NFTGuard extracts the information of the state variables from the contract abstract syntax tree (AST), which is critical for identifying variable-loading and storing operations during symbolic execution. Furthermore, NFTGuard recovers source-code-level features from the bytecode to effectively locate defects and report them based on predefined detection patterns. We run NFTGuard on 16,527 real-world smart contracts and perform an evaluation based on the manually labeled results. We find that 1,331 contracts contain at least one of the 5 defects, and the overall precision achieved by our tool is 92.6%.