Fact-Check: Does Rust Really Eliminate 70% of Security Bugs? What Microsoft, Google Android and CISA Memory-Safety Data Actually Show

Fact-Check: Does Rust Really Eliminate 70% of Security Bugs? What Microsoft, Google Android and CISA Memory-Safety Data Actually Show

Fact-Check: Does Rust Really Eliminate 70% of Security Bugs? What Microsoft, Google Android and CISA Memory-Safety Data Actually Show

“Switch to Rust and 70% of your security bugs disappear.” You have seen that sentence on conference slides, in hiring pitches and in heated forum threads. It stitches together three true facts into one claim the evidence does not support. The debate about Rust memory safety matters more in late 2026 than ever. US agencies told software makers to publish memory-safety roadmaps by January 1, 2026. The Linux kernel dropped Rust’s “experimental” label in December 2025. Google now reports that memory-safety bugs fell below 20% of Android’s vulnerabilities in 2025. Budgets and rewrite plans are being set on the back of these numbers, so getting them right has real cost.

This post takes six viral claims and grades each one against primary sources: Microsoft’s MSRC blog, Chromium’s security pages, Google’s Android security posts, CISA, NSA and FBI guidance, DARPA, LWN and the ISO C++ committee record. Each claim gets a verdict and the evidence behind it. You leave with a precise picture of what Rust does and does not prevent, and an adoption decision matrix you can use.

What this covers: where the 70% figure comes from, what Android’s data really proves, what US guidance actually says, Rust vs C++ speed and unsafe code, rewrite economics, C++ hardening, and an embedded/IoT adoption checklist.

Context and Background

Memory safety is a property of a program: it never reads or writes memory it is not entitled to access. A memory-safety bug breaks that rule. The classic examples are buffer overflows, use-after-free and double free. In C and C++ these are undefined behavior (UB), which means the language standard places no requirements on what happens next. Attackers turn that freedom into code execution.

For two decades the industry fought these bugs with mitigations rather than prevention. Stack canaries, address space layout randomization (ASLR), data execution prevention (DEP) and control-flow integrity (CFI) all make exploitation harder. None of them stop the bug from existing. Fuzzing and sanitizers such as AddressSanitizer find bugs faster, but only the ones a test reaches.

The shift came when large vendors began publishing their own vulnerability breakdowns. Microsoft’s Security Response Center (MSRC) wrote in July 2019 that roughly 70% of the CVEs it assigns each year are memory-safety issues. Chromium’s security team published a near-identical figure for its high-severity bugs. Those two numbers became the “70% statistic” that now headlines almost every memory safe language pitch.

Rust entered this story as the first mainstream systems language that offers C-level control without a garbage collector while enforcing memory safety at compile time. Rust memory safety is enforced by its ownership model and borrow checker, which reject whole categories of programs that C++ compilers accept. Other memory-safe languages (Java, Kotlin, Go, Swift, C#, Python) achieve safety through garbage collection or reference counting and runtime checks. Rust’s selling point is that it targets the same niche as C and C++: kernels, firmware, browsers, codecs and network stacks.

Governments then joined in. A five-country guide in December 2023, a White House technical report in February 2024 and several CISA, FBI and NSA documents in 2024 and 2025 pushed vendors toward memory-safe languages. Inside the Linux kernel, Rust moved from experiment to core language. For firmware teams, our deep dive on Rust embedded with Embassy async versus Zephyr and FreeRTOS shows what that shift looks like on a microcontroller. The Android security team’s 2025 report is the most important new data point, and we will dissect it below.

The trouble is that each source measures a different population, with different scopes and caveats. Merging them into one slogan produces claims that sound authoritative and are wrong in specific, checkable ways. That is what this fact-check untangles.

Rust Memory Safety: Six Viral Claims, Graded Against the Evidence

Short answer: Rust does not eliminate 70% of all security bugs. About 70% of vulnerabilities in large C and C++ codebases at Microsoft and Chromium were memory-safety bugs. Safe Rust prevents most of that class by construction. Google’s Android data shows the share falling below 20% as new code moved to memory-safe languages, but logic, injection and unsafe-code bugs remain.

Rust memory safety bug taxonomy showing spatial, temporal, uninitialized and data race bugs that safe Rust blocks versus logic, injection and supply chain bugs it does not

Figure 1: Which vulnerability classes Rust memory safety addresses, and which it leaves untouched.

The diagram splits security bugs into two families. Memory-safety bugs divide into spatial errors (accessing outside an object’s bounds), temporal errors (accessing an object after its lifetime ends), uninitialized reads and type confusion, and data races. Safe Rust rejects these at compile time or converts them into a controlled panic. The other family covers logic flaws, injection, supply-chain compromise and bugs inside unsafe or foreign code. Rust’s type system offers little or no direct protection against those.

Before grading claims, we need a precise vocabulary. The verdict scale used below is: True, Mostly true, Misleading, False and Unproven. A claim is “Misleading” when its facts are real but the conclusion it implies does not follow.

What the borrow checker actually enforces

Rust memory safety rests on three rules checked at compile time. Every value has exactly one owner, and the value is freed when the owner goes out of scope. You may hold either one mutable reference or any number of shared references to a value, never both at once. References cannot outlive the data they point to. The borrow checker is the compiler pass that proves these rules hold.

Those three rules map directly onto the bug classes in Figure 1. Single ownership with automatic drop removes double free and most leaks that matter for security. Lifetime checking removes use-after-free and dangling pointers. The “shared XOR mutable” rule, combined with the Send and Sync traits, removes data races in safe code. Spatial safety comes from a different mechanism: slices carry their length, and indexing is bounds-checked at runtime, panicking instead of corrupting memory. Variables must be initialized before use, which closes uninitialized-read bugs.

What the borrow checker does not do is just as important. It does not check business logic, authorization or protocol state machines. It cannot tell whether a string you pass to a shell is safe. It does not prevent deadlocks, integer overflow in release builds (which wraps by default rather than being UB), or panics that crash a service. It also says nothing about code inside an unsafe block, where the programmer takes over responsibility for the invariants.

Spatial versus temporal safety: why the split matters

The distinction between spatial and temporal bugs is not academic. It decides which mitigations work on existing C++ code. Google reported in November 2024 that spatial safety vulnerabilities represent 40% of in-the-wild memory-safety exploits over the past decade, based on Project Zero’s tracking. Spatial bugs can be retrofitted with bounds checks in libraries such as a hardened libc++. Temporal bugs are much harder, because detecting a dangling pointer requires tracking object lifetimes at runtime.

Chromium’s data reinforces the point. Its security team says around half of its high-severity memory-safety bugs are use-after-free, a temporal class. That is why Chromium’s memory-safety page lists custom C++ libraries, hardware tagging and safer languages as parallel strategies, and why hardware memory tagging gets so much attention. Rust’s compile-time lifetime analysis handles temporal safety without runtime cost, which is the property C++ hardening finds hardest to match.

Claim 1: “70% of vulnerabilities are memory-safety bugs”

Verdict: Mostly true, for the populations measured. Misleading when generalized.

The original source is MSRC’s July 16, 2019 post, “A proactive approach to more secure code.” Its figure caption reads: “~70% of the vulnerabilities Microsoft assigns a CVE each year continue to be memory safety issues.” Three scoping details matter. First, it covers vulnerabilities in Microsoft products that received a CVE from Microsoft. Second, those products are dominated by C and C++ code. Third, the post does not state a precise year range in its text, so quoting “70% across 12 years” goes beyond what the text says.

Chromium’s figure is narrower and arguably stronger. Its memory-safety page states: “Around 70% of our high severity security bugs are memory unsafety problems.” The dataset is 912 high or critical severity bugs reported since 2015 that affected the Stable channel. So the Chromium number is about severe bugs, not all bugs.

The generalization problem is simple. Neither figure describes “software” in general. A web application written in Python, Java or TypeScript will see injection, authentication and access-control bugs dominate, not buffer overflows. The 70% describes large, mature, security-critical C and C++ systems that are heavily fuzzed and attacked. For that population it is a robust and well-replicated finding. Outside it, the number does not transfer.

Android’s own history gives the cleanest illustration. Google reported that memory-safety issues were 76% of Android vulnerabilities in 2019, above the 70% industry baseline. By 2025 the share was below 20%. If the 70% were a law of nature, that drop could not happen. It is a property of how much new memory-unsafe code a project writes.

Claim 2: “Rust eliminates memory-safety bugs”

Verdict: Misleading. Safe Rust prevents the class; real Rust programs still ship rare memory-safety bugs through unsafe code.

The strongest evidence for Rust comes from Android, and it is genuinely impressive. In its November 13, 2025 post, Google’s Android team reported that memory-safety vulnerabilities fell below 20% of total Android vulnerabilities for the first time. It estimated Rust’s memory-safety vulnerability density at about 0.2 per million lines of code (MLOC). That estimate rests on one potential vulnerability across roughly 5 million lines of Rust in the Android platform. Google contrasted it with C and C++ density “closer to 1,000 memory safety vulnerabilities per MLOC,” calling the gap “a more than 1000x reduction.”

Read the caveats before quoting that ratio. One bug is a sample size of one, so the Rust density has an enormous confidence interval. The C and C++ comparison number is described as approximate. The Rust code is also younger, which cuts both ways: younger code usually has more bugs, but it has also had less time for researchers to find them. The direction of the result is not in doubt. The precise multiplier should be quoted as Google’s estimate, not as a measured constant.

The one bug itself is instructive. CVE-2025-48530 was a linear buffer overflow in CrabbyAVIF, a Rust image-decoding component. It sat in unsafe code. Google caught it before a public release, and Android’s Scudo hardened allocator rendered it non-exploitable. So a memory-safety bug did occur in a Rust codebase, and defense-in-depth mattered. Google also reported that unsafe Rust is about 4% of its Rust code, which is where residual risk concentrates.

The Linux kernel provides a second data point. CVE-2025-68260, published in December 2025, was the first CVE assigned to Rust code in the mainline kernel. It affected the Rust rewrite of the Android Binder driver, which shipped in Linux 6.18. The kernel’s CVE description explains that Node::release moved items to a local list and dropped a lock. Other threads meanwhile called an unsafe remove on the original list. The resulting race corrupted list pointers and crashed the kernel. The fix landed in 6.18.1. On the same day, Greg Kroah-Hartman noted 159 other kernel CVEs for fixes in the C portion of the codebase. One Rust CVE against 159 C CVEs is anecdote, not statistics, but it shows the proportions.

Finally, Rust’s own standard library is not immune. An AWS-led verification effort reported in November 2024 that the standard library has about 7,500 unsafe functions out of roughly 35,000. It also counted 57 soundness issues filed and 20 CVEs reported over the previous three years. Some of those are not memory bugs at all. CVE-2024-24576, rated critical, let attackers inject commands when Rust programs ran Windows batch files with untrusted arguments through std::process::Command. That is an injection bug in argument escaping, fixed in Rust 1.77.2 on April 9, 2024. Safe Rust compiled it without complaint, because the borrow checker cannot reason about cmd.exe parsing rules.

The accurate statement about Rust memory safety is this. Safe Rust makes memory-safety bugs rare enough that each one becomes notable. It does not make them impossible, and it does nothing for the other categories in Figure 1.

Deeper Analysis: Rust Memory Safety in Policy, Performance, Unsafe Code and Rewrites

The remaining four claims move from bug data to policy and engineering economics. This is where most of the misinformation lives, because summaries of government documents rarely quote them.

Android rust memory safety trend showing new code in memory-safe languages and aging C++ code driving the memory-safety share from 76 percent to below 20 percent

Figure 2: Why Android’s memory-safety share fell, according to Google’s own model.

Figure 2 shows the mechanism behind the Android result, and it is subtler than “Rust fixed it.” In 2019 Android began prioritizing memory-safe languages (Rust, Kotlin and Java) for new code. Existing C and C++ was not rewritten wholesale. Google’s September 2024 post explained why that still works. Vulnerabilities decay roughly exponentially with code age, so old code becomes safer as bugs are found and fixed. It cited a USENIX Security 2022 study showing 5-year-old code has 3.4x to 7.4x lower vulnerability density than new code. Most new bugs land in new code. If new code is memory-safe, the memory-safety share falls even though millions of lines of C++ remain. The small unsafe Rust slice feeds a trickle of residual bugs such as the CrabbyAVIF case.

Claim 3: “The US government told everyone to stop using C and C++”

Verdict: False as stated. The guidance is voluntary, scoped and centered on roadmaps, not a ban.

This claim usually cites a headline such as “Feds: critical software must drop C/C++ by 2026.” Here is what the documents actually say, in order.

Memory safe languages CISA guidance timeline from the 2019 MSRC statistic through the January 2026 roadmap expectation

Figure 3: The chain of memory-safety data and US and allied guidance, 2019 to 2026.

Figure 3 lays out the sequence. It runs from vendor statistics to allied guidance, a White House technical report, CISA’s critical open-source study, the October 2024 bad-practices list and the June 2025 information sheet. It ends at the January 1, 2026 roadmap expectation. The final node is the point most summaries miss. Everything in the chain is guidance.

December 6, 2023: “The Case for Memory Safe Roadmaps.” CISA, NSA and FBI published this guide with cyber agencies from Australia, Canada, the UK and New Zealand. It urges software manufacturers to move to memory-safe languages and to publish roadmaps showing how. It applies the Secure by Design principles of “radical transparency” and executive ownership. CISA’s announcement of it does not name C or C++.

February 26, 2024: ONCD report. The White House Office of the National Cyber Director released “Back to the Building Blocks: A Path Toward Secure and Measurable Software.” Its press release was titled “Future Software Should Be Memory Safe.” The release does not name Rust and does not ban any language.

June 26, 2024: “Exploring Memory Safety in Critical Open Source Projects.” CISA, FBI and Australian and Canadian partners analyzed 172 projects from the OpenSSF critical-projects list. They found 52% contain code in a memory-unsafe language, and memory-unsafe languages make up 55% of total lines of code. Three projects written in memory-safe languages each depended on components written in memory-unsafe languages. That last finding matters for anyone who thinks “we use Rust” ends the conversation.

October 2024: “Product Security Bad Practices.” This CISA and FBI document is the source of the “drop C/C++ by 2026” headlines. It calls it dangerous to develop new product lines “for use in service of critical infrastructure or NCFs” in a memory-unsafe language, giving C and C++ as examples. NCFs are National Critical Functions. For existing products, it says lacking a published memory safety roadmap by January 1, 2026 “is dangerous and significantly elevates risk.” The roadmap expectation does not apply to products with an announced end-of-support date before January 1, 2030.

June 24, 2025: NSA and CISA information sheet. “Memory Safe Languages: Reducing Vulnerabilities in Modern Software Development” urges organizations “to consider whether adopting MSLs is practical for their circumstances.” It states that “MSL adoption does not require existing code to be completely rewritten.” It also covers interoperability with existing codebases and ways to make non-MSLs safer when adoption is not feasible.

Put together, the guidance says three things. Do not start new critical-infrastructure product lines in C or C++. Publish a credible roadmap for existing ones. Use interop and hardening rather than blanket rewrites. None of these documents is a regulation with penalties. They do, however, shape procurement questions and liability debates, and they are increasingly cited alongside SBOM and vulnerability-disclosure requirements. If you sell into the EU, our guide to Cyber Resilience Act SBOM requirements for firmware covers the documentation side. A memory-safety roadmap fits naturally in that evidence pack, though the CRA itself does not mandate any language.

Claim 4: “Rust is as fast as C++”

Verdict: Mostly true for typical systems code, with measurable but usually small check costs. There is no single authoritative benchmark.

Rust compiles through LLVM, the same backend Clang uses for C and C++. It has no garbage collector and no mandatory runtime. Its abstractions, such as iterators, generics and traits, are monomorphized and inlined much like C++ templates. In principle, idiomatic Rust and idiomatic C++ should produce comparable machine code, and in practice they frequently do.

Rust adds runtime work in a few places. Slice indexing is bounds-checked unless the optimizer proves the index is in range; iterator-based loops usually avoid the check entirely. RefCell and Rc add runtime borrow tracking and reference counting when you choose them. Panics require unwinding support unless you configure panic = "abort". On the other side, Rust’s aliasing rules give the compiler more information than C++ typically has, which can enable optimizations.

The best large-scale proxy for the cost of safety checks actually comes from C++. Google reported in November 2024 that enabling hardened libc++ bounds checks across its server fleet cost an average 0.30% performance impact. That change also uncovered over 1,000 bugs and cut the baseline production segfault rate by 30%. Bounds checking at scale is therefore cheap, whichever language inserts the checks.

We deliberately do not quote a “Rust is X% faster or slower than C++” number. Cross-language microbenchmarks mostly measure the effort and skill of whoever wrote each version. Performance depends on allocator choice, data layout, inlining decisions and whether a hot loop gets vectorized. Treat any single-number claim with suspicion and benchmark your own workload.

Android’s data offers an indirect engineering-speed angle instead. Google reported that Rust changes of medium and large size have a rollback rate about 4x lower than C++. They also spend about 25% less time in code review and need about 20% fewer revisions. Those are delivery-speed metrics, not runtime speed. For many teams they matter more.

Claim 5: “Unsafe Rust makes the whole thing pointless”

Verdict: False. unsafe concentrates risk into small, auditable regions; it does not cancel the guarantees elsewhere.

The unsafe keyword unlocks five extra capabilities: dereferencing raw pointers, calling unsafe functions including foreign ones, accessing mutable statics, implementing unsafe traits and accessing union fields. Everything else, including the borrow checker, still applies inside an unsafe block. The point of the design is encapsulation. A library author writes a small amount of unsafe code, documents the invariants, and exposes a safe API. Callers in safe code cannot break those invariants without themselves writing unsafe.

How common is it? The Rust Foundation’s May 2024 analysis of roughly 127,000 significant crates found 24,362 crates, or 19.11%, use the unsafe keyword directly. It found 34.35% make a direct function call into another crate that uses unsafe. The most common reason was calling into existing C or C++ libraries. In other words, a lot of unsafe exists precisely because Rust code must talk to the memory-unsafe world.

There is also a formal foundation. RustBelt, published at POPL 2018 by Ralf Jung, Jacques-Henri Jourdan, Robbert Krebbers and Derek Dreyer, gave the first machine-checked safety proof for a realistic subset of Rust. Crucially, it defined verification conditions that a library using unsafe must meet to count as a safe extension of the language, and it verified several important standard-library abstractions. The AWS-backed standard library verification challenge launched in November 2024 extends that work to the real std.

The empirical picture matches the theory. In Android, unsafe is about 4% of Rust code, and that 4% produced the single near-miss Google reported. Auditing 4% of a codebase is a tractable job. Auditing 100% of a C++ codebase for the same bug classes is not. For Rust memory safety, the honest framing is that unsafe turns a whole-program problem into a local one.

Claim 6: “Just rewrite everything in Rust”

Verdict: False as a strategy. Unproven as an automated capability. Incremental adoption is what the evidence supports.

Google’s September 2024 post states plainly: “we do not need to throw away or rewrite all our existing memory-unsafe code.” The vulnerability-decay model in Figure 2 explains why. Rewriting mature, well-fuzzed C++ resets its age to zero and spends engineering time on code that is already the least likely to contain new bugs. The better return comes from writing new code in a memory-safe language and rewriting only the riskiest boundaries, such as parsers and codecs that handle untrusted input.

Automated translation is the wildcard. DARPA’s TRACTOR program (Translating All C to Rust) aims to automate translation of legacy C to Rust using static and dynamic analysis plus large language models. Its stated goal is “the same quality and style that a skilled Rust developer would produce.” MIT Lincoln Laboratory handles test and evaluation. As of this writing the program page lists benchmarks and tools but no claim that the goal has been met, so treat it as Unproven.

Microsoft illustrated how fast this topic gets distorted. Around December 20, 2025, Distinguished Engineer Galen Hunt posted on LinkedIn about a goal to eliminate every line of C and C++ from Microsoft by 2030. Headlines declared that Windows would be rewritten in Rust. Hunt then clarified that this was a research project in Microsoft’s CoreAI group building language-migration technology. He said it was not a new Windows strategy. Its stated North Star was “1 engineer, 1 month, 1 million lines of code,” which is an aspiration, not a result.

Meanwhile C++ is improving its own safety story, which changes rewrite math. The Safe C++ proposal by Sean Baxter, which would have added a Rust-style borrow checker, was effectively set aside in 2025. A committee straw poll favored the Profiles approach. C++26, whose technical work finished in March 2026, includes a hardened standard library providing bounds safety for widely used operations. It also removes undefined behavior for reading uninitialized local variables and adds contracts. Profiles are now targeted at C++29. None of this gives C++ Rust’s temporal safety guarantees, but it raises the floor for code that will never be rewritten.

The Linux kernel shows the incremental path working at scale. At the Maintainers Summit in December 2025, developers agreed that “Rust in the kernel is no longer experimental,” as LWN reported. The kernel did not rewrite its C core. It added Rust for new drivers and subsystems, with the Binder rewrite as a flagship. Our analysis of Rust in the Linux kernel for embedded and IoT drivers covers what that means for board-support packages.

Verdict summary

# Viral claim Verdict Key primary evidence
1 70% of vulnerabilities are memory-safety bugs Mostly true, scoped MSRC 2019 CVE data; Chromium 912 high-severity bugs since 2015
2 Rust eliminates memory-safety bugs Misleading Android below 20% in 2025; CVE-2025-48530; CVE-2025-68260
3 US government told everyone to stop using C/C++ False as stated CISA/FBI Bad Practices Oct 2024; NSA/CISA CSI Jun 2025
4 Rust is as fast as C++ Mostly true, caveated Shared LLVM backend; hardened libc++ 0.30% check cost
5 Unsafe Rust makes it pointless False 19.11% of crates use unsafe; ~4% of Android Rust; RustBelt
6 Rewrite everything in Rust False / Unproven Google Safe Coding; DARPA TRACTOR; Microsoft clarification

Rust vs C++ security: adoption decision matrix

The verdicts translate into a practical matrix. Use it per component, not per company.

Situation Recommended approach Why
New service, library or driver Memory-safe language; Rust where C-level control is needed Most new bugs land in new code; guidance expects it for new critical-infrastructure product lines
Existing parser or codec handling untrusted input Rewrite that boundary in Rust behind FFI Highest exploit exposure; small surface; Android’s codec and parser work follows this pattern
Large, mature C++ with low churn Harden in place: hardened libc++, sanitizers, fuzzing Vulnerability decay favors leaving it; hardening is cheap at scale
Kernel or firmware with vendor C SDKs Rust for new drivers and application logic; wrap SDKs Kernel precedent; unsafe confined to bindings
Safety-certified code under functional-safety standards Evaluate a qualified Rust toolchain; pilot before committing Certification evidence and tool qualification drive cost
Code with an announced end of support before 2030 Harden and plan retirement CISA roadmap expectation exempts it

Hardening the C and C++ you keep

Since most organizations will run C and C++ for another decade, mitigations for existing code belong in any honest memory-safety plan. Each one addresses a different slice of Figure 1.

Hardened standard libraries. libc++ hardening modes add bounds and precondition checks to containers, span, string_view and similar types. Google’s fleet-wide rollout is the reference data point: 0.30% average overhead, over 1,000 bugs found and a 30% drop in baseline segfaults. C++26 standardizes a hardened library, so this approach will become portable across vendors. It covers spatial safety in library types, not raw pointer arithmetic.

Sanitizers and fuzzing. AddressSanitizer, MemorySanitizer, ThreadSanitizer and UndefinedBehaviorSanitizer detect bugs during testing. Coverage-guided fuzzing drives code into the paths where those sanitizers fire. They are discovery tools, not production defenses, and they only find bugs on paths that tests or fuzzers reach.

Hardware memory tagging. Arm’s Memory Tagging Extension (MTE) assigns small tags to memory allocations and pointers and faults on mismatches. That can catch both use-after-free and overflow at runtime. Apple’s Memory Integrity Enforcement, announced September 9, 2025 for iPhone 17 and iPhone Air, combines an enhanced MTE in synchronous mode with typed secure allocators and tag-confidentiality protections, always on. It shows hardware tagging deployed by default on a large consumer platform. Tags are probabilistic, though, and the protection depends on allocator and kernel integration.

Capability hardware. CHERI (Capability Hardware Enhanced RISC Instructions) replaces raw pointers with hardware capabilities that carry bounds and permissions. Research platforms such as Arm’s Morello board and microcontroller-class designs such as CHERIoT apply it to existing C code with modest source changes. CHERI is promising for embedded systems that will keep C for a long time. We did not verify current commercial availability or performance figures for CHERI silicon in this run, so treat specific claims you see about it as needing independent confirmation.

Hardened allocators. Android’s Scudo turned the CrabbyAVIF overflow into a non-exploitable bug. Hardened allocators randomize layout, isolate size classes and detect some corruption. They are the cheapest defense-in-depth layer and they also protect unsafe Rust.

None of these layers gives C++ the compile-time guarantees of Rust memory safety. Together they raise exploit cost substantially and buy time for an incremental migration.

The embedded and IoT angle

Embedded firmware is where Rust memory safety arguments are strongest and adoption is hardest. Microcontrollers often lack an MMU, run everything in one address space and ship for ten years or more. A single overflow in a network or Bluetooth stack can compromise the whole device, and patching fleets in the field is slow and costly.

Rust’s no_std mode removes the standard library’s operating-system dependencies, so the language’s core guarantees work on bare metal. Frameworks such as Embassy provide async executors that replace hand-rolled interrupt state machines with compiler-checked code. Our no_std Rust firmware guide for microcontrollers covers the toolchain basics. The Embassy versus Zephyr versus FreeRTOS comparison covers scheduling and power trade-offs.

The friction points are specific. Silicon vendors ship C SDKs, HALs and binary blobs, so unsafe FFI bindings appear early. Register access through peripheral access crates is generated from vendor SVD files, and errors there are not caught by the borrow checker. Functional-safety certification needs qualified toolchains and evidence, which narrows tool choice. Code size can grow if generics are monomorphized carelessly, which matters on parts with small flash budgets.

Supply chain is the other embedded concern. The CISA open-source study’s dependency finding applies doubly to firmware. A “Rust” device still links vendor C, cryptographic libraries and bootloaders. Track those components in your SBOM and flag which are memory-unsafe. Our guide to SBOM and VEX triage with CycloneDX vs SPDX shows how to make that inventory actionable.

What migration actually costs

There is no credible public figure for “cost per line converted to Rust,” and we will not invent one. The cost drivers are well understood, however, and they let you estimate your own case.

First, training. Rust’s ownership model is unfamiliar to most C++ and Java developers, and the first months are slower. Google’s Android data suggests that after ramp-up, review time and rollback rates improve. Second, interop. Every boundary between Rust and C or C++ needs bindings, ownership conventions across the boundary and unsafe glue that must be reviewed. Tools such as bindgen and cxx reduce but do not remove this work. Third, build and toolchain integration. Mixed-language builds touch CI, reproducible builds, sanitizer configuration and SBOM generation. Fourth, verification. Rewritten code needs the same test and fuzzing depth as the code it replaces, or you trade memory bugs for logic regressions.

As an illustrative model, not measured data, compare two strategies for a 2-million-line C++ product. Strategy A rewrites everything over several years, with every rewritten line restarting the vulnerability-decay clock. Strategy B writes all new features in Rust, rewrites the three or four modules that parse untrusted input and hardens the rest. Under Google’s decay model, Strategy B should capture most of the vulnerability reduction at a fraction of the cost. Your own numbers will differ; the shape of the trade-off is what generalizes.

Trade-offs, Gotchas, and What Goes Wrong

Rust adoption fails in predictable ways. The first is treating Rust memory safety as the whole security program. CVE-2024-24576 is the canonical warning. It was a critical command-injection bug in the Rust standard library, compiled without any unsafe in user code. Threat modeling, input validation, authorization review and dependency hygiene remain your job.

The second is unbounded unsafe. Teams under deadline sprinkle unsafe to silence the borrow checker, especially around FFI and shared mutable state. CVE-2025-68260 shows how a concurrency assumption inside unsafe can produce exactly the memory corruption Rust is meant to prevent. Require a // SAFETY: comment justifying each block, lint with Clippy, and track unsafe density as a metric.

The third is dependency sprawl. Cargo makes adding crates trivial, and 34.35% of crates call into crates that use unsafe. A small application can pull in hundreds of transitive dependencies, some with build scripts that run arbitrary code at compile time. Vet dependencies, pin versions, audit advisories and record everything in the SBOM.

The fourth is panics as availability bugs. Safe Rust converts an out-of-bounds index into a panic rather than corruption. That is far better for confidentiality and integrity, but a panic in a server or firmware loop is still a denial of service. Use get() and explicit error handling on paths that process untrusted input.

The fifth is misreading metrics. If memory-safety bugs fall from 76% to 20% of your total, the absolute count of other bug classes may be flat or rising. Report absolute counts by class, not just shares.

Rust vs C++ security adoption flowchart routing new code to memory-safe languages, risky boundaries to Rust rewrites and stable C++ to hardening

Figure 4: A per-component decision flow for memory-safety adoption.

Figure 4 encodes the decision matrix as a flow. New code goes to a memory-safe language. Existing components that parse untrusted input or run with high privilege get their boundary rewritten in Rust. Everything else is hardened in place with library checks, sanitizers, fuzzing and hardware tagging where available. Every path ends with auditing unsafe, recording components in the SBOM and publishing a roadmap.

Practical Recommendations

Start with measurement, not language choice. Classify your last two or three years of security bugs by class: spatial, temporal, uninitialized, concurrency, logic, injection and supply chain. If memory-safety bugs dominate, the Microsoft and Chromium pattern applies to you and Rust memory safety offers a large return. If injection and access-control bugs dominate, a language switch will not move your numbers much.

Next, adopt the Android pattern deliberately. Make memory-safe languages the default for new code, with an exception process rather than a mandate. Pick one high-exposure boundary, such as a media parser, protocol decoder or firmware update handler, and rewrite it in Rust as a pilot. Measure review time, defects and performance against the C++ baseline.

In parallel, harden what stays. Enable libc++ hardening in at least your test builds and ideally production. Run continuous fuzzing with sanitizers on every parser. Use a hardened allocator. Where your hardware supports memory tagging, turn it on.

Finally, write down the roadmap. If you supply critical infrastructure, CISA and FBI guidance already expects one. Even if you do not, customers increasingly ask. A credible roadmap names components, target dates, the hardening applied in the meantime and how you will measure progress.

Checklist:

  • Classify the last 24 to 36 months of vulnerabilities by bug class and report absolute counts.
  • Set memory-safe languages as the default for new components, with documented exceptions.
  • Choose one untrusted-input boundary for a Rust rewrite pilot and define success metrics.
  • Enable hardened libc++, sanitizers in CI and continuous fuzzing for remaining C and C++.
  • Require // SAFETY: justification and review for every unsafe block; track unsafe density.
  • Record memory-unsafe components and Rust crates in your SBOM.
  • Publish a memory-safety roadmap with dates and owners.

Frequently Asked Questions

Is it true that 70% of security vulnerabilities are memory-safety bugs?

For large C and C++ codebases, yes. Microsoft’s MSRC reported in 2019 that about 70% of the vulnerabilities it assigns a CVE each year are memory-safety issues. Chromium reported that around 70% of its high-severity security bugs since 2015 were memory-safety problems. The figure does not apply to software in general. Web applications in managed languages are dominated by injection and access-control bugs. Android’s share fell to below 20% by 2025 as new code moved to memory-safe languages, which shows the number depends on language mix.

Does Rust completely prevent memory-safety vulnerabilities?

No. Safe Rust prevents use-after-free, double free, data races and unchecked out-of-bounds access by construction, but unsafe code can still contain them. Google reported one potential memory-safety vulnerability in roughly 5 million lines of Android Rust, an overflow in CrabbyAVIF’s unsafe code. The Linux kernel’s first Rust CVE, CVE-2025-68260, was a race in an unsafe list operation. Rust also does nothing about logic bugs, command injection or compromised dependencies. It makes memory-safety bugs rare, not impossible.

Did CISA ban C and C++?

No. CISA and FBI’s October 2024 “Product Security Bad Practices” calls it dangerous to start new product lines for critical infrastructure in memory-unsafe languages such as C or C++. It also says existing products should have a published memory-safety roadmap by January 1, 2026. Products with an announced end of support before 2030 are exempt from the roadmap expectation. The June 2025 NSA and CISA information sheet explicitly says adoption does not require rewriting existing code. All of it is voluntary guidance, not regulation.

Is Rust slower than C++?

Usually not meaningfully. Both compile through LLVM, Rust has no garbage collector, and its abstractions are monomorphized and inlined much like C++ templates. Rust adds bounds checks on indexing, which the optimizer often removes and which iterators avoid. As a scale reference, Google measured just 0.30% average overhead from adding bounds checks to its C++ standard library across production services. There is no authoritative single benchmark ratio between the languages. Benchmark your own workload rather than trusting headline percentages.

How much of Rust code uses unsafe?

The Rust Foundation’s May 2024 analysis found 19.11% of significant crates use the unsafe keyword directly, and 34.35% call into a crate that does. The most common reason is calling existing C or C++ libraries. In Android’s platform, Google reports unsafe is about 4% of Rust code. Well-designed unsafe is wrapped in a safe API, so callers cannot violate its invariants. The practical goal is to keep unsafe small, justified in comments and reviewed carefully.

Should we rewrite our C++ codebase in Rust?

Rarely all of it. Google’s Android team says you do not need to rewrite existing memory-unsafe code, because vulnerabilities decay as code ages. Write new code in a memory-safe language, rewrite the highest-risk boundaries such as parsers of untrusted input, and harden the rest. Automated C-to-Rust translation, such as DARPA’s TRACTOR program, is still research. C++26 adds a hardened standard library, which raises the safety floor for code you keep.

Further Reading

References

  1. Microsoft Security Response Center, “A proactive approach to more secure code,” July 16, 2019. https://www.microsoft.com/en-us/msrc/blog/2019/07/a-proactive-approach-to-more-secure-code
  2. The Chromium Projects, “Memory safety.” https://chromium.org/Home/chromium-security/memory-safety
  3. Jeff Vander Stoep, Google, “Rust in Android: move fast and fix things,” November 13, 2025. https://blog.google/security/rust-in-android-move-fast-fix-things/
  4. Jeff Vander Stoep and Alex Rebert, Google Online Security Blog, “Eliminating Memory Safety Vulnerabilities at the Source,” September 25, 2024. https://security.googleblog.com/2024/09/eliminating-memory-safety-vulnerabilities-Android.html
  5. Alex Rebert, Max Shavrick and Kinuko Yasuda, Google Online Security Blog, “Retrofitting spatial safety to hundreds of millions of lines of C++,” November 15, 2024. https://security.googleblog.com/2024/11/retrofitting-spatial-safety-to-hundreds.html
  6. CISA, NSA, FBI and international partners, “The Case for Memory Safe Roadmaps,” December 6, 2023. https://cisa.gov/news-events/alerts/2023/12/06/cisa-releases-joint-guide-software-manufacturers-case-memory-safe-roadmaps
  7. White House ONCD, “Future Software Should Be Memory Safe” (Back to the Building Blocks), February 26, 2024. https://bidenwhitehouse.archives.gov/oncd/briefing-room/2024/02/26/press-release-technical-report
  8. CISA, FBI, ASD’s ACSC and CCCS, “Exploring Memory Safety in Critical Open Source Projects,” June 26, 2024. https://www.ic3.gov/CSA/2024/240626.pdf
  9. CISA and FBI, “Product Security Bad Practices,” October 2024. https://www.ic3.gov/CSA/2024/241016-2.pdf
  10. NSA and CISA, “Memory Safe Languages: Reducing Vulnerabilities in Modern Software Development,” June 24, 2025. https://www.cisa.gov/news-events/alerts/2025/06/24/new-guidance-released-reducing-memory-related-vulnerabilities
  11. DARPA, “TRACTOR: Translating All C to Rust.” https://www.darpa.mil/research/programs/translating-all-c-to-rust
  12. LWN.net, Maintainers Summit report on Rust in the kernel, December 10, 2025. https://lwn.net/Articles/1049831/
  13. NVD, CVE-2025-68260 (Rust Binder race). https://nvd.nist.gov/vuln/detail/CVE-2025-68260
  14. Rust Security Response WG, “CVE-2024-24576: std::process::Command did not properly escape arguments of batch files on Windows,” April 9, 2024. https://groups.google.com/g/rustlang-security-announcements/c/_MdkIbEZN44
  15. Rust Foundation, “Unsafe Rust in the Wild: Notes on the Current State of Unsafe Rust,” May 21, 2024. https://rustfoundation.org/media/unsafe-rust-in-the-wild-notes-on-the-current-state-of-unsafe-rust/
  16. Rahul Kumar, AWS Open Source Blog, “Verify the Safety of the Rust Standard Library,” November 20, 2024. https://aws.amazon.com/blogs/opensource/verify-the-safety-of-the-rust-standard-library
  17. Ralf Jung, Jacques-Henri Jourdan, Robbert Krebbers and Derek Dreyer, “RustBelt: Securing the Foundations of the Rust Programming Language,” POPL 2018. https://plv.mpi-sws.org/rustbelt/popl18/
  18. Apple Security Research, “Memory Integrity Enforcement,” September 9, 2025. https://security.apple.com/blog/memory-integrity-enforcement
  19. Herb Sutter, ISO C++ trip reports (C++26 completion, March 2026; June 2026). https://herbsutter.com/tag/c26/
  20. The Register, “Rust-style safety model for C++ ‘rejected’ as profiles take priority,” September 16, 2025. https://www.theregister.com/2025/09/16/safe_c_proposal_ditched/
  21. InfoWorld, “Microsoft is not rewriting Windows in Rust,” December 2025. https://www.infoworld.com/article/4111553/microsoft-is-not-rewriting-windows-in-rust.html
  22. It’s FOSS, report on the first Linux kernel Rust CVE, December 18, 2025. https://itsfoss.com/news/first-linux-kernel-rust-cve/

By Riju — about

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *