Live data from Hacker News

"So that a truncated partial download doesn't end up executing half a script"

tailscale.com

21–30 of 87 posts

Re: "So that a truncated partial download doesn't end up executing half a script"

#21

Don't pipe curl/wget a script to a shell without reading what you've downloaded. This should be common sense. Do `wget $url; most install.sh` and only if you're satisfied with what you read , execute `sh install.sh`.

She'll is complicated enough that I suspect it would be quite easy to trick anyone who does a cursory glance over the script, unless they are an absolute shell master.

Re: "So that a truncated partial download doesn't end up executing half a script"

#22
post #16

If only there was a way to transactionally run shell scripts such that if they don't complete fully, the changes are automatically reverted. Edit: cue the HN responses to use nix, and other solutions

Make curl | sh automatically upgrade the user's system to nix?

Nix, as the name implies, it's a moissanite, a fuck-o, a bullshit.

Re: "So that a truncated partial download doesn't end up executing half a script"

#23
post #10

Earlier quoted context omitted.

It is an awful habit of some open source projects to have the official way to install their software be to execute a shell script from the Internet. Nobody reads it, as they are usually quite complex and given the xz situation a well crafted shell script can seem harmless while being very dangerous.

Didn't the xz situation kinda prove that even reading the script is probably not gonna do you a lot of good if you're up against someone smart?

The xz situation proved the opposite: if you're up against someone smart, you won't read the script (and you'll think you have).

Re: "So that a truncated partial download doesn't end up executing half a script"

#24
post #10

Earlier quoted context omitted.

It is an awful habit of some open source projects to have the official way to install their software be to execute a shell script from the Internet. Nobody reads it, as they are usually quite complex and given the xz situation a well crafted shell script can seem harmless while being very dangerous.

Didn't the xz situation kinda prove that even reading the script is probably not gonna do you a lot of good if you're up against someone smart?

Exactly, also if you already go thinking in adversarial terms when using something, why would you even use the thing to begin with?

Maybe I'm too naïve.

Re: "So that a truncated partial download doesn't end up executing half a script"

#25

Earlier quoted context omitted.

Having a distribution maintainer provide official packages is the best way.

Thats who pushed XZ out as far as it went. Everyone is asleep at the wheel.

A single incident. How many incidents in how many decades have there been?

Re: "So that a truncated partial download doesn't end up executing half a script"

#26

Earlier quoted context omitted.

It is an awful habit of some open source projects to have the official way to install their software be to execute a shell script from the Internet. Nobody reads it, as they are usually quite complex and given the xz situation a well crafted shell script can seem harmless while being very dangerous.

How is this different to Windows users downloading a .exe file and running it?

It's better because you almost never need to give root permissions to the installer, unlike on Windows

Re: "So that a truncated partial download doesn't end up executing half a script"

#27

Earlier quoted context omitted.

It is an awful habit of some open source projects to have the official way to install their software be to execute a shell script from the Internet. Nobody reads it, as they are usually quite complex and given the xz situation a well crafted shell script can seem harmless while being very dangerous.

How is this different to Windows users downloading a .exe file and running it?

I skim little python or bash scripts after downloading them. Therefore, there’s at least one person who does it… sometimes. Nobody checks an exe!

Mostly it is the same though shrug. There thankfully don’t seem to be many hackers going after the niche of desktop Linux users.

Re: "So that a truncated partial download doesn't end up executing half a script"

#28

Earlier quoted context omitted.

It is an awful habit of some open source projects to have the official way to install their software be to execute a shell script from the Internet. Nobody reads it, as they are usually quite complex and given the xz situation a well crafted shell script can seem harmless while being very dangerous.

How is this different to Windows users downloading a .exe file and running it?

Windows checks the code signing certificate of the exe, and if it isn't present and the binary not widely used shows you a big scary warning to discourage you from running it. And if the exe is signed that at least tells you where to send the police after you were infected.

Of course open source projects rarely sign their exes because those certificates are expensive ($300+/year).

Re: "So that a truncated partial download doesn't end up executing half a script"

#30

Don't pipe curl/wget a script to a shell without reading what you've downloaded. This should be common sense. Do `wget $url; most install.sh` and only if you're satisfied with what you read , execute `sh install.sh`.

Well, you're going to run the thing the script downloaded with exactly the same user and privileges as the script you're running. Unless you're doing a full audit on all the code and not only a cursory look on the installation script, this looks to me more like security theatre.
Post reply on HN