LLM 智能体审计 Rust 安全绑定,Crustify 在 16 个常用 crate 中发现 225 个未定义行为 bug
Agentic Discovery of Soundness Bugs in Safe Rust Bindings
研究人员用 LLM 智能体给 Rust 绑定做安全审计,Crustify 在 SQLite、OpenSSL、V8 这些大家天天用的库的绑定里挖出 225 个未定义行为 bug,维护者已经修了 26 个。有意思的是开源模型 DeepSeek V4.1 Flash 用四分之一成本就追平 Claude Opus 5.5。写 Rust 或做 C 迁移的都该看看。
arXiv 论文研究用 LLM 智能体审计 Rust crate 的安全接口缺陷,即 unsafe 代码被包装后可能暴露的未定义行为。作者提出了缺陷分类法,涵盖未定义行为、与被包装库的行为分歧、不完整 unsafe 契约三类,并在真实 crate 上反复对比 Claude Opus 5.5 与 DeepSeek V4.1 Flash 两个模型的审计表现。结果显示智能体能自发发现前两类缺陷且报告几乎都为真,但验证纪律差,很少用 sanitizer 确认,也几乎找不到不完整契约;在相同引导下开源模型以四分之一成本达到闭源模型的发现量。
作者将结论集成进 Crustify 系统并规模化运行:在 OpenSSL、SQLite、libgit2、libcurl 的绑定及 C++ 引擎 V8 等 16 个广泛使用的 crate 中,共发现 225 个未定义行为 bug、23 处行为分歧和 36 个不完整 unsafe 契约,每个 crate 介于 3 到 61 个,单次审计成本中位数低于 50 美元。在 Linux 内核的 Rust 抽象层中又发现 11 个未定义行为 bug 和 4 个不完整契约。
在被报告的 83 个发现中,维护者已修复 26 个。相比传统静态分析器和 fuzzing 固定模式与有限路径的局限,这种方法能覆盖更广的接口规则违规,对维护 Rust 绑定的开发者和 C-to-Rust 迁移项目有直接参考价值。
Agentic Discovery of Soundness Bugs in Safe Rust Bindings
Rust crates confine unsafe code, such as calls into C or C++ libraries or system calls, behind safe interfaces that must uphold Rust's invariants. If an interface encodes one rule of the code beneath it too weakly, a program written in purely safe Rust can cause undefined behavior. Static analyzers and fuzzers are bound to fixed patterns or to the paths they execute. We propose LLM agents as auditors of these interfaces, and study how well they do it. We first define a taxonomy of the defects of such interfaces, including undefined behavior, divergences from the wrapped library, and incomplete unsafe contracts. We then measure, in repeated audits of a real-world crate by a closed and an open model, Claude Opus 5.5 and DeepSeek V4.1 Flash, which defect classes agents find, how well they triage them, and what makes them find more. Agents find the first two classes unprompted, but find few incomplete contracts even when asked. Their findings are almost always real, even without an independent reviewer, yet they lack triage discipline: they seldom confirm with a sanitizer, and they stop early. With the same guidance, the open model finds as many defects as the closed one at a quarter of the cost. We integrate these insights in Crustify, an agentic system for automating C-to-Rust tasks, and run it at scale. In 16 widely used crates, including the bindings to the C libraries OpenSSL, SQLite, libgit2, and libcurl and to the C++ engine V8, Crustify found 225 undefined-behavior bugs, 23 behavioral divergences, and 36 incomplete unsafe contracts, between 3 and 61 per crate at a median cost under $50 per audit. In the Linux kernel's Rust abstractions, it found 11 more undefined-behavior bugs and 4 incomplete contracts. Maintainers have fixed 26 of the 83 findings that we reported.
This report is categorized under AITOP's "Papers" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include Rust, Crustify, Claude Opus 5.5, DeepSeek V4.1 Flash.
Source attribution: curated from arXiv cs.AI (@Marius Momeu, Koushik Sen).