Agentic AI
AI Agents Discover Hundreds of Security Bugs in Rust-to-C Bindings
Researchers deployed large language model agents to audit unsafe interface layers between Rust and C libraries, uncovering 284 bugs including undefined-behavior vulnerabilities across popular crates.
Researchers from arXiv cs.SE have shown that large language model agents can effectively discover critical soundness bugs in Rust bindings to C and C++ libraries—flaws that allow undefined behavior to slip past safety checks in otherwise "safe" code.
The Problem: Safe Facades Over Unsafe Code#
Rust code that calls into C, C++, or makes system calls must wrap those inherently unsafe operations behind type-safe interfaces. When these wrappers fail to properly enforce Rust's invariants, a developer writing entirely safe Rust can inadvertently trigger undefined behavior. Traditional tools like static analyzers and fuzzers examine only fixed patterns or specific execution paths, leaving gaps.
Mapping the Defects#
The researchers first constructed a taxonomy of three defect classes in such interfaces:
- Undefined-behavior bugs – flaws that allow memory safety violations
- Behavioral divergences – ways the wrapper deviates from the underlying library
- Incomplete unsafe contracts – missing or underspecified safety requirements
Testing Two Models Against Real Code#
The team audited a real-world crate using Claude Opus 5.5 (closed-source) and DeepSeek V4.1 Flash (open-source), measuring how well each identified defects, ranked them, and guided investigation. Key findings:
- Agents discovered the first two defect classes without prompting
- Incomplete contracts were rarely found, even when explicitly requested
- Nearly all reported bugs proved genuine, without requiring external validation
- Both models lacked follow-up discipline: they rarely verified findings with memory sanitizers and tended to stop searching too early
- The open-source model matched the closed model's bug count at roughly one-quarter the cost
Real-World Impact at Scale#
Researchers integrated these insights into Crustify, an automated system for C-to-Rust auditing. Running across 16 widely deployed crates—including bindings to OpenSSL, SQLite, libgit2, libcurl, and the V8 JavaScript engine—Crustify uncovered:

