Memory Safety Bugs in Rust Standard Library

pjmlp 197 points 208 comments November 13, 2026
forge-blog.github.io · View on Hacker News

Discussion Highlights (14 comments)

nektro

> Notes from Microsoft Security's Frontier Offensive Research & Generative Exploitation Lab.

not_a_bot_4sho

A good use for AI

senderista

I sure wish they'd rewrite the Azure Linux VM Agent in Rust. That thing normally burns 10-15% of a core, and also blocks VM restart for tens of minutes, god knows why.

nektro

> Pattern 2: Trusting user-provided implementations to be correct reminds me of the tales from https://oxide.computer/blog/iddqd-unsafe

hingler36

I've always felt that parts of the Rust standard library to be weirdly un-rusty. Like indexing a vector panicking instead of returning a Some(T) in case the index is out of bounds. It's easy to avoid if you put the effort in of course, but it did always feel weird that one of the first data structures you learn has this behavior right out of the gate.

Panzerschrek

> But many operations in Rust can panic, from out-of-bounds indexing to calls into user-provided code, and by default a panic unwinds That's why I think having unwinding in Rust is a mistake. It gives a false sense of safety, but it's very hard to write unwinding-correct code. So, it would be better to handle panics as immediate process termination instead.

simonask

Just because emotions seem to be always boiling whenever Rust is mentioned, I want to clarify for people who only follow casually that there is nothing unusual or scandalous about these finds. The Rust project as a whole currently has 178 open issues with the tag I-unsound[1]. Many of these describe issues that only exist in the nightly compiler, of course, but it does happen that bugs are not caught before shipping. That's software. [1]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+state%...

gspr

Very interesting finds for sure. But taking the "trusting user-provided code" as an example: isn't this just a case of malicious code being malicious? I understand the point that the malicious act comes through memory unsafety, and it's a big gotcha that safe Rust (i.e. Rust without `unsafe`) can trigger memory unsafe behavior. But the code doing it is still acting maliciously (by having an `AsRef` implementation that returns different slices at different times). And the code being abused (the one that does the unsafe indexing) does have `unsafe` – so this is a case of the user writing unsafe Rust that interacts with malicious safe Rust. I don't know if it's ever been in Rust's threat model to handle malicious code.

eptcyka

An effect system could gelp us reason about code by making calls to panic-capable functions marked as such. Maybe we could mark some types as panic unsafe?

petterroea

Is it just me or is it painful that they format their product name like that in the blog text.

shevy-java

The best AI language has not used AI to find all bugs yet? I don't quite like AI, but I think from an objective point of view one can reason that AI led to the discovery of more bugs, if we deduct the non-bugs from those reports.

codeflo

The community-driven quest for "panic safety" in Rust is the same curse that befell C++ in terms of "exception safety", maybe worse because at least more C++ shops are sensible enough to disable exceptions. It's an exercise put forth by language lawyers that increases program complexity beyond comprehension, often without achieving the stated goal. It's simply not practical to think through 20 convoluted edge cases for every innocent little function, which means that no realistic program will safely recover from a panic. It's best to admit this and engineer your system accordingly.

ozgrakkurt

Do not ever use with anything other than panic = abort. It is just the sketchiest feature in a very realiable language. It doesn't make sense to me why anyone whould use rust with panic handling. And the of course the language trusts the operating system, how else can you program? This kind of thing is basically why all projects blocked AI issues, it is just slop that kind of makes sense if you don't know what you are doing.

HackerThemAll

Could they first focus on fixing flaws within all their products maybe? The unusable patchwork of corporate programmers motivated by promotional cycles which breaks all the time on various fronts is worth abandoning and starting over in this Rust they complain about.

Semantic search powered by Rivestack pgvector
3,874 stories · 35,194 chunks indexed