Memory Safety Bugs in Rust Standard Library Microsoft's FORGE Lab reported several memory safety bugs in Rust's standard library (std and core), including cases where code written entirely in safe Rust can trigger undefined behavior, with findings produced using Hyenas, FORGE's frontier research version of its AI-powered vulnerability-scanning system codename MDASH. The researchers identified three recurring patterns of misplaced trust in unsafe code: trusting code not to panic, trusting user-provided implementations to be correct, and trusting the underlying system, and reported the bugs to the Rust issue tracker for fixes. The findings matter because Microsoft made Rust a Tier-1 internal language alongside C++, C#, and TypeScript, and GitHub rewrote the Copilot agent runtime in Rust, while Bun, Android, the Linux kernel, and Cloudflare are also moving code to the language. ← All writing https://forge-blog.github.io/posts/ Memory Safety Bugs in Rust Standard Library Microsoft’s FORGE Lab found several memory safety issues in Rust’s standard library std and core , including cases where code written entirely in safe Rust can trigger undefined behavior. The research used Hyenas, FORGE’s frontier research version of codename MDASH, an AI-powered vulnerability-scanning system. The findings reveal three recurring patterns of misplaced trust in unsafe code: trusting code not to panic, trusting user-provided implementations to be correct, and trusting the underlying system. 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. When that code breaks its safety contract, even safe Rust can encounter behavior the language is designed to prevent. Rust’s memory-safety guarantees are increasingly important as the language becomes part of software that billions of people rely on every day. Billions of people are estimated to interact with Rust-based software or operating systems daily, often without knowing it. Microsoft made Rust a Tier-1 internal language https://rustfoundation.org/media/guest-post-rust-is-tier-1-language-at-microsoft/ alongside C++, C , and TypeScript, GitHub rewrote the Copilot agent runtime in Rust https://github.blog/ai-and-ml/generative-ai/migrating-the-github-copilot-runtime-to-rust-using-copilot/ , and Bun https://bun.com/blog/bun-in-rust , Android https://blog.google/security/rust-in-android-move-fast-fix-things/ , the Linux kernel https://lwn.net/Articles/1050174/ , and Cloudflare https://blog.cloudflare.com/20-percent-internet-upgrade/ are moving code to it as well. Much of this software relies on Rust’s foundational libraries, core and std , and the safety guarantees of the APIs they provide. Bugs in those libraries can have consequences well beyond the code where they originate. Unsafe Rust has been a long-running interest for us. Our team includes the people behind Rudra https://dl.acm.org/doi/10.1145/3477132.3483570 , a static analyzer that looked for memory-safety bugs across the Rust ecosystem in 2021. We also write many of our own tools in Rust, so its safety is more than a research topic for us. This year, we took a closer look at the standard library to see what kinds of mistakes still show up in its unsafe code today. In this post, we share some of the bugs we reported to the Rust issue tracker. We use them to discuss what Rust does and doesn’t guarantee, why writing correct unsafe Rust is so difficult, and why Rust’s safety model still matters even though its memory safety isn’t perfect. How we found and validated the bugs At Microsoft FORGE Lab https://www.microsoft.com/en-us/security/blog/2026/10/07/3-lessons-from-frontier-ai-vulnerability-research/ , we study vulnerabilities in complex software, including the Rust standard library. Our team combines years of experience in vulnerability research with AI-assisted tools that help us investigate code and find bugs that are difficult to uncover through traditional analysis alone. Some of the bugs in this post were found with help from Hyenas, our research version of codename MDASH https://www.microsoft.com/en-us/security/blog/2026/05/12/defense-at-ai-speed-microsofts-new-multi-model-agentic-security-system-tops-leading-industry-benchmark/ . Our researchers investigated the underlying code, reproduced the bugs, assessed their potential security impact, and worked with Rust maintainers to report and fix them. This post focuses on soundness bugs in the standard library’s unsafe code. Bugs in the compiler itself, such as miscompilations and holes in the type system, are a different topic that we don’t cover here. Patterns of Rust’s Safety Bugs At the lowest level, Rust uses unsafe blocks https://doc.rust-lang.org/book/ch20-01-unsafe-rust.html to work with raw pointers and interact directly with the operating system. Much of the standard library, including Vec and String , is built from small unsafe pieces wrapped in safe APIs. Inside an unsafe block, the programmer takes responsibility for the guarantees the compiler can’t check, and that responsibility extends to the safe API built around it. That API must be sound https://doc.rust-lang.org/nomicon/safe-unsafe-meaning.html : no matter how safe code uses it, it must be impossible to trigger undefined behavior. Upholding that promise is harder than it looks. Consider a function that returns the byte at idx from any type that can be viewed as a byte slice, skipping the redundant bounds check after doing its own: php pub fn get