NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Agentic Discovery of Soundness Bugs in Safe Rust Bindings

Marius Momeu, Koushik Sen

Abstract

Rust crates confine unsafe calls into C and C++ code behind safe interfaces that must uphold Rust's invariants. If an interface encodes a rule of the code beneath it too weakly, a program in purely safe Rust can cause undefined behavior. Static analyzers, bound to fixed patterns, and fuzzers, bound to the paths they execute, often miss such bugs. We propose LLM agents as auditors of these interfaces, and study how well they do it. We classify these defects and measure, in repeated audits of two crates by a closed and an open model, Claude Opus 5.5 and DeepSeek V4.1 Flash, what agents find, how well they triage, and what makes them find more. Agents find undefined behavior and divergences from the wrapped library unprompted, but look at unsafe contracts only when asked; their findings are almost always real, yet they seldom confirm them with a sanitizer and stop early. With the same guidance, the open model finds as many defects as the closed one at a quarter of the cost, and where few defects are left, a target for the number of findings that cannot be met makes neither fabricate findings. We build these insights into the audit agent of Crustify, an agentic system for C-to-Rust tasks, and run it on 16 widely used bindings to C and C++ libraries, such as OpenSSL, SQLite, libgit2, and V8, on three crates that use them, such as cargo, and on the Rust abstractions of the Linux kernel. It found 213 undefined-behavior bugs, 33 incomplete contracts, and 23 divergences in the crates, at a median cost under $50 per audit, and 11 undefined-behavior bugs in the kernel. Maintainers have fixed 24 of the 78 findings that we reported.
BibTeX
@misc{momeu2026agentic,
  author = {Marius Momeu and Koushik Sen},
  title = {{Agentic Discovery of Soundness Bugs in Safe Rust Bindings}},
  year = {2026},
  eprint = {2611.31813},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.31813},
}
Figure