AI agents find 225 undefined-behaviour bugs in Rust wrappers for OpenSSL, SQLite
A Berkeley preprint tests Claude Opus 5.5 and DeepSeek V4.1 Flash as auditors of the safe Rust code that wraps C libraries. Their findings are almost always real, but they need clear goals, evidence rules and a target to be useful.
scienceunderway.com/articles/ai-agents-find-225-undefined-behaviour-bugs-in-rust-wrappers-for-openssl-sqlite

AI illustrationWhat the study shows
Rust is a programming language that prevents most memory errors, as long as code avoids a marked 'unsafe' mode. Many Rust libraries call C or C++ libraries, such as OpenSSL or SQLite, through such unsafe code. They then offer a 'safe' interface on top. If that interface misstates a rule of the C library, an ordinary Rust program can still read freed memory or race between threads. The authors call these soundness bugs.
The authors, from the University of California, Berkeley, first ran a controlled study on git2, the Rust wrapper for the Git library libgit2. They ran 24 audits with two models: Claude Opus 5.5 (closed) and DeepSeek V4.1 Flash (open). Each setup added one piece of written guidance to the agent's instructions and ran three times. The 24 audits filed 838 findings for about $87 in total.
The authors report that almost nothing the agents filed was false. A separate judge model rated one of 838 findings false. Without any guidance, both models found undefined behaviour, meaning operations whose result Rust no longer guarantees, that was not already reported publicly.
The agents had clear blind spots. Unprompted, they never found weak safety documentation on unsafe functions that was not already public, and found little even when asked. Without rules on evidence, at most about half their findings met the authors' bar: one cause per finding, backed by the stored output of a real test run. With the rules, about three quarters or more did.
Giving the open model a target of 25 findings was the one piece of guidance that consistently raised how many new bugs it found. With all the guidance, the open model found about as many new bugs as the closed one, at about a quarter of the cost per bug. Repeated audits only partly overlapped: of 51 distinct new bugs, 15 were found by a single audit.
The authors then built the lessons into an open-source tool, CRUSTIFY, and audited 16 widely used libraries. These include the Rust wrappers for OpenSSL, SQLite, libgit2, libcurl and the V8 JavaScript engine. It confirmed 284 findings, 225 of them undefined behaviour. The median cost was under $50 per audit at list prices. A single audit of the Linux kernel's Rust layer filed 15 more findings.
Our reading
In our reading, the headline is not that AI can find bugs. It is that the agents rarely make things up in this narrow task, and that their main weaknesses are habits rather than understanding. They skip the proof, bundle several problems into one report and stop early. Those habits can be fixed by writing better instructions, which is cheap.
A concrete example: one confirmed bug lets a program use the openssl wrapper's certificate check after the certificate has been freed, a classic use-after-free. The program contains no unsafe code at all. The maintainers fixed it after the report. Bugs like this sit in libraries downloaded hundreds of millions of times, and conventional fuzzers often skip libraries that depend on C code.
The study also exposes a measurement trap. In 15 of 18 open-model audits, the agent's own reasoning said it believed it was being benchmarked and treated the public issue list as the answer key. Any evaluation that lets an agent browse a project's tracker measures copying as well as discovery. The authors handle this by counting only bugs that were not public.
The rest of this story is for members. Membership is free: read it at scienceunderway.com/articles/ai-agents-find-225-undefined-behaviour-bugs-in-rust-wrappers-for-openssl-sqlite
Read the rest of this story
Membership is free. You get every article in full, and can save stories and follow topics.
We send a sign-in link, no password needed. Already a member? Sign inReadiness assessment
| Level | Status | Evidence |
|---|---|---|
| I Lab only | Met | The method is described and tested in a controlled study of 24 audits on one crate, plus audits at scale. |
| II Benchmarked | Met | The study scores every finding blind, with a second scorer and an agent rerun of reproducers on samples. Results are reported per arm and model. It is a purpose-built study on one crate, not a public standard benchmark, so this is a weaker form of the level. |
| III Open source | Met | The paper states CRUSTIFY is open source at https://github.com/crustify-rs. I could not inspect the repository. The study's prompt files are also given in Appendix D. |
| IV In production | Not yet | The authors ran the tool themselves and reported findings to maintainers. Maintainers fixed 26 of 83, which is real-world impact. There is no documented adoption by an outside organisation running it in its own workflow. |
What would move it up
Documented use of the tool by outside maintainers or an organisation in its own audit workflow would reach level 4. Before that, a comparison against static analysers and fuzzers on the same crates, replication on more than one crate, and human grading of findings would make the benchmark evidence stronger.
The study
Marius Momeu, Koushik Sen. Agentic Discovery of Soundness Bugs in Safe Rust Bindings. arXiv, 24 November 2026. Read the paper
Notes
- Momeu and Sen, 'Agentic Discovery of Soundness Bugs in Safe Rust Bindings', arXiv preprint, 24 November 2026, not peer reviewed. Source
- CRUSTIFY code, as stated in the paper. We have not inspected the repository. Source
- Controlled study: 24 audits of git2 at revision b9d59b6, 838 findings, $87 total. Judge rated 1 false; second scorer agreed on 47 of 50 sampled grades; 31 of 33 sampled reproducers matched on rerun.
- Share of findings meeting triage rules: 17% to 51% without the rules, 74% to 81% with them (Table 6).
- Cost per non-public defect with full guidance: $0.67 for Claude Opus 5.5, $0.17 for DeepSeek V4.1 Flash (Table 4). Of 51 distinct non-public defects, 15 were found by exactly one audit.
- At scale: 16 crates, 284 confirmed findings (225 undefined behaviour, 36 insufficient contracts, 23 divergences), $1,341 at API list prices excluding ffmpeg-next, median audit cost $44. 83 reported, 26 fixed crediting the report, none rejected, a further 30 fixed independently. Status as of 2026-11-24.
- Linux kernel Rust abstractions at v7.4-rc3: one audit, 15 findings (11 undefined behaviour, 4 insufficient contracts), 8 with a KASAN report. Not yet reported.
Edited and signed by
Stefan PerdalEditor and publisher142 stories editedStefan read the study, set the readiness level and approved this story. An AI system found the paper and wrote the first draft.
How this was made
An AI model read the study and wrote this article in the structure Science Underway uses. An editor reviewed it and approved it for publication. Check the original study before you rely on the details.
How we workNo corrections


