Agentic Discovery of Soundness Bugs in Safe Rust Bindings
Abstract
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.
Create a lesson
Metadata
- Categories
- cs.CR, cs.AI, cs.PL, cs.SE
Related papers
SwarmLeak: Does Coordination Improve Privacy Attacks on LLM Agents?
Shared title terminologycs.CRAsma Farajidizaji, Vyas Raina, Vatsal Raina et al.
Evaluating LLM Security Review Agents with Operationally Sourced Ground Truth
Shared title terminologycs.CRMudita Khurana, Karim Liman-Tinguiri
Where Agent Defenses Fail: A Case Study of Policy Compositions and Measurement Limits
Shared title terminologycs.CRKunwar Singh Sangram, Krishna Mohan Guda Nagavenkata Srinivasa
Scoring Recovery-Time Agent Security: Proposals, Effects, and Retry Instructions
Shared title terminologycs.CRPaul Deepakraj Retinraj
Airlock: Robust Sandboxing and Governance of Rogue Agents
Shared title terminologycs.CRSina Abdollahi, Amir Al Sadi, Marios Kogias et al.
Carried-Over and Agent-Native Threats in the Supply Chain of LLM Agent Skills
Shared title terminologycs.CRKaixuan Li, Wenbo Guo, Sen Chen et al.