VOOZH about

URL: https://thenewstack.io/code-wars-rust-vs-c-in-the-battle-for-billion-device-safety/

⇱ Code Wars: Rust vs. C in the Battle for Billion-Device Safety - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2025-05-02 16:00:50
Code Wars: Rust vs. C in the Battle for Billion-Device Safety
Programming Languages / Rust / Security

Code Wars: Rust vs. C in the Battle for Billion-Device Safety

How Tweede golf's experiment exposes critical memory vulnerabilities and proves Rust's superiority in preventing billion-device security flaws.
May 2nd, 2025 4:00pm by Darryl K. Taft
👁 Featued image for: Code Wars: Rust vs. C in the Battle for Billion-Device Safety
Featured image via Unsplash.

A recent experiment by a Dutch Rust engineering consultancy, Tweede golf, demonstrates exactly why Rust is rapidly gaining adoption in safety-critical applications.

Software vulnerabilities can affect billions of devices, from ultrasound machines to critical avionics systems, so the programming languages we choose matter more than ever.

“Rust offers three core advantages: inherent memory safety (with clear markers when using unsafe code), strict compile-time checks that catch bugs early and first-class test ergonomics that promote high code coverage,” David Mytton, CEO of Arcjet, a developer-first security platform provider, told The New Stack.

The 3-Billion Device Problem

In 2021, security researchers discovered a critical vulnerability in Siemens’ Nucleus real-time operating system: software running on more than 3 billion devices worldwide. The vulnerability, part of a collection dubbed “NAME:WRECK,” allowed attackers to craft malicious DNS responses that could lead to device crashes or even complete takeovers.

“But, it is possible to craft phoney ‘DNS responses’ containing intentional ‘mistakes’. Malicious hackers could use this to trick Nucleus into writing to memory locations that it really shouldn’t,” wrote Marc Schoolderman, a systems software engineer at Tweede golf, in a blog post.

The potential impact was enormous — imagine hackers remotely compromising ultrasound machines, storage systems or avionics equipment through a simple networking vulnerability.

The Experiment: C vs. Rust in Real-World Security

To test whether Rust could have prevented this vulnerability, Tweede golf designed an experiment. They gave four engineers (two staff members and two interns) a brief description of the DNS message encoding protocol (RFC1035) and asked them to implement a solution in Rust within just three to four hours.

The engineers had no prior knowledge that they were recreating code with known vulnerabilities. Their Rust implementations were then tested against the same problematic inputs that crashed the original C implementation.

The Results: Safer by Design

The results were striking. While the original C code failed on multiple test cases (with 7 out of 12 tests resulting in exploitable conditions), none of the Rust implementations contained arbitrary code execution vulnerabilities.

“Nobody felt the need to use unsafe Rust,” wrote Schoolderman, referring to Rust’s escape hatch that allows programmers to bypass safety checks when necessary.

All the Rust solutions were “panic safe,” meaning they would result in recoverable errors rather than system crashes when fed malicious input. And despite the time constraints, all engineers wrote thorough test suites, including fuzz tests that automatically generate problematic inputs.

Developers Weigh In

“I think this experiment is a great example of the value that memory-safe programming languages bring,” Alex Gaynor, an open source maintainer working on Python and Rust projects, told The New Stack. “Decoding DNS messages is not the sort of thing that should be able to have critical security vulnerabilities that put systems at risk, but unfortunately with memory-unsafe languages, that’s the status quo.”

Moreover, “this simple research shows yet another example that making languages memory safe by default goes a long way to building overall safer systems,” he added.

Josh Aas, co-founder and executive director of the Internet Security Research Group (ISRG), said he thinks it’s great that Tweede golf took the time to dig in and validate the claim in an interesting way. “People shouldn’t have to take claims about Rust’s safety at face value, and this is another strong piece of evidence,” he told The New Stack.

For instance, “ISRG’s Prossimo project has been investing in memory-safe DNS in order to avoid precisely the kind of problem described. Hickory DNS is a high-performance recursive DNS resolver written in Rust, and we hope to deploy it in our Let’s Encrypt certificate authority over the next year,” Aas said.

While the Tweede golf experiment is a smaller effort than the Google findings they link to, it provides another piece of evidence that Rust does have the security impact one would hope for, Per Larsen, CEO of Immunant, a systems software consultancy, told The New Stack.

“The folks at Tweede golf are doing a great job moving software from C to Rust,” he said. “We have a great working relationship with them and have a positive impression from our interactions with them. They are regularly contributing to our c2rust migration tools, so that’s a huge plus in my book.”

Meanwhile, “I think it’s a brilliant post, it buttresses the point of safety Rust has over C/C++ even with real-life scenarios,” Joshua Aminu, a senior Rust developer working as a contractor in Lagos, Nigeria, told The New Stack.

Development Speed Advantage

Perhaps the most surprising result was the development time advantage. According to Tweede golf, implementing a truly secure C version of the same functionality “took at least three times the amount of time” compared to the Rust implementations, even when armed with foreknowledge of the vulnerabilities.

“At Tweede golf, we don’t just use Rust because it prevents us from making mistakes — we’re also using it because it enables us to write safer software, and being quick at the same time,” Schoolderman explained.

Why Rust Succeeds Where C Struggles

The original vulnerability stemmed from classic C programming issues: unchecked memory access, lack of bounds checking and implicit trust of external inputs. A brief look at the vulnerable C code reveals several critical issues:

  • Unchecked memory offsets that allowed attackers to read or write arbitrary memory locations
  • Implicit trust of input data without validation
  • Potential infinite loops caused by circular references
  • No checks to ensure output buffers wouldn’t overflow

In contrast, Rust’s design philosophy prevents these issues by default:

  1. Memory safety guarantees: Rust’s ownership system makes buffer overflows and use-after-free vulnerabilities nearly impossible without explicitly choosing to bypass safety checks.
  2. Expressive type system: Rust’s robust type system encourages clear data validation and explicit error handling.
  3. Testing culture: The Rust ecosystem strongly emphasizes testing, including property-based and fuzz testing, which finds edge cases that humans might miss.

Beyond Academic Examples

This wasn’t merely an academic exercise. Similar DNS-related vulnerabilities were found in four other networking libraries, collectively called NAME:WRECK. The experiment adds empirical weight to what Google, Microsoft and other tech giants have been saying: memory safety issues account for a large percentage of security vulnerabilities, and languages like Rust significantly reduce these risks.

The Future of Systems Programming

As embedded systems, Internet of Things (IoT) devices and critical infrastructure become increasingly connected, the costs of security vulnerabilities grow exponentially. Tweede golf’s experiment provides compelling evidence that modern memory-safe languages like Rust offer a path forward — not just by preventing certain classes of bugs, but by enabling faster development of more reliable, secure systems.

The message is clear: when it comes to software operating critical systems that affect millions or billions of people, the programming language choice is no longer just about developer preference — it’s about fundamental security and safety.

“For system-level networking code, Rust is likely the best tool available today — its benefits over C are overwhelming, and I can’t see a reason to choose C for those problems today,” Mytton said.

Nitpicking?

“While I’m sure one can pick nits with the research methodology (e.g., small sample size, programmers are more diligent in tests than in real life), I think what we see here really reproduces what we see in large-scale industrial settings like [Google’s], and that should give us confidence that these results really reflect the kind of benefits organizations can get from writing code in memory-safe languages,” Gaynor said.

Moreover, claiming universal “time and money” savings needs a qualifier, Mytton said.

“Yes, that’s probably true when compared to C and when solving system-level problems,” he said. “But against other safe languages like Python or Go? The cost-benefit analysis is much more complex. It’s difficult to find experienced Rust developers with production experience, and as you go up the stack, Python or Go are much faster to iterate with.”

TRENDING STORIES
Darryl K. Taft covers DevOps, software development tools and developer-related issues from his office in the Baltimore area. He has more than 25 years of experience in the business and is always looking for the next scoop. He has worked...
Read more from Darryl K. Taft
SHARE THIS STORY
TRENDING STORIES
Google is a sponsor of The New Stack.
TNS owner Insight Partners is an investor in: Real.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.