L O A D I N G

Blog Details

  • Home
  • Microsoft’s AI Bug Hunter Finds Rust Flaw That Went Undetected for Nearly 11 Years
By: Admin November 28, 2026

Microsoft’s AI Bug Hunter Finds Rust Flaw That Went Undetected for Nearly 11 Years

Microsoft researchers have uncovered a memory-safety bug in Rust’s standard library that had gone undetected for nearly 11 years. The finding, along with several other flaws, shows that even applications written entirely in safe Rust can encounter undefined behavior when the underlying standard library breaks its safety contract.microsoft

The 11-year-old bug

The oldest issue involves Rust’s process::exit function. Microsoft’s FORGE Lab researchers found that calling the function from a child thread could cause the runtime to remove the main thread’s alternate signal stack while it was still running.microsoft

If the main thread subsequently experienced a stack overflow, the operating system could be unable to deliver the signal correctly, resulting in a segmentation fault instead of Rust’s intended stack-overflow handling. The bug dates back to 2015 and was present in the standard library for nearly 11 years.microsoft

Microsoft said the researchers found no reliable exploitation path under the conditions they examined and assessed practical exploitation as unlikely.microsoft

How the bugs were found

The research used Hyenas, FORGE Lab’s AI-powered vulnerability-scanning system, to investigate unsafe code in Rust’s standard library. Hyenas is the lab’s research version of codename MDASH, Microsoft’s agentic vulnerability-discovery system.microsoft

Microsoft said some of the bugs were found with help from Hyenas. Researchers then examined the underlying code, reproduced the issues, assessed their security impact, and reported them to Rust maintainers.microsoft

The goal, according to Microsoft, is not simply to find more bugs, but to identify meaningful issues and improve the safety of foundational software that developers and organizations depend on.microsoft

Unsafe code challenges Rust’s safety guarantees

Rust’s ownership model and type system are designed to prevent memory-safety problems commonly associated with languages such as C and C++. However, its standard library relies on unsafe code internally for operations that the compiler cannot verify.microsoft

Components such as Vec and String use these operations but expose them through safe APIs. Microsoft said these APIs must meet a strict soundness requirement: no matter how safe code uses them, it must be impossible to trigger undefined behavior.microsoft

Microsoft grouped the findings into three categories: unsafe code that assumes operations will not panic, code that trusts user-provided implementations to behave correctly, and code that makes incorrect assumptions about the underlying system.microsoft

Panic safety and user-provided code

The first category involved a panic-safety problem in Rust’s MapWindows::clone implementation. The function created a buffer before fully initializing its contents and then called a user-provided clone operation to populate it. If that operation triggered a panic, Rust’s unwinding mechanism could invoke the buffer’s destructor, which would attempt to access uninitialized memory.microsoft

Microsoft said the reported fix prevents the partially initialized buffer from being destroyed before initialization is complete.microsoft

Another finding involved str::replace. The researchers found that the function could make an incorrect assumption about a custom implementation of the nightly Pattern trait. A custom implementation could supply a non-ASCII byte where the code expected an ASCII character, causing the replacement operation to produce invalid UTF-8 data. Subsequent string operations could then trigger undefined behavior.microsoft

System-level bugs affect stable Rust

The third category involves interactions between Rust and underlying operating systems and C libraries. Besides the process::exit issue, researchers identified a problem in Rust’s CommandExt::exec functionality involving the process-wide environment variable array.microsoft

Microsoft found that the function could modify this shared state while holding a read lock, potentially allowing other threads to access inconsistent data. Under certain conditions, concurrent operations could leave the environment pointer referencing freed memory.microsoft

Microsoft said both the process::exit and CommandExt::exec findings affect stable Rust. A proposed fix for the environment-variable issue, which avoids modifying the shared array by calling execve directly, was under review when the blog was published.microsoft

What this means for Rust

Rust’s safety guarantees are precisely what make these findings interesting. Its rich type system and ownership model rule out whole classes of memory-safety issues, but much of the standard library relies on unsafe code underneath its safe APIs.microsoft

When that code breaks its safety contract, even safe Rust can encounter behavior the language is designed to prevent. This is why bugs in the standard library can have consequences well beyond the code where they originate.microsoft

Findings feed into Microsoft’s security products

Microsoft said the research findings can also feed into Microsoft Perception, its multi-agent security system, where specialized agents work across broader security workflows. This would help the company improve the development of MDASH, which brings agentic vulnerability discovery into Microsoft Defender.microsoft

For example, Microsoft’s Web App Pen Test Agent can use MDASH findings to prioritize testing, assess exploitability against live applications, and provide information to support remediation.microsoft

The bigger lesson

The Rust project had not responded to a request for comment from CSO at the time of writing. But the findings show that even a language designed for memory safety is not immune to bugs in its standard library.microsoft

The key takeaway is that Rust’s safety model still matters. It gives an unambiguous answer to what counts as a soundness bug, so problems can be fixed and prevented once in the library, instead of in every program that uses it.microsoft

For developers, the lesson is that memory safety is not just about the language. It is also about the runtime, the standard library, and the assumptions made at the boundary between safe code and the underlying system

Leave Comment