News for hackers. Stuff that matters.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by ekidd on Thursday November 19, 2026 @07:34AM (#50559290)
Tons of production Rust systems use very little unsafe. I've been writing production Rust since 2015, and in that time, I wrote maybe 30 lines of unsafe production code. (Most of it in Tokio primitives.)

Now, in web-facing systems, the biggest concern is the low-level crypto libraries, which need to be written in assembly to avoid timing attacks. These (and related libraries) have seen multiple security advisories in the past year, some related to unsafe (I think?) and some related to logic errors. But overall, those advisories have mostly been lower priority, or affected mostly niche use cases.

If you only have a small amount of unsafe code, then it's possible to audit it more aggressively. And there's only a limited amount of space for bugs. So what I would expect for Rust is a trickle of security bugs, many of them niche or low severity, that slows down with time.

Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by vips7L on Thursday November 19, 2026 @08:12AM (#50559655)
You don’t think there’s some intrinsic code in llvm that would be generating assembly that doesn’t match Rust’s safety rules?
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by tialaramex on Thursday November 19, 2026 @08:38AM (#50559950)
We know LLVM has miscompilation bugs. Sometimes it is practical for Rust to fix those bugs and so it carries patches for LLVM, but in some cases LLVM IR semantics are just incoherent nonsense. An example of the former (Rust carries patches): LLVM got confused about discriminants when Rust uses niches, when the niche bit pattern used was usually right next to the legitimate values for a type the bug in LLVM caused little notice, it could corrupt data but probably not. However Rust changed which bit patterns to use here, so e.g. None for Option<char> went from 0x0011_0000 to the bit pattern 0xFFFF_FFFF and now that same LLVM bugs caused crashes as values which had previously been very slightly wrong were instead hugely wrong.

For an example of the latter (LLVM is just nonsense): LLVM still today has a bug found years ago where pointer provenance (a legitimate but hard to think about idea for optimising compilers) accidentally leaks into integers, and so LLVM can end up with two integers a, b which it believes are not equal and yet a - b == 0. Boom.

Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by nsagent on Thursday November 19, 2026 @08:45AM (#50560032)
Do you use core abstractions like Vec, String, Box, Arc, and Mutex? If so, those are built using unsafe code internally.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by tialaramex on Thursday November 19, 2026 @09:06AM (#50560294)
Lets compare what's inside this Ruby bug, a C function rb_str_casemap which is 40-50 lines of C fiddling with pointers and calling into macros that presumably are familiar to Ruby developers but opaque to an outside viewer. Is it fixed? I guess so but I can't see very well to be sure, it was counting stuff before and now it is being more careful, I hope it's correct this time.

... against str::to_lowercase the Rust function which has a single line of unsafe code, with a two line rationale provided to explain why it's OK to do this. As a subject matter expert I agree with the rationale. LGTM.

Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by nsagent on Thursday November 19, 2026 @11:46AM (#50562512)
This sub-thread in the conversation is about Java, so comparisons to Ruby aren't what's relevant. Here's part of the relevant GP comment.

> It's important to note that Java, like Rust, is generally seen as a memory safe language. But it has bits of assembly, just like Rust has unsafe blocks, to handle some operations.

And according to sources like CISA and the NSA [1], Java is considered memory safe. Furthermore, Rust has been found to have some memory safety issues as well [2]. I think the point to get across is that yes, Rust can help eliminate a very large set of memory safety bugs, but it's prone to issues that other generally considered memory safe languages also have: at some point to do useful work there are going to be unsafe operations. The surface area might be much smaller, so you're likely better off using a memory safe language if you can help it, but it's not a panacea for having layers of security, especially since it means any issue found is likely to affect a large swath of code written in the language because it's in a load bearing area of the language ecosystem.

[1]: https://www.nsa.gov/Press-Room/Press-Releases-Statements/Pre...

[2]: https://www.microsoft.com/en-us/security/blog/2026/11/09/for...

Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by tialaramex on Thursday November 19, 2026 @12:21PM (#50562993)
Java's String::toUpperCase appears to be quite a lot more complicated than the Rust but it is at least all Java and thus without careful inspection I can assume it's memory safe.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by teaearlgraycold on Thursday November 19, 2026 @01:30PM (#50564080)
Unsafe rust is still safer than normal C.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by jerf on Thursday November 19, 2026 @01:50PM (#50564412)
Do you run on CPUs based on the von Neumann architecture?

If so, those are built on unsafe operations internally.

Safety is a lot more complicated than "whether it is in an unsafe block of code in Rust". If you insist that an unsafe primitive can not be handled well enough to become "safe" by some definition of safe then you collapse the entire programming language hierarchy into "everything is completely unsafe". Which may, from a certain point of view, be true, but isn't a particularly useful classification scheme.

Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by afdbcreid on Thursday November 19, 2026 @03:44PM (#50566098)
Arrays in Java (a loose equivalent of `Vec`) is a runtime primitive and implemented in a memory-unsafe language. References (loose equivalent of `Box` and `Arc`) as well. Java's `synchronized` (a loose equivalent to `Mutex`) as well. Those are not good counterexamples.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by pron on Thursday November 19, 2026 @09:11AM (#50560355)
I didn't say there's a lot of unsafe (by whatever measure you consider that to be). I said there's a lot more than in Java.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by millerm on Thursday November 19, 2026 @09:40AM (#50560728)
The JVM is written in an unsafe language. That's where these unsafe calls occur. Clients of these APIs have no control there. Java code itself is safe.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by pron on Thursday November 19, 2026 @10:57AM (#50561774)
> That's where these unsafe calls occur.

No, it's not. A relatively common case for unsafe in Rust is in data structures. The data structures in the Java runtime are all written in Java and has almost no use of unsafe (there might be a few, but not becsause of language limitation, but because of initialisation order).

As for the JVM, much of it is a compiler. It doesn't matter what language it's written in, as it generates machine code. Indeed, the vulnerability disclosed yesterday was in a compiler intrinsic, but those are just as common in Rust.

Other than that, the other big piece in the JVM is memory management, and it does, indeed, use C and C++ for memory management, but Rust also uses C (the various implementations of malloc/free in whatever runtime the Rust program is using; BTW, some popular malloc/free implementations are almost as big as Java's most complicated GC).

Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by afdbcreid on Thursday November 19, 2026 @03:52PM (#50566203)
Not accurate. Most datastructures that use unsafe in Rust are primitives; `Box`, `Vec`, `Rc`/`Arc`, `HashMap` and `BTreeMap`. Of those, only the equivalent to `HashMap` and `BTreeMap` are written in Java, and they can be written in safe Rust as well if you're willing to give up some of the performance (e.g. always initializing - thing that happens in Java as well). More complex data structures (e.g. graphs) can and often are implemented without unsafe at all.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by pron on Thursday November 19, 2026 @04:33PM (#50566723)
I know that you can write slow data structures in safe Rust, but the standard library's data structures are supposed to be efficient. Anyway, a quick look at how common unsafe is in Rust vs Java, both in the standard library and in applications, and you'll see that it's much more common in Rust.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by afdbcreid on Thursday November 19, 2026 @03:56PM (#50566251)
> BTW, some popular malloc/free implementations are almost as big as Java's most complicated GC

I'm pretty sure that's incorrect by a wide margin, and that all non-nop GCs java has are as large as at least some popular allocators.

Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by pron on Thursday November 19, 2026 @04:31PM (#50566699)
Then you're in for a surprise. Take a look at TCMalloc and jemalloc. They're almost the size of HotSpot's most complex GC, then non-pause ZGC.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by pjmlp on Friday November 20, 2026 @02:09AM (#50571155)
Not all JVM implementations, there are multi-circular implementations in Java, starting with JikesRVM almost 20 years ago already, whose work with the MMtk memory allocator was later inspired a Rust version thereof.
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by gavinray on Thursday November 19, 2026 @12:23PM (#50563018)
Take a peek into the Rust stdlib method implementations. The lang is built on a house of "unsafe".
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by afdbcreid on Thursday November 19, 2026 @03:53PM (#50566216)
So is the JVM, and?
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by rurban on Friday November 20, 2026 @01:15PM (#50579292)
And they are unsafe, marketed as safe. Liars
Re:Ruby2ßhell: Pre-authentication RCE on stock Rails by charcircuit on Thursday November 19, 2026 @05:34PM (#50567471)
>which need to be written in assembly to avoid timing attacks

Assembly provides no timing guarantees. You will want something higher level built on top of assembly that can guarantee it for a specific processor.