TRANSMISSION // 2611.31813v1
AI Agents Audit Rust’s Unsafe Boundaries
Source published
In one-crate tests, audit rules improved the share of AI findings backed by evidence, not discovery. A wider campaign found confirmed flaws, but its counts are not a measure of all bugs.

Rust’s safety guarantees can depend on wrappers that connect Rust code to C and C++ libraries. A preprint tests whether AI coding agents can find flaws in those specific interfaces, and what helps them document their findings.
Rust is designed to prevent memory-safety errors in ordinary, safe code. But Rust programs often rely on wrappers around C or C++ libraries and operating-system interfaces. These wrappers must translate rules that the compiler cannot check—for example, when a library frees data—into Rust’s safety guarantees. If a wrapper gets a rule wrong, safe Rust code may trigger undefined behavior, such as reading freed memory. The issue is in the particular interface, not a general failure of Rust’s safety model.
In Agentic Discovery of Soundness Bugs in Safe Rust Bindings, Marius Momeu and Koushik Sen ask whether AI coding agents can find such flaws by inspecting both sides of the boundary and writing programs to demonstrate them. They also study which defects agents notice, how they support their claims, and how guidance changes their results.
Repeated audits of one crate
The controlled study used git2, a Rust binding to the C library libgit2. The authors ran repeated audits with the open model DeepSeek V4.1 Flash and the closed model Claude Opus 5.5. Agents could inspect code and documentation, run programs, and use tools such as sanitizers, which detect certain errors during execution. They could also access the internet, including issue trackers—a choice that matters when distinguishing discovery from retrieval.
Across 24 audits, the researchers varied the guidance: what defect classes to examine, how to document findings, and how many findings to target. A model judge scored the reports. Two agents reran a sample of reproductions on clean checkouts; of 33 sampled findings with runnable programs, one did not reproduce. A second model scored a sample too. Since there is no complete list of every defect in the crate, the study cannot measure recall. Instead, it counts distinct defects not already public upstream as a rougher indicator of discovery.
The agents found real problems involving undefined behavior and differences between the wrapper and the underlying library. Of 838 submitted findings, the primary judge rated one false; nine were unclear. Other findings repeated root causes, were minor, or lacked the evidence required by the study’s rules. Agents looked for memory-safety and behavior problems without prompting. They also filed few findings about incomplete contracts for unsafe functions. When prompted to examine contracts, they filed some, but the primary judge rated most as minor; a second scorer disagreed substantially about these findings, so this result is uncertain.
A plausible bug report is not necessarily a report a maintainer can verify. Without explicit triage rules—one root cause per finding, stored evidence, and claims limited to what that evidence shows—17% to 51% of findings met the study’s standard. With the rules, 74% to 81% did. But triage guidance did not increase discovery. A target number of findings increased discovery for the open model in this experiment, not for the closed model. With the full guidance, the two models found similar numbers of previously unpublicized defects per audit; the open model’s cost per such defect was about a quarter of the closed model’s. This comparison is limited to this crate, these runs, and this setup. Repeated audits often found different defects.
The primary judge was Claude Fable 5.2; the second scorer was Claude Opus 5.5, the closed model being studied. Both came from the same vendor, and no person graded the findings. The judge assessed reports by reading them rather than running the programs, which limits confidence in the scoring.
Findings across more projects
The authors incorporated their lessons into Crustify and audited 16 widely used crates, including bindings for OpenSSL, SQLite, libgit2, libcurl, and V8. They report 284 distinct confirmed findings: 225 instances of undefined behavior, 36 incomplete unsafe-function contracts, and 23 behavioral divergences. The authors say 26 findings were already known upstream or fixed in the wrapped library, so they were not reported. They reported 83 findings to maintainers; 26 fixes credited to their reports had landed at the time of writing, and another 30 findings had been fixed independently upstream.
A separate, single audit of Rust abstractions in the Linux kernel found 11 instances of undefined behavior and four incomplete contracts. The authors had not yet reported these findings and cannot assess how repeatable the result is. They also say none was shown to be reachable from user space.
These counts describe what the audits found, not how many bugs the projects contain. A reproducer demonstrates a problem only on the execution it runs, and instruments detect only the violations they check. Some aliasing violations across the Rust–C boundary require BorrowSanitizer and a statically linked foreign library built with that tool. Most findings also require a program that misuses an API in a particular way; a soundness bug is not automatically an exploitable vulnerability.
The controlled study covers one crate at one revision, with three runs per guidance setup. Its prompt was developed using that same crate. Agents’ access to issue trackers means some findings may repeat public reports. The authors did not compare Crustify with static analyzers or fuzzers on the same revisions; such a comparison could show what each approach finds that the others miss.
This is an arXiv preprint, not evidence here of peer-reviewed validation. The results suggest that agents can help investigate Rust interfaces to lower-level code, especially when asked to support findings with evidence. They do not show that agents replace expert review, testing, or other bug-finding tools.
- Rust
- AI coding agents
- software security
- memory safety
- FFI
- C and C++ bindings
Related reading
Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.
Can LLMs Find Vulnerabilities for the Right Reasons?
Source published
Shared keywords: software security
When an AI agent’s approved tool call isn’t the one that runs
Source published
Shared keywords: software security
A Coding Agent Learns from Its Own Failed Fixes
Source published
Shared keywords: ai coding agents
Why AI coding agents struggle to clean up old code
Source published
Shared keywords: ai coding agents
A paper trail for AI-assisted data cleaning
Source published
Shared keywords: ai coding agents