AI Converts C to Rust for Enhanced Software Safety

▼ Summary
– AI tools threaten to exploit widespread software bugs but could also be used to fix them by automatically converting vulnerable C/C++ code into the memory-safe language Rust.
– The Great Refactor initiative proposes using AI to translate 100 million lines of critical open-source code into Rust by 2030, aiming to eliminate a large class of vulnerabilities in one effort.
– Rust is designed to match the performance of C/C++ while preventing memory-safety exploits, which account for an estimated 70% of software vulnerabilities.
– While AI tools can now reliably translate small codebases, challenges include ensuring the resulting Rust code is maintainable and securing funding for the large-scale project.
– The initiative builds on projects like DARPA’s TRACTOR program, which explores mixing AI with classical code analysis for translation, but success depends on overcoming technical and adoption hurdles.
The digital world’s foundational software often rests on a fragile base of legacy code, creating persistent security risks. A new initiative proposes using artificial intelligence to fundamentally strengthen this foundation by automatically converting vulnerable C and C++ code into the memory-safe programming language Rust. This ambitious effort, known as the Great Refactor, seeks to leverage AI’s growing coding prowess to eliminate entire categories of software bugs at their source, potentially preventing billions in damages from cyberattacks.
Memory safety vulnerabilities arise when software improperly accesses computer memory, a common flaw in languages like C and C++ that grant developers direct, manual control. While newer languages build in protections, they often sacrifice the raw performance required for critical systems. Rust is uniquely designed to provide both high performance and memory safety, preventing an estimated 70 percent of all software vulnerabilities that stem from these memory issues. However, manually rewriting decades of existing code is prohibitively expensive and slow, requiring scarce expert engineers.
The Great Refactor initiative believes AI has changed this calculus. Spearheaded by Herbie Bradley, a researcher at the University of Cambridge, the project envisions a focused team using AI-powered tools to translate 100 million lines of critical open-source code into Rust by 2030. With an estimated budget of $100 million, Bradley argues the return on investment could be immense, preventing hundreds of attacks and roughly $2 billion in cumulative losses. The approach is especially promising for the vast number of smaller, under-maintained open-source libraries that form the backbone of modern software.
Current AI coding assistants can already reliably translate programs under 1,000 lines with minimal human oversight, with capabilities rapidly improving. The project plans to build upon existing efforts like the U.S. Defense Department’s TRACTOR program, which is exploring how to blend generative AI with traditional code analysis for automated Rust conversion. According to TRACTOR program manager Dan Wallach, the key is finding the right hybrid approach. “We have decades of research into writing software to analyze other software,” he notes. The goal is to intelligently mix classical computer science techniques with modern AI capabilities.
A critical benchmark for success will be generating “idiomatic” Rust, code that not only functions correctly but also adheres to the language’s best practices and would look natural to an experienced Rust developer. This is vital for long-term maintainability. Open source developer Josh Triplett, who contributes to Rust, cautions that AI-translated code can be difficult for humans to maintain compared to a manual rewrite. He suggests that while using AI for conversion is reasonable for projects already leveraging the technology, popular libraries relied upon by thousands may warrant more careful, supervised translation. “There will never be a silver bullet for AI being 100 percent robust against doing the wrong thing,” he warns.
Another consideration is Rust’s still-growing community. Jessica Ji, a research analyst at Georgetown University, points out that even with perfect AI translation, the resulting code needs ongoing maintenance. “There are a lot fewer Rust experts out there than C/C++ experts,” she notes, which could mean fewer skilled eyes on the converted codebases. Furthermore, securing large-scale government funding for such an ambitious project remains a significant hurdle. Ji suggests starting with a private-sector-funded proof of concept, capitalizing on AI companies’ desire to demonstrate their models’ advanced capabilities.
Bradley acknowledges these challenges and is considering multiple pathways, including structuring the initiative as a commercial venture. A substantial portion of the vulnerable code that would benefit from conversion resides within private corporations and critical infrastructure providers, who may have strong incentives to invest in such a security overhaul. The success of this refactoring vision hinges not just on technological advancement, but on building a viable ecosystem to support and sustain the newly fortified code for years to come.
(Source: Spectrum)





