News for hackers. Stuff that matters.
Re:Nx compromised: malware uses Claude code CLI to explore t... by cedws on Wednesday August 27, 2025 @09:56AM (#45039767)
Rust makes me especially nervous due to the possibility of compile-time code execution. So a cargo build invocation is all it could take to own you. In Go there is no such possibility by design.
Re:Nx compromised: malware uses Claude code CLI to explore t... by exDM69 on Wednesday August 27, 2025 @10:12AM (#45040017)
The same applies to any Makefile, the Python script invoked by CMake or pretty much any other scriptable build system. They are all untrusted scripts you download from the internet and run on your computer. Rust build.rs is not really special in that regard.

Maybe go build doesn't allow this but most other language ecosystems share the same weakness.

Re:Nx compromised: malware uses Claude code CLI to explore t... by pdw on Wednesday August 27, 2025 @11:09AM (#45040796)
Right, people forget that the xz-utils backdoor happened to a very traditional no-dependencies C project.
Re:Nx compromised: malware uses Claude code CLI to explore t... by theteapot on Wednesday August 27, 2025 @02:57PM (#45043570)
xz-utils has a ton of build dependencies. The backdoor implant exploited a flaw in an m4 macro build dep.
Re:Nx compromised: malware uses Claude code CLI to explore t... by cedws on Wednesday August 27, 2025 @10:23AM (#45040142)
Yes but it's the fact that cargo can pull a massive unreviewed dependency tree and then immediately execute code from those dependencies that's the problem. If you have a repo with a Makefile you have the opportunity to review it first at least.
Re:Nx compromised: malware uses Claude code CLI to explore t... by pharrington on Wednesday August 27, 2025 @11:01AM (#45040664)
You are allowed to read Cargo.toml.
Re:Nx compromised: malware uses Claude code CLI to explore t... by cedws on Wednesday August 27, 2025 @11:52AM (#45041347)
Cargo.toml does not contain the source code of dependencies nor transient dependencies.
Re:Nx compromised: malware uses Claude code CLI to explore t... by magackame on Wednesday August 27, 2025 @12:49PM (#45042044)
Welp, `cargo tree`, 100 nights and 100 coffees then it is
Re:Nx compromised: malware uses Claude code CLI to explore t... by marshray on Wednesday August 27, 2025 @05:39PM (#45045623)
Yes!

I sometimes set up a script that runs several variations on 'cargo tree', as well as collects various stats on output binary sizes, lines of code, licenses, etc.

The output is written to a .txt file that gets checked-in. This allows me to easily observe the 'weight' of adding any new feature or dependency, and to keep an eye on the creep over time as the project evolves.

Re:Nx compromised: malware uses Claude code CLI to explore t... by johnisgood on Thursday August 28, 2025 @04:50AM (#45049924)
You will need something stronger than caffeine.
Re:Nx compromised: malware uses Claude code CLI to explore t... by duped on Wednesday August 27, 2025 @12:20PM (#45041698)
Do you review the 10k+ lines of generated bash in ./configure, too?
Re:Nx compromised: malware uses Claude code CLI to explore t... by cozzyd on Wednesday August 27, 2025 @09:16PM (#45047213)
./configure shouldn't be in your repo unless it's handwritten
Re:Nx compromised: malware uses Claude code CLI to explore t... by johnisgood on Thursday August 28, 2025 @04:52AM (#45049931)
Pretty much. It is called "autotools" for a reason.

Theoretically you should be able to generate the configuration scripts through "autoconf" (or autoreconf), or generate Makefile.in for configure from Makefile.am using "automake", etc.

Re:Nx compromised: malware uses Claude code CLI to explore t... by Bridged7756 on Wednesday August 27, 2025 @10:24AM (#45040167)
In JavaScript just the npm install can fuck things up. Pre-install scripts can run malicious code.
Re:Nx compromised: malware uses Claude code CLI to explore t... by pharrington on Wednesday August 27, 2025 @10:59AM (#45040638)
You're confusing compile-time with build-time. And build time code execution exists absolutely exists in go, because that's what a build tool is. https://pkg.go.dev/cmd/go#hdr-Add_dependencies_to_current_mo...
Re:Nx compromised: malware uses Claude code CLI to explore t... by TheDong on Wednesday August 27, 2025 @11:19AM (#45040916)
I think you're misunderstanding.

"go build" of arbitrary attacker controlled go code will not lead to arbitrary code execution.

If you do "git clone attacker-repo && cargo build", that executes "build.rs" which can exec any command.

If you do "git clone attacker-repo && go build", that will not execute any attacker controlled commands, and if it does it'll get a CVE.

You can see this by the following CVEs:

https://pkg.go.dev/vuln/GO-2023-2095

https://pkg.go.dev/vuln/GO-2023-1842

In cargo, "cargo build" running arbitrary code is working as intended. In go, both "go get" and "go build" running arbitrary code is considered a CVE.

Re:Nx compromised: malware uses Claude code CLI to explore t... by thayne on Wednesday August 27, 2025 @05:07PM (#45045296)
But `go generate` can, and that is required to build some go projects.

It is also somewhat common for some complicated projects to require running a Makefile or similar in order to build, because of dependencies on things other than go code.

Re:Nx compromised: malware uses Claude code CLI to explore t... by TheDong on Wednesday August 27, 2025 @07:50PM (#45046699)
The culture around "go generate" is that you check in any files it generates that are needed to build.

In fact, for go libraries you effectively have to otherwise `go get` wouldn't work correctly (since there's no way to easily run `go generate` for a third-party library now that we're using go modules, not gopath).

Have you actually seen this in the wild for any library you might `go get`? Can you link any examples?

Re:Nx compromised: malware uses Claude code CLI to explore t... by thayne on Thursday August 28, 2025 @12:54AM (#45048517)
> Have you actually seen this in the wild for any library you might `go get`?

Not for a library, but I have for an executable. Unfortunately, I don't remember what it was.

Re:Nx compromised: malware uses Claude code CLI to explore t... by cedws on Wednesday August 27, 2025 @11:55AM (#45041386)
I don't really get what you're trying to say, go get does not execute arbitrary code.
Re:Nx compromised: malware uses Claude code CLI to explore t... by goku12 on Wednesday August 27, 2025 @12:55PM (#45042114)
Build script isn't a big issue for Rust because there is a simple mitigation that's possible. Do the build in a secure sandbox. Only execution and network access must be allowed - preferably as separate steps. Network access can be restricted to only downloading dependencies. Everything else, including access to the main filesystem should be denied.

Runtime malicious code is a different matter. Rust has a security workgroup and their tools to address this. But it still worries me.

Re:Nx compromised: malware uses Claude code CLI to explore t... by fluoridation on Wednesday August 27, 2025 @06:34PM (#45046170)
Does it really matter, though? Presumably if you're building something is so you can run it. Who cares if the build script is itself going to execute code if the final product that you're going to execute?
Re:Nx compromised: malware uses Claude code CLI to explore t... by johannes1234321 on Wednesday August 27, 2025 @09:59PM (#45047492)
With a scripting language it can matter: If I install some package I can review after the install before running or run in a container or other somewhat protected ground. Whereas anything running during install can hide all trades.

Of course this assumption breaks with native modules and with the sheer amount of code being pulled in indirectly ...