Live data from Hacker News

Curl to shell isn't so bad

arp242.net

181–190 of 201 posts

Re: Curl to shell isn't so bad

#181
post #176
post #172

Earlier quoted context omitted.

The author's rebuttal to user agent attack doesn't rely on how the server decides what content to serve, and so is naturally generalizable to the timing attack. It's unfortunate how that section is named, because it fools people who didn't read the article into thinking they had a novel counterpoint, when in fact the author already anticipated their exact argument.

Their argument is this: > you’re already trusting the vendor and site, and you’re already going to run the software that install.sh downloads. I don't see how this makes sense? People do check what they run, and especially for sudo-calling commands.

If the folks at rust-lang.org are malicious and willing to put in some extremely customized web-server logic to serve up evil code when they think it won't be noticed, why wouldn't they just sneak it into ./configure or some unnoticed corner of the compiler's source or the standard library or a precompiled binary?

To be clear, when I go to rust-lang.org, my goal is to download a large amount of extremely complex code that I never plan to audit myself and run it repeatedly on my computer, plus also trust it to download even more code that for the most part I plan to never read, and finally I'm going to trust it to take code and turn it into binaries which at least some of the time will run as root. In fact, it's very hard for me to imagine a scenario where an attacker is able to implement the timing attack in the grandparent post (which, to be clear, is very cool and clever and interesting), but is unable to pwn my computer in a huge number of ways that are both technically simpler and harder for me to detect.

The OP's point, as I understand it, isn't that it's impossible to pwn people via `curl | sh`, it's that in many cases, such an attack doesn't fit into a reasonable threat model.

Re: Curl to shell isn't so bad

#182
post #140

Curl to shell is a result of Linux's fragmentation. It's the only way to provide a simple install process.

If I were trying to distribute a package on Linux I’d be pretty intimidated by the number of package managers. I might start with Debian. Do an alpine package, then nope out.

If the app was a server instead of a cli, I’d start with a docker image. I ended up giving up on installing Erlang on my little embedded system and went with the docker image instead.

Re: Curl to shell isn't so bad

#183
post #7

I disagree with some of this, I.e paste jacking. Plenty of software projects put more care and focus into their software and not in their website, if you're running a vulnerable version of Wordpress or whatever CMS it'd be easy for someone to insert something malicious without being noticed whereas something that modified your code would show up in git, code reviews etc

Pastejacking should be mitigated if you use zsh, as it will never run pasted commands automatically. From quick test it seems that recent(?) versions of bash also implemented this feature and have it enabled by default. I don't know about fish or other shells.

Are you talking about the shell or the terminal protecting against paste jacking? I'm aware of terminals now protecting against this.

Re: Curl to shell isn't so bad

#184
post #7

I disagree with some of this, I.e paste jacking. Plenty of software projects put more care and focus into their software and not in their website, if you're running a vulnerable version of Wordpress or whatever CMS it'd be easy for someone to insert something malicious without being noticed whereas something that modified your code would show up in git, code reviews etc

How is this any different from just downloading a binary from their website and running it? Which people have been doing for ages?

It's different because in a lot of cases there are more layers of security in place that haven't been discussed.

For instance it would be typical in the past to sign the packages/software and publish the public key either to the site or somewhere else. Private keys used to sign the software would never touch the website infrastructure and would live on, typically, much more secure build or sign-only infrastructure.

The public keys used to verify the software could also be delivered through a separate channel, signed by a trusted third party, and etc. With Trust on First Use(TOFU) you'd trust the key when you first obtain it and be notified if the key ever changed unexpectedly.

I agree with the general point of this article. This is the weakest part of the arguments IMHO.

Re: Curl to shell isn't so bad

#185

Earlier quoted context omitted.

Conda has an .exe installer on Windows and a .pkg installer on macOS. Both signed by Anaconda, Inc. for the OS. There are RPM and deb bootstrap repos for Linux. Then there’s also the .sh shar file installer.

It would be nice to have something like a fusion of conda and apt to work right out of the box on distros like Ubuntu. Like an "apt install --user". I don't understand why we need root rights to install programs that will not need root rights to run anyway. Seems like a huge and obvious oversight to me. I guess it's not a big pain point because in most cases people use their own machines and have root access. Not alw…

I have been wondering this for ages. Just last week I had to manually set up KeePass, VSCode, IntelliJ, Guitar (git ui) by manually unpacking tarballs (luckily already built) into ~/bin. Guitar luckily had an AppImage which worked beautifully as a single executable.

For that reason alone I'm a huge fan of AppImage above snaps and flatpaks.

Re: Curl to shell isn't so bad

#187
post #140

Curl to shell is a result of Linux's fragmentation. It's the only way to provide a simple install process.

If I were trying to distribute a package on Linux I’d be pretty intimidated by the number of package managers. I might start with Debian. Do an alpine package, then nope out. If the app was a server instead of a cli, I’d start with a docker image. I ended up giving up on installing Erlang on my little embedded system and went with the docker image instead.

Props for mentioning Alpine, the only sane distro.

Re: Curl to shell isn't so bad

#188

Earlier quoted context omitted.

Based on experience, brew will place files in a place that I expect. I can’t predict where a shell script will scribble or what other changes it will make to my system.

isn't brew itself a curl'd script?

Installing brew is basically curl|ruby. But that's somewhat forgivable because you need to install a package manager before you can use a package manager.

Re: Curl to shell isn't so bad

#189
post #161
post #150

Earlier quoted context omitted.

I simplified a bit. Yes, Debian testing gets new updates, which means it gets security updates. Eventually. It can (and does) take days for critical security updates to migrate from unstable to testing after stable has access to patched version. https://www.debian.org/security/faq.en.html#testing > there is a minimum two-day migration delay

> It can (and does) take days for critical security updates to migrate from unstable to testing after stable has access to patched version. Now you are making way to many assumptions with this phrase. Do you really think that make sense to have critical security updates for stable having to pass through the normal release cycle ? :)

I'm sorry, was my message unclear? There were no assumptions.

I'm speaking from experience that when I was using Debian testing I would usually receive security updates days after they are available for Debian stable.

Obviously security updates for stable do not go through normal release cycle.

I wasn't commenting stable security updates, but lack of timely access to security updates on testing.

Re: Curl to shell isn't so bad

#190

Earlier quoted context omitted.

It seems like you're assuming that there's someone vetting these packages. For enterprise distros like Red Hat that's certainly true. Community package maintainers in, for example, the Debian project provide some safety as well. But there are plenty of package managers where that's just not the case. In the case of Homebrew, the package manager pulls down the program directly from upstream and installs it. It's exact…

> In the case of Homebrew, the package manager pulls down the program directly from upstream and installs it. Sure, in the most basic case it does this, but even in the most basic case it does more than that. At minimum it also verified the download matches a known good hash. The important part (to me) is that Homebrew also ensures the package installed conforms to Homebrew’s standard. There’s a lot of standards (ins…

How exactly is the file going to get tampered with if you're using curl-to-sh? Everyone uses HTTPS nowadays. Validating the hash is not really doing anything significant.

As for ensuring that the package is well-behaved, could you elaborate on that? I'm not aware of Homebrew doing something like chrooting to /usr/local before running the install script. And the install script can do anything as your local user, same as curl-to-sh. Perhaps the Homebrew maintainers would catch something nefarious in the formula itself, but given that most formulas download code from the Internet and run it, that's not much help.

Post reply on HN