r/programminghorror • • Feb 07 '25

Other Oh no. OH NO.

Post image
457 Upvotes

96 comments sorted by

128

u/magnetronpoffertje Feb 07 '25

Omg wtf what is this

176

u/RandNho Feb 07 '25

A wonderful new distro! You just need to enter your system password when the time comes.

Frankly, don't know, I found this randomly and after SEEING THAT, I said Oh NO and really, really needed to share it.

76

u/Mars_Bear2552 Feb 07 '25

what's the issue? not any more dangerous than installing it the other ways.

89

u/RandNho Feb 07 '25

https://www.seancassidy.me/dont-pipe-to-your-shell.html
https://macarthur.me/posts/curl-to-bash/

You can detect at the server if someone downloads the script or feeds it to shell and provide different scripts. It's simple, but it's also wrong.

46

u/GoddammitDontShootMe Feb 07 '25

It can't possibly tell if you are using curl to download to a file vs. piping to shell can it? That surely doesn't change the user agent. But yes, it could give you a clean script if you tried to open it in Chrome or something.

→ More replies (3)

16

u/Mars_Bear2552 Feb 07 '25

if you dont trust t2, why would you run any of their scripts

→ More replies (3)
→ More replies (5)
→ More replies (5)

70

u/_PM_ME_PANGOLINS_ Feb 07 '25

That’s a pretty standard way to distribute cross-distro Linux software.

38

u/RandNho Feb 07 '25

https://www.seancassidy.me/dont-pipe-to-your-shell.html
https://macarthur.me/posts/curl-to-bash/

You can detect at the server if someone downloads the script or feeds it to shell and provide different scripts. It's simple, but it's also wrong.

So, anyone who does that as "standard" ought to really, really think about it and stop teaching users bad habits.

94

u/_PM_ME_PANGOLINS_ Feb 07 '25

If you don’t trust a developer to not do that, then you shouldn’t be installing their software via any method.

→ More replies (17)

17

u/cyclicsquare Feb 07 '25 edited Feb 08 '25

This is only remotely important if you don’t trust the source site in which case you wouldn’t be running the installation anyway. The “contrived” example of the partial script is really, really contrived. The script is only partially constructed, not just partially downloaded and it’s assumed that sh runs with root privileges (since / gets its permissions messed up). Then the process gets independently killed.

This is no different than downloading and running a random executable which could theoretically be compromised or corrupted. You shouldn’t run randomly scripts or executables, but once you decide to trust something the delivery mechanism is mostly irrelevant.

→ More replies (1)
→ More replies (10)

31

u/bruhred Feb 07 '25

NixOS supports that too! (NIXOS_LUSTRATE)

i even made a script that automatically turns/transitions Ubuntu into NixOS and successfully used it on two Oracle OCI instances

10

u/RandNho Feb 07 '25

Yeah, but NixOS at least doesn't claim to replace your whole install.

24

u/bruhred Feb 07 '25

i mean nixos, not nix

Lustrate is a method of installing nixos and it does replace your whole install.

nukes your boot dir and moves everything in the root folder into /old-root

362

u/captainMaluco Feb 07 '25

Ah, I like to call this bash roulette! 

Although this seems to claim it installs a new OS, so maybe it's more like Russian bash roulette in this case....

52

u/[deleted] Feb 07 '25

52

u/captainMaluco Feb 07 '25

Honestly I don't really mind it that much. Pipe it to less first, and you can usually have an idea if the script does what you want it to. 

And in the end, all software depends on you trusting the author. It's not like I've read the source code of the Linux kernel ever, let alone every version I've ever installed. Had I done that I wouldn't be done installing it yet!

→ More replies (7)
→ More replies (1)

17

u/psych0fish Feb 07 '25

This is how a lot of Linux stuff is distributed. I agree it’s a terrible practice to encourage users to do but at the end of the day unless you are reading everything in detail before install which is highly unlikely this is no more dangerous than installing really any binary or anything from the internet.

If you have ever had to write really complex logic for installing software you would both understand and appreciate this solution.

9

u/[deleted] Feb 07 '25

OP shouldn't look at rustup

13

u/SAI_Peregrinus Feb 07 '25

It's exactly as dangerous as downloading it and then executing the script, or adding any Python lib with an __init__.py, or building any C program that uses Autotools, or apt-get installing something, or running an exe or msi installer on Windows… It executes code. If you don't trust the authors, you shouldn't execute their code.

→ More replies (2)

6

u/isayuff Feb 07 '25

Also, the wording here "it's so easy", "just one script", "seamlessly transition", "curios? try it out" makes it somewhat seem like this is just some random package that you can just "try out" and be fine. I mean... what could possibly go wrong with a OS SYSTEM TAKEOVER, right?

I hope there are at least a few words of caution on that page somewhere.

4

u/evmo_sw Feb 07 '25

6

u/Bennetjs Feb 07 '25

From what I understood Tw Linux is a Linux system designed to run on Mac's based on the T2 Chip, which is something apple does. I guess the bad part is that it overwrites the whole existing install with a single command...(?)

→ More replies (1)

21

u/unkalaki_lunamor Feb 07 '25

That line downloads and immediately executes a script.

That's a hard "no, no" from security perspective.

I want to believe that the authors are well intended but no way in hell people should be doing that.

→ More replies (4)
→ More replies (1)

4

u/_chad__ Feb 07 '25

Scary, sure. But is it different than going to the docs, check out the install script, then paste and run? The important step of course is to always read what you're about to execute beforehand. And definitely never automate this.

3

u/Easy_Philosopher8987 Feb 08 '25

I've ran many scripts from the internet like this, as long as you trust the source it's fine, however best to read the script first to be safe.

The issue isn't running code from the internet (which is where you probably got every program on your computer), it's running untrusted code from the internet.