With the rapid advancement of decentralized applications, smart contract security faces severe challenges, particularly regarding atomicity violations in complex logic such as Oracle and NFT contracts. Rigid rule sets often limit traditional static analyzers and lack deep contextual awareness, leading to high false-positive and false-negative rates when identifying vulnerabilities that depend on intermediate state inconsistencies. To address these limitations, this paper proposes PSR\textsuperscript{2}, a novel collaborative static analysis framework that integrates structural path searching with deterministic semantic reasoning. PSR\textsuperscript{2} utilizes a Graph Structure Analysis Module (GSAM) to identify suspicious execution sequences in control flow graphs and a Semantic Context Analysis Module (SCAM) to extract data dependencies and state facts from abstract syntax trees. A Fusion Decision Module (FDM) then performs formal cross validation to confirm vulnerabilities based on a unified atomicity inconsistency model. Experimental results on 1,600 contract samples demonstrate that PSR\textsuperscript{2} significantly outperforms pattern-matching baselines, achieving an F1-score of 94.69\% in complex ERC-721 scenarios compared to 51.86\% for existing tools. Ablation studies further confirm that our fusion logic effectively reduces the false-positive rate by nearly half compared to single module analysis.
翻译:摘要:随着去中心化应用的快速发展,智能合约安全面临严峻挑战,尤其是在预言机和NFT合约等复杂逻辑中的原子性违规问题。传统静态分析工具受限于僵化的规则集,且缺乏深层上下文感知能力,导致在识别依赖于中间状态不一致的漏洞时存在高误报率和漏报率。为解决这些局限性,本文提出PSR²,一种协同静态分析框架,通过融合结构路径搜索与确定性语义推理实现创新。PSR²利用图结构分析模块(GSAM)识别控制流图中的可疑执行序列,并通过语义上下文分析模块(SCAM)从抽象语法树中提取数据依赖与状态事实。融合决策模块(FDM)基于统一原子性不一致性模型执行形式化交叉验证,以确认漏洞。在1600个合约样本上的实验结果表明,PSR²显著优于基于模式匹配的基线方法:在复杂ERC-721场景中,其F1分数达94.69%,而现有工具仅为51.86%。消融研究进一步证实,与单一模块分析相比,我们的融合逻辑可将误报率降低近一半。