Why Rust is the Secret Weapon for Cyber Defence

Article Highlights

  • Rust provides systems-level performance while making common memory-safety errors harder to introduce than in C and C++.
  • Its ownership model, immutability, strong typing, and lack of null pointers help developers prevent security flaws earlier.
  • Organisations can gain stronger security, reliability, performance, cost efficiency, and developer productivity by adopting Rust where it fits.
  • Rust is not a complete security solution, but training teams and using it for suitable new code can reduce avoidable software risk.

Developer interacting with code in a modern office environment, representing secure systems programming with Rust.

Imagine you want to build a high-end jewellery store. You could build an open, friendly, accessible store that encourages browsing and trying the items on, similar to a clothes store.

The problem is that you’d be plagued by theft. To prevent this, you could employ security personnel to watch everyone, put a big fence around your store, search everyone as they leave, and put security tags on everything.

That would be a massive pain—and no one does it. Instead, they build a more secure store from the start. They don’t retrofit a bunch of security measures on top of an insecure design. That would be crazy.

And yet, that’s how we build many of our IT systems. Here’s why Rust Programming is the cyber security answer.

Writing Insecure Software

Software is hard to write. Large applications have lots of convoluted logic and complex dependencies. Furthermore, software requires a lot of custom components, making it impossible to assemble entirely from well-understood building blocks.

People (such as programmers…no snide comments, please…) struggle to keep track of that level of complexity. Bad actors count on this complexity to carry out cyber-attacks.

Modern programming languages, tools, and development processes have been created to help us. Unfortunately, we often don’t use them.

What?! Why?!

Inertia, lack of skills, legacy code, comfort, convenience—it’s a frustratingly long list.

Consider computer languages. C and C++ have been popular for decades. There are many programmers who have invested entire careers in mastering these languages. Millions of lines of code are written using them—including code that powers core infrastructure like operating systems. Windows, macOS, and Linux are all predominantly written using C/C++.

C/C++ are popular because they give you a lot of control and can be used to write efficient code—both things that are important when developing infrastructure. Programmers talk about such languages as being “close to the metal.” The downside to this level of control is that you have to be careful not to break anything. C and C++ don’t come with safeguards.

Working with C/C++ involves a lot of manual, explicit memory management. It’s very easy to get this wrong, and when you do, you open up security holes in your applications. Not ideal when those applications represent critical infrastructure.

C and C++ are great languages for building footguns. Footguns that efficiently remove both feet with one pull of the hair trigger.

Rust to the Rescue

It doesn’t have to be this way. Modern programming languages exist that help the programmer handle some of the complexity. C#, Go, and Rust are examples of popular enterprise development languages that try to prevent programmers from hurting themselves—and the rest of us.

Rust is interesting as it’s a “close to the metal” language, capable of providing the control and performance required when developing infrastructure. This makes it a viable replacement for C/C++ in many situations.

Industry Luminaries Agree

Microsoft Azure CTO Mark Russinovich said:

[...] it’s time to halt starting any new projects in C/C++ and use Rust [...]. For the sake of security and reliability, the industry should declare those languages [C/C++] as deprecated.

The US Government’s Cybersecurity and Infrastructure Agency (CISA) has also argued for the benefits of using memory-safe programming languages.

Innovations in Rust

Rust has a bunch of innovations that make it much harder for programmers to introduce security flaws into their applications, such as:

  • Ownership System: Providing memory safety.
  • Immutability: Reducing unintended side-effects.
  • Strong Typing: Resulting in the tooling being able to identify issues overlooked by programmers.
  • No Null Pointers: Rectifying Tony Hoare’s $1bn mistake.

How Can Your Organisation Benefit from Rust?

Adopting Rust brings many benefits to your organization:

  • Enhanced Security: Rust is designed to write secure software. It’s in the DNA of the language and tooling.
  • Increased Performance: Rust can be used to write highly performant code, resulting in a vastly improved user experience when replacing applications written in languages such as Python.
  • Improved Reliability: Applications written in Rust have fewer bugs, resulting in less downtime for your systems.
  • Cost Efficiency: Insecure software is expensive—downtime, damage to reputation, and fines can make the investment in Rust very attractive to a CFO.
  • More Productive Teams: Google has reported that Rust developers are twice as productive as C++ developers.
  • Easier Recruitment: Rust has been voted the most loved language for eight years in a row in Stack Overflow’s annual developer survey. The modern language features and powerful tooling make it a pleasure to use. Programmers enjoy working with good tools.

Real-World Applications

I’ve personally found Rust to be very effective when building large simulation models, such as in epidemiology or sports modelling. These applications perform billions of calculations, so they require blistering performance. It’s also very difficult to spot errors in this many calculations, so the checks performed by the Rust compiler help to produce accurate predictions.

Writing Secure Software

To be clear—Rust isn’t a panacea. It’s still possible to write insecure software using Rust. But it’s much harder than doing it with C/C++.

How can you use Rust in your organisation? It’s impossible to give advice that works for every situation, but it really can, sometimes, be as simple as training your programmers up and writing new code in Rust.

Getting Started with Rust

Insecure systems are increasingly a major risk to companies and governments. The time to write more secure software isn’t tomorrow. It’s right now. Get learning.

By leveraging Rust, you can build a cyber defence that is robust, efficient, and secure. Rust's innovations in systems programming, coupled with its focus on security, make it an indispensable tool for cybersecurity professionals, SecDevOps engineers, and Rust programmers alike.

For more insights on how to bolster your cyber operations and incident response mechanisms, visit our Cybersecurity Training and Talent Solutions.

 

Frequently Asked Questions (FAQs)

Why is Rust considered safer than C and C++?

Rust is designed to prevent many memory-management mistakes that can become security vulnerabilities. Its ownership system checks how memory is used, while strong typing, immutability, and the absence of null pointers help catch issues before software runs. Rust does not make insecure code impossible, but it makes several common classes of errors much harder to introduce.

Can Rust replace C and C++ for infrastructure software?

Rust can be a viable replacement for C and C++ in many situations because it offers low-level control and high performance while adding modern safety features. Whether it is the right choice depends on the system, existing code, team skills, and dependencies. Organisations can start by evaluating Rust for appropriate new infrastructure components rather than rewriting everything at once.

What business benefits can organisations gain from Rust?

The article identifies enhanced security, increased performance, improved reliability, cost efficiency, more productive teams, and easier recruitment as potential benefits. By reducing avoidable defects and supporting highly performant software, Rust can help limit downtime and security exposure while giving developers modern tooling for systems programming.

Is Rust enough to guarantee secure software?

No. Rust is not a panacea, and developers can still create insecure software with it. Its value is that the language and compiler make many common mistakes harder to write than they are in C or C++. Secure outcomes still depend on sound architecture, careful implementation, testing, maintenance, and appropriate security practices.