News for hackers. Stuff that matters.
Re:Malicious Rust crate Arrayref runs a build-time payload by tancop on Thursday August 20, 2026 @10:45AM (#49375354)
We need effect based languages now. It's the only way to guarantee policies like no network, no file access, no unsafe code or FFI for a library before it even compiles. If anyone from epic is reading this please give us a timeline for open sorucing the Verse compiler.

In the mean time I think it's possible to hack Cargo and run all build scripts in a microVM. The blast radius will be limited to malicious code in the binary instead of uploading all your CI secrets and deleting the whole hard drive.

Re:Malicious Rust crate Arrayref runs a build-time payload by jmull on Thursday August 20, 2026 @12:04PM (#49376509)
I think this is an attractive chimera, but will never be popular and will only be used much in specific domains.

The thing is, trust is a massive optimization. If you believe code from X is competently made and not malicious, you can accept that code without any additional overhead. (Building trust is a significant effort, but trust begets trust, so there's a resonable path from starting small to scaling.)

It's not that these mechanisms that require less trust (none of them eliminate it, BTW, when you examine them) can't work. It's that they'll inevitably be outcompeted by trust-based systems (in most domains).

E.g., compare the effort of creating a new, full featured, general purpose language, promoting it, building and maintaining all the tooling and documentation around it to support it, etc to the effort of creating and maintaining a curated package repository of trusted packages (and/or adding trusted code to extend the standard library) for existing language X.

(It's not clear to me you could provide enough value from a new language focused on effects that you could convince any but a few from adopting it at all, even if it dropped from the sky fully formed with all tools, docs, etc. in place from day one.)

Re:Malicious Rust crate Arrayref runs a build-time payload by vaylian on Thursday August 20, 2026 @11:00AM (#49375614)
> It's the only way to guarantee policies like no network, no file access, no unsafe code or FFI for a library before it even compiles.

It's not the only way. You can sandbox processes. I think sandboxing is the much more reasonable approach, because in the end of the day, there are still closed-source software products where you can't demand that the manufacturers use certain language safety features.

Re:Malicious Rust crate Arrayref runs a build-time payload by kevincox on Thursday August 20, 2026 @11:35AM (#49376128)
Sandboxing the process only works well when the malware requires more capabilities than the software itself.

So if your software needs to make HTTP requests and read the filesystem then the malware will be able to make HTTP requests and read the filesystem, which is enough for a ton of malware. Sure, maybe you can limit the directories it can access a bit and possibly some sort of network filtering, but it isn't a silver bullet.

Capability security in-language would make a huge difference, because the more granular you "sandbox" the less likely it is that the compromised component has the access it wants. For example if the HTTP client library is compromised maybe it can't access the filesystem so can't steal your cookies. Or maybe like in this case no permissions were needed at all and despite the process having enough capabilities for malware this malware can at worst return bad values and try to chain this to an exploit which is far more difficult than just running it itself.

Re:Malicious Rust crate Arrayref runs a build-time payload by cpuguy83 on Thursday August 20, 2026 @11:51AM (#49376341)
The problem isn't the language here, it's cargo executing build.rs from dependencies which necessarily allows arbitrary code execution.
Re:Malicious Rust crate Arrayref runs a build-time payload by jaen on Thursday August 20, 2026 @04:42PM (#49380004)
(as I and others have mentioned in the thread): The attacker can just move the malicious code from build.rs to lib.rs (ie. build-time -> test/execution-time).

Then the problem is the language, as the grandparent observes.

Re:Malicious Rust crate Arrayref runs a build-time payload by cpuguy83 on Thursday August 20, 2026 @06:45PM (#49381279)
Sure, but I don't expect build to execute arbitrary code. That's a big difference.

It's like if `git clone` ran random stuff from the cloned repo.

Re:Malicious Rust crate Arrayref runs a build-time payload by dwattttt on Thursday August 20, 2026 @04:54PM (#49380151)
Running what you've built when you've added a malicious dependency also causes arbitrary code execution.
Re:Malicious Rust crate Arrayref runs a build-time payload by throwaway894345 on Thursday August 20, 2026 @11:02AM (#49375651)
I don’t even understand what a capability based language is, but presumably closed source software wouldn’t apply here? Is it common for closed source software to give the source code to customers to build?
Re:Malicious Rust crate Arrayref runs a build-time payload by bluGill on Thursday August 20, 2026 @11:05AM (#49375692)
> Is it common for closed source software to give the source code to customers to build?

Yes, somewhat common. I work in embedded, and where a supplier gives us the ability to build their code it is a lot easier for us to deal with the next time we need a new build from them.

Re:Malicious Rust crate Arrayref runs a build-time payload by 7373737373 on Thursday August 20, 2026 @02:48PM (#49378552)
Closed source software could apply too, if the execution model supports it (e.g. WebAssembly). Just because the format is binary and "unreadable", its permissions (accessible functions) don't have to be
Re:Malicious Rust crate Arrayref runs a build-time payload by rrook on Thursday August 20, 2026 @11:41AM (#49376201)
Some shameless self promo - I'm working on one!

https://hale-lang.org/proof/

Re:Malicious Rust crate Arrayref runs a build-time payload by jooops1 on Thursday August 20, 2026 @11:48AM (#49376302)
Can you explain how an effect based language helps here? Also to note filesystem access can allow network access on many systems and also the other way around.
Re:Malicious Rust crate Arrayref runs a build-time payload by insanitybit on Thursday August 20, 2026 @10:51AM (#49375450)
https://github.com/insanitybit/witchy

This is why I'm building this language. It's capabilities based. Build scripts can't just do whatever the hell they want to, everything is auditable, and it layers its sandboxing.

It's for fun and anyone looking should understand that this is AI driven building with human driven design, but the goal is to demonstrate.

Re:Malicious Rust crate Arrayref runs a build-time payload by rtfeldman on Thursday August 20, 2026 @10:57AM (#49375546)
I think the only language that's used in production where malicious dependencies can't do arbitrary effects is https://roc-lang.org - but it's a pre-0.1.0 language and as such its production usage is extremely minimal for now.
Re:Malicious Rust crate Arrayref runs a build-time payload by prpl on Thursday August 20, 2026 @11:15AM (#49375828)
I have been working on a cross platform way of sandboxing without a VM:

https://github.com/brianv0/formwork

Re:Malicious Rust crate Arrayref runs a build-time payload by throwaway894345 on Thursday August 20, 2026 @11:00AM (#49375622)
Why does every build have the ability to run arbitrary code by default in the first place? That seems like something you should opt into only under very specific scenarios and even then it should probably be built around a WASM sandbox or microVM (as the parent suggested).
Re:Malicious Rust crate Arrayref runs a build-time payload by bluGill on Thursday August 20, 2026 @11:15AM (#49375825)
Because many many builds end up doing something just a little weird that the build system cannot handle by default. Ideally the build system would be fully property/dependency based and so it wouldn't have to run arbitrary code. In the real world everybody has something weird about their build that the build system cannot make work.

This is partially because for nearly every project the build system is something they need and don't care about. When they need something weird they hack just enough to make it work and never ask "how should the build system change so that this was a property instead of running code", and thus build systems are slow to improve. In a number of cases the build system did have a way to do that thing, but the person didn't know about it.

There are also a lot of code generators out there. I have yet to see a large project which didn't have their own code generator for something specific to their project (protobuf is an example from Google that has escaped and become useful elsewhere, but there are many others that are specific to one project. Yacc is from the 1970s, and stands for "yet another compiler compiler" - implying the idea was already common 50 years ago). You cannot have/use these useful tools without running arbitrary code.

Re:Malicious Rust crate Arrayref runs a build-time payload by skydhash on Thursday August 20, 2026 @11:26AM (#49375998)
I don't mind code execution as even make has shell scripting embedded, same thing with meson. My issue is with network access to download random stuff without it being declared somewhere and signed.

I'm using OpenBSD and the ports system set up two users `_pbuild` and `_pfetch` for building packages. The first one is for building and the sample `pf.conf` (firewall) forbid it from accessing the network. The second does fetch the files , but it's declarative with every files listed and signed. Even for languages like go and rust.

Fetching files while building is the bad idea there.

Re:Malicious Rust crate Arrayref runs a build-time payload by bluGill on Thursday August 20, 2026 @11:31AM (#49376063)
Good point. Many build systems also want to be a package manager, but the two are and should be separate. If you have a simple problem it makes things easy to combine them into one. However they need to be separate anyway, both for security and also to make other weird situations easier.
Re:Malicious Rust crate Arrayref runs a build-time payload by throwaway894345 on Friday August 21, 2026 @09:21AM (#49387689)
I mean, I understand the need for an escape hatch, but it’s strange to me that it’s the default and that it’s unsandboxed. Feels like build scripts should be treated like CGo in Go—a rare escape hatch that people strongly try to avoid so that downstream builds are better. To that end, Go doesn’t even have macros or code generation and it gets by reasonably well without any build scripts should support—I understand that Rust’s emphasis on systems programming probably drives more scenarios where build scripts are genuinely necessary, but I strongly suspect that, as with C and C++, making it easy for people to do weird stuff probably drives a lot of people to think they need to do weird stuff.
Re:Malicious Rust crate Arrayref runs a build-time payload by bluGill on Friday August 21, 2026 @10:58AM (#49389143)
Until a few years ago abuse of the escape hatch was seen as something theoretically possible but not realistic. Sadly attackers have abused trust and so even though most people are honest we can no longer trust anybody.
Re:Malicious Rust crate Arrayref runs a build-time payload by kibwen on Thursday August 20, 2026 @10:56PM (#49383181)
> Why does every build have the ability to run arbitrary code by default in the first place?

Nearly every time that you see a build script in use it's to support building C code, which has no standard build process and which often involves executing shell commands, and the shell itself is an arbitrary code execution environment with arbitrary access to the network.

Re:Malicious Rust crate Arrayref runs a build-time payload by burnt-resistor on Thursday August 20, 2026 @10:49AM (#49375422)
More than that, we need capability-based languages. No capability passed to it, no permission.
Re:Malicious Rust crate Arrayref runs a build-time payload by kibwen on Thursday August 20, 2026 @10:58AM (#49375578)
First we need capability-based OSes, like we should have had decades ago if worse-is-better hadn't stuck us with Unix. I don't need to care whether or not a program was written in a capability-aware language if the OS fundamentally takes care of that for me.
Re:Malicious Rust crate Arrayref runs a build-time payload by grommz on Thursday August 20, 2026 @11:56AM (#49376405)
HarmonyOS is a capability based OS. I don't know why anyone in China is still using Rust. The biggest social engineering hack was for the Rust team to convince developers that it is a safe language.
Re:Malicious Rust crate Arrayref runs a build-time payload by pjmlp on Thursday August 20, 2026 @02:33PM (#49378394)
Actually HarmonyOS NEXT is getting its language as well, Cangjie.

https://cangjie-lang.cn/en

https://cangjie-lang.cn/en/docs?url=%2F1.0.0%2Fuser_manual%2...

Re:Malicious Rust crate Arrayref runs a build-time payload by ptx on Thursday August 20, 2026 @11:14AM (#49375822)
FreeBSD does this with Capsicum: https://wiki.freebsd.org/Capsicum
Re:Malicious Rust crate Arrayref runs a build-time payload by burnt-resistor on Thursday August 20, 2026 @02:43PM (#49378483)
1. seL4 exists. I haven't seen much more formal and rigorous than it. Efforts have ported the Linux kernel and RTOS-things to it.

2. Add syscall(s) to POSIX, which encourages *nix adoption, with an API like the following:

- Drop capabilities for thread/process except allow list.

- Test if current thread/process has all listed capabilities.

- List should be able to represent capabilities and their attributes, much like a single unveil() OpenBSD call, maybe as an array of/pointer to struct.

- (Program crashes if syscall capability is missing.)

Re:Malicious Rust crate Arrayref runs a build-time payload by mike_hearn on Thursday August 20, 2026 @01:16PM (#49377441)
Re:Malicious Rust crate Arrayref runs a build-time payload by burnt-resistor on Thursday August 20, 2026 @02:11PM (#49378116)
No. Object-oriented brings things many languages cannot use. Also, that was a tl;dr fluff blog with barely any examples.
Re:Malicious Rust crate Arrayref runs a build-time payload by mike_hearn on Thursday August 20, 2026 @05:23PM (#49380465)
All languages in mainstream use are imperative and at least somewhat object oriented, other than SQL. But many of those don't have what it takes to implement capabilities (too flexible/dynamic).
Re:Malicious Rust crate Arrayref runs a build-time payload by burnt-resistor on Friday August 21, 2026 @06:48AM (#49386259)
No, this is false and you're using weasel words and creating a strawman.

I said add functions or capabilities to make it happen.

You don't read.

Re:Malicious Rust crate Arrayref runs a build-time payload by quotemstr on Thursday August 20, 2026 @10:51AM (#49375443)
MicroVM this, effects that --- can we discuss security without needing to invoke bay area buzzwords?

The idea is "least privilege", and we desperately need it in computing. The precise technical mechanism we use to achieve it is less important than committing to the idea that a dependency doesn't run with full privilege of its host program and an install script doesn't run with full privilege of the programmer.

The original Linux seccomp is old enough to drink. It's always been possible to do things like expand macros in a no-IO environment. Nobody's bothered to do it over the past two decades. Why would anyone bother in the next two decades?

Re:Malicious Rust crate Arrayref runs a build-time payload by insanitybit on Thursday August 20, 2026 @10:51AM (#49375460)
The technical mechanism is exactly the issue to figure out, there's a reason why projects don't have this and it's because different implementations have different tradeoffs.
Re:Malicious Rust crate Arrayref runs a build-time payload by quotemstr on Thursday August 20, 2026 @10:57AM (#49375549)
No, the reason people haven't been doing this -- and we've had technologies for ages -- is that it's a huge pain in the ass, a "tax", that it's hard to get developers inside a company to pay, much less participants in open source ecosystems.

Look at how snap, flatpak, etc. provoke people to just turn off security rather than deal with breakages.

A new language won't help because the problem is social, not technical.

FFS, you can't even get people to use filesystems via intermediate objects in today's languages. People think your language is broken if you don't have an ambient open(). You don't need a new language to enforce capability discipline. You need to whack people repeatedly with a cluebat until their laziness and brain damage abate.

Re:Malicious Rust crate Arrayref runs a build-time payload by insanitybit on Thursday August 20, 2026 @10:58AM (#49375576)
You can't simultaneously say that we've had the tech for years and also say that it doesn't work. We have not had the tech for years. x-plat sandboxing is extremely difficult, especially in a way that's performant.

Sandboxing almost always involves having a dedicated, privileged service, due to how operating systems have designed things. It requires platform specific code.

This is a technical problem and a social problem, there's zero reason to believe it's just one.

Re:Malicious Rust crate Arrayref runs a build-time payload by quotemstr on Thursday August 20, 2026 @11:02AM (#49375648)
The technology works fine if you use it in a disciplined way. The problem is that people don't! You're necessarily going to break programs if you put them in restricted environments. That's not the same as the restriction technology not working properly.

> Sandboxing almost always involves having a dedicated, privileged service, due to how operating systems have designed things.

Or just invoking bwrap. Or sandbox-execute. There's no performance overhead. Complexity is minimal. Just read current Codex source code. It's not so bad. People have been making these sandbox tools for AI agents for years. Just need to apply sandboxing to all domains.

You want some kind of silver bullet that makes code "safe" without anyone having to change anything? To prompt for nothing? To use no IPC portal? That's not happening.

The people saying we need a new language or something are half right. We don't need a new language. A pure library solution is fine! But people do need to do work to make an ecosystem based on capabilities and least privilege to work. And we need to tell people who refuse to do this work to go to hell.

A new language is neither necessary nor sufficient. What we need is new set of balls.

Re:Malicious Rust crate Arrayref runs a build-time payload by insanitybit on Thursday August 20, 2026 @11:32AM (#49376080)
> The technology works fine if you use it in a disciplined way.

Then obviously we have to discuss the implementation!

> Or just invoking bwrap. Or sandbox-execute. There's no performance overhead. Complexity is minimal. Just read current Codex source code. It's not so bad. People have been making these sandbox tools for AI agents for years. Just need to apply sandboxing to all domains.

Tools like bwrap literally could not have existed until very recently without also requiring suid/ privileges, and even today unprivileged user namespaces are not universally enabled. This is why the implementation matters. No, unprivileged sandboxing has not been around for years, especially not x-plat. bwrap is a perfect example of what I'm talking about, great reference - it either requires root or it requires unprivileged user namespaces and it's not x-plat. Great.

> You want some kind of silver bullet that makes code "safe" without anyone having to change anything? To prompt for nothing? To use no IPC portal? That's not happening.

I have no idea why you think I've said this, I'm pointing out that the implementation and technology matters deeply.

> The people saying we need a new language or something are half right. We don't need a new language. A pure library solution is fine! But people do need to do work to make an ecosystem based on capabilities and least privilege to work. And we need to tell people who refuse to do this work to go to hell.

Again, you can't say "this technology has existed for years! You can do it in a library!" and then say "but they don't!". You misunderstand the complexity and assert that it's merely a matter of will. It is both.

Re:Malicious Rust crate Arrayref runs a build-time payload by quotemstr on Thursday August 20, 2026 @11:35AM (#49376123)
Browsers have been sandboxing their tabs since 2008. Don't sit there and tell me that bwrap, sandboxing, whatever is some kind of recent innovation with uneven distro support.

And yes, bwrap needs root or namespaces. So what? So does sudo. Setuid binaries are as old as time.

You know what's also been around and doesn't require root? Landlock. Have you heard of it? Has anyone? There's a huge PR and visibility gap in this space. We don't have to invent some new thing. We have to get people to learn about what we already have and use it.

"Oh, the technology works, but it need setup! Oh, my distro doesn't enable it! Oh, it doesn't work out of the box with my code!"

This is a social problem. It's not a technology problem. It's people not wanting to do the work, not understanding what already exists, dismissing solutions based on non-problems (like bwrap needing privileges on some systems), and in general adopting an attitude of "no", not a can-do problem solving stance.

And we're supposed to solve this problem with let another precious little effects language or another fucking MicroVM environment? FFS.

We need unprivileged sandboxing!"

"Use bwrap"

"Nooo, that needs setuid root or file caps!!!1!1"

"So the problem is that bwrap is part of the TCB?"

"Yes. We need sandboxing that relies only on unprivileged code like the Linux kernel"

... the fuck?

You can't solve a social problem with technology.

Re:Malicious Rust crate Arrayref runs a build-time payload by insanitybit on Thursday August 20, 2026 @11:55AM (#49376385)
> Browsers have been sandboxing their tabs since 2008.

Yes, it's an amazing feat that has cost billions and led to major features like seccomp v2, ptrace sandboxing, etc. Do you know the history of browser sandboxing? It's pretty complex, a major technical feat.

> Don't sit there and tell me that bwrap, sandboxing, whatever is some kind of recent innovation with uneven distro support.

I can tell you that unprivileged sandboxing is not only new, it's ongoing and nascent work and not commonplace at all.

> And yes, bwrap needs root or namespaces. So what? So does sudo. Setuid binaries are as old as time.

These are massive footguns and issues for deploying code... You don't get that? Again, implementations have tradeoffs.

> You know what's also been around and doesn't require root? Landlock.

lol it is SO NEW what the fuck dude?

> Have you heard of it? Has anyone?

Yes, I use it!

> "Oh, the technology works, but it need setup! Oh, my distro doesn't enable it! Oh, it doesn't work out of the box with my code!"

> This is a social problem.

Yeah these sound like social problems if you have literally no idea what you're talking about lmfao. IT's BOTH.

Your ignorance is blatant and your position is dead in the water.