研究了一套专门针对 NFT 合约的漏洞检测方法,用 DeepSeek 加代码切片把准确率干到了 97.1%,比纯分析完整合约高了 23 个百分点。做合约安全的可以看看。
该论文提出一种结合漏洞聚焦代码切片、ERC-721 知识库和约束 DeepSeek 的 NFT 智能合约漏洞检测方法。在 450 个 NFT 合约样本上,完整配置的检测器给出了 437 个正标签,正标签率达到 97.1%。去除外部知识库后,正标签率降至 87.11%;进一步去除代码切片,正标签率降至 73.78%。结果表明,聚焦代码上下文和领域约束显著影响检测效果。
Ethereum NFT Smart Contracts: Knowledge-Guided Vulnerability Detection with LLM and Code Slicing
Ethereum non-fungible tokens (NFTs) implement ownership, transfer, authorization, and metadata operations through smart contracts, making contract vulnerabilities a direct risk to digital assets. Existing static analyzers provide efficient rule-based screening but can struggle with application-specific logic, whereas unconstrained large language model analysis may be distracted by irrelevant code or produce inconsistent outputs. We present a vulnerability-detection method that combines vulnerability-focused code slicing, an ERC-721-oriented knowledge base, and constrained DeepSeek analysis. Regular-expression patterns locate candidate statements for reentrancy, integer overflow or underflow, and timestamp dependence. A structure-aware context-window algorithm then extracts line-numbered code slices. DeepSeek analyzes each slice using explicit decision rules and a fixed output schema, and the resulting records support automated batch processing. On 450 NFT contract samples, the full configuration produced 437 positive labels, corresponding to a reported positive-label rate of 97.1%. Removing the external knowledge base reduced this rate to 87.11%, while analyzing complete contracts without the knowledge base reduced it to 73.78%. These results indicate that focused code context and domain constraints materially affect the detector's reported output.