Definition and Detection of Defects in NFT Smart Contracts
Authors:
Open Access
- 12 July 2023
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 373-384
Abstract
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%.Keywords
All Related Versions
Funding Information
- National Key R&D Program of China (2022YFB2702203)
- National Natural Science Foundation of China (No. 62032025)
- Technology Program of Guangzhou, China (No. 202103050004)
This publication has 22 references indexed in Scilit:
- Securify2018
- ContractFuzzer: fuzzing smart contracts for vulnerability detection2018
- ReGuard2018
- Blockchain challenges and opportunities: a surveyInternational Journal of Web and Grid Services, 2018
- ZEUS: Analyzing Safety of Smart Contracts2018
- An Overview of Blockchain Technology: Architecture, Consensus, and Future Trends2017
- Making Smart Contracts Smarter2016
- Sailfish2012
- Z3: An Efficient SMT Solver2008
- Formalizing and Securing Relationships on Public NetworksFirst Monday, 1997