paperbot · PL 论文追踪

全部论文 待读 收藏

SafeDep: Detecting State Mutation Unsoundness in Rust via Dependency Slicing and LLM Reasoning

SafeDep:通过依赖切片与 LLM 推理检测 Rust 中的状态变更不健全性
ASE Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering2026引用 0 inbox
Zihao Rao, Yilin Chen, Chengjun Chen, Hui Xu
crossref: 2026-10-09

AI 速览

一句话:提出 SafeDep,结合 MIR 依赖切片与 LLM 推理检测 Rust 跨方法状态变更不健全漏洞。

Rust 的安全代码依赖内部 unsafe 操作,其正确性建立在内存与逻辑不变量之上。在基于 struct 的抽象中,兄弟方法可能合法修改内部字段,却破坏另一方法 unsafe 操作所需的前置条件,论文称之为 unsound state mutation。传统模式静态分析虽支持过程间跟踪,却难以建模跨方法状态干扰,也无法理解自然语言安全契约;LLM 虽能推理契约,但整 crate 提示昂贵且易产生幻觉路径。SafeDep 分析 Rust MIR 构建字段敏感的读写依赖图,切片保留可能影响安全关键状态的方法,再由 LLM 在紧凑上下文中重建跨方法状态转移并生成 PoC 候选,最后通过有界编译器/Miri 反馈循环精化候选与可利用性判断,再进行人工审计。在评测数据集上,SafeDep 优于静态与 LLM 基线并减少提示上下文;扫描 crates.io 前 4,000 个项目发现 24 个此前未报告的健全性漏洞,其中 18 个已被维护者确认或接受为 RustSec 公告。

问题
Rust 中 struct 抽象的内部 unsafe 操作依赖内存与逻辑不变量,兄弟方法可能在合法修改字段时破坏另一方法 unsafe 操作的前置条件,形成 unsound state mutation;传统静态分析和 LLM 都难以有效检测这类跨方法、依赖自然语言安全契约的深层缺陷。
方法
SafeDep 基于 Rust MIR 构建字段敏感的读写依赖图,切片保留可能影响安全关键状态的方法,再由 LLM 在紧凑上下文中重建跨方法状态转移并生成 PoC 候选,最后用有界编译器/Miri 反馈循环精化候选与可利用性判断。
评估
在评测数据集上与静态和 LLM 基线比较,SafeDep 性能更优且提示上下文更小;对 crates.io 前 4,000 个项目的扫描发现 24 个此前未报告的健全性漏洞,其中 18 个获维护者确认或成为 RustSec 公告。
原文摘要(Abstract)

Rust's type system protects safe code, but many low-level abstractions depend on internal unsafe operations whose correctness rests on memory and logical invariants. In struct-based abstractions, a sibling method may legally modify internal fields while invalidating a precondition required by another method's unsafe operation. We call this defect an unsound state mutation. Traditional pattern-based static analyzers support inter-procedural tracking but may lack the capability to model cross-method state interference. Furthermore, they cannot interpret natural-language safety contracts, making these deep defects difficult to detect. LLMs can reason about these contracts, but whole-crate prompting is expensive and often prone to hallucinated paths. To bridge this gap, we present SafeDep, a vulnerability discovery framework that combines compiler-driven static analysis with LLM-based semantic reasoning. SafeDep analyzes Rust MIR to build a field-sensitive read/write dependency graph and slices the graph to retain methods that may affect safety-critical state. An LLM then reconstructs cross-method state transitions from this compact context and generates PoC candidates. A bounded compiler/Miri feedback loop refines the candidates and their exploitability judgments before manual audit. On our evaluation dataset, SafeDep outperforms static and LLM baselines while reducing prompt context. A scan of the top 4,000 crates.io projects found 24 previously unreported soundness vulnerabilities, 18 of which had been confirmed by maintainers or accepted as RustSec advisories at the time of writing.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot12495,
  title = {SafeDep: Detecting State Mutation Unsoundness in Rust via Dependency Slicing and LLM Reasoning},
  author = {Zihao Rao and Yilin Chen and Chengjun Chen and Hui Xu},
  booktitle = {ASE},
  year = {2026},
  doi = {10.1145/3832783.3837481}
}