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.
翻译:随着去中心化应用的快速发展,智能合约安全面临严峻挑战,尤其是Oracle和NFT合约等复杂逻辑中原子性违例问题。传统静态分析工具受限于僵化的规则集,缺乏深层上下文感知能力,导致在识别依赖中间状态不一致的漏洞时存在较高的误报率和漏报率。为解决上述局限性,本文提出PSR\textsuperscript{2}——一种新型协同静态分析框架,将结构化路径搜索与确定性语义推理相结合。PSR\textsuperscript{2}利用图结构分析模块(GSAM)识别控制流图中的可疑执行序列,并通过语义上下文分析模块(SCAM)从抽象语法树中提取数据依赖与状态事实。融合决策模块(FDM)基于统一原子性不一致性模型执行形式化交叉验证,最终确认漏洞。在1,600个合约样本上的实验结果表明,PSR\textsuperscript{2}显著优于模式匹配基线方法:针对复杂ERC-721场景,其F1分数达94.69%,而现有工具仅为51.86%。消融研究进一步证实,相较于单一模块分析,我们的融合逻辑可将误报率降低近一半。