MicrosoftYechan Bae and FORGE Lab
Microsoft finds Rust memory safety bugs using AI research
Microsoft’s FORGE Lab has disclosed 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 team used Hyenas, FORGE’s frontier AI-enabled vulnerability-scanning system, to investigate the standard library’s unsafe foundations and reported several bugs to the Rust issue tracker.
They frame the findings around three recurring patterns of misplaced trust: trusting code not to panic, trusting user-provided implementations to be correct, and trusting the underlying system.
Patterns 1 and 2 illustrate trust placed inside Rust code: a panic during an in-flight operation can unwind and expose broken invariants, and user-supplied implementations (comparators, trait methods, closures) may return invalid results, risking undefined behavior. Examples include a panic-safety bug in MapWindows::clone and issues around Allocator unwind, as well as how str::replace with a custom Pattern can produce a non-UTF-8 String.
Pattern 3 concerns the boundary with the OS and C library, where process-wide state such as sigaltstack, munmap, environ, and libc exit interact with Rust. The report details specific cases—process::exit with the main thread’s alternate stack and environment handling in CommandExt::exec—that could, in theory, enable exploitation, though practical paths were constrained.
The article notes several fixes, including StringPattern holding &str instead of &[u8] and stabilisation of Allocator with a no-unwind rule for implementors, and suggests AI-assisted agentic security research can help surface these boundary bugs more effectively. The piece also highlights ongoing open issues and the role of agentic scanners in expanding vulnerability discovery beyond language fundamentals.