Skip to content
#software testing Open access

LLM-Assisted Porting of Security-Critical C Libraries to Idiomatic Rust: A Multi-Model Empirical Study

Sep 2026 · Future Internet · 0 citations · 12 references

TL;DR

Differential fuzzing reveals complementary bugs in the manual and LLM porting of security-critical C libraries to idiomatic Rust and translates these findings into concrete practical guidance for teams planning a similar migration.

Abstract

Memory-safety vulnerabilities remain the dominant class of security defects in C/C++ software underpinning Internet infrastructure. Rust offers a structural solution through its ownership system, yet migrating existing codebases remains costly. This paper defines a structured methodology for LLM-assisted porting of security-critical C libraries to idiomatic Rust and applies it to cJSON (∼3200 LOC, 14 CVEs). A manual expert porting serves as the baseline; five LLMs (Claude Opus 4.6, Gemini 3 Pro, GPT-5.4, Kimi K2.7-Code, and Qwen3.5-27B) produce independent portings in agentic mode. Verification uses an end-to-end pipeline: CVE-specific tests, coverage-guided and differential fuzzing (>1.7 billion executions), Miri analysis, and comparative benchmarking. All six portings eliminate all in-scope CVE classes by construction, with zero unsafe blocks and zero memory-safety crashes. In this case study, structural safety holds consistently across all five evaluated models and across all five Kimi repetitions, whereas code quality varies widely (0–9 residual bugs). Because only Kimi was repeated (N=5), its variance bounds run-to-run noise at the 95% confidence level, against which some but not all between-model differences are distinguishable from chance; a single porting attempt costs approximately $3 in API usage. Differential fuzzing reveals complementary bugs in the manual and LLM portings, supporting a hybrid workflow, and we translate these findings into concrete practical guidance for teams planning a similar migration. These results are scoped to one compact, single-threaded C library. The entire codebase and evaluation pipeline are publicly released.

Read PDF

Similar papers

Preprint Sep 2026

C-to-Rust Fallacy: Automatic Refactoring != Memory Security

Rust has emerged as the leading system programming language, offering strong memory and type safety guarantees without compromising performance. This positions it as a compelling alternative to traditional languages like C and C++, which are susceptible to memory security bugs. However, manually transforming C to Rust...

Hung-Mao Chen, Xu He, Bo Lu et al. · 0 citations
Review Aug 2026

Rust for Secure Backend Development: A Critical Review and Extended Vulnerability Comparison with Node.js and Django

Results indicate that Rust's compile-time guarantees dominate at the systems layer, while managed backend frameworks offer stronger built-in defenses at the application layer, suggesting that Rust adoption in web contexts requires complementary safeguards rather than reliance on language-level safety alone.

Md Zarzees Uddin Shah Chowdhury, Rabib Jahin Ibn Momin, Rifat Shahriyar · 0 citations
Preprint Aug 2026

IaC-Guard-V: A Verification Framework for LLM-Generated Infrastructure-as-Code Repairs

Infrastructure-as-Code (IaC) misconfigurations are a leading cause of cloud security incidents, and Large Language Models (LLMs) are increasingly proposed as automated repair agents. Yet the trustworthiness of LLM-generated IaC repairs remains underexplored. IaC presents distinctive verification challenges: security sc...

Lokesh Chauhan · 0 citations
Review Open access 2026

Security Analysis of LLM-Generated Web API Backends

A security assessment on 75 FastAPI backends generated by three contemporary LLMs revealed a disconnect between functional correctness and secure logic, which is interpreted as a review-risk pattern, which is called the human-in-the-loop paradox.

Abdul Ali Khan, S. Rauti, T. Mäkilä · 0 citations

Related blog posts

Microsoft Research Blog Oct 30, 2026

From synthetic enterprise data evaluations to real Microsoft Copilot AI confidence

Evaluating Microsoft Copilot at enterprise scale requires test data that captures the full complexity of real organizations, yet real enterprise data contains sensitive information that cannot be used for evaluation under any circumstances. The post From synthetic enterprise data evaluations to real Microsoft Copilot AI confidence appeared first on Microsoft Research.

Microsoft Research Blog Oct 29, 2026

Microsoft Research Focus – Edition #97

Host Sowbhagya Suresh shares some of the latest news and cutting-edge research from across Microsoft—from understanding the challenges facing coding agents to uncovering how people use AI at work and improving extended-range weather forecasting. The post Microsoft Research Focus – Edition #97 appeared first on Microsoft Research.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.