8 ms·
Vet is a safety net for the curl | bash pattern
- lodefende 1y agoHahaah sistema opcional?
- chromehearts 1y agohttps://pi-hole.net/blog/2016/07/25/curling-and-piping-to-bash/#page-content https://pi-hole.net/blog/2016/07/25/curling-and-piping-to-ba... A good read
- Kinrany 1y agoWhat does it do about the curl|bash itself downloading software at runtime?
- devmor 1y agoI like this. Convincing people not to pipe remote scripts to their shell seems like a lost battle, so making it safer to do is a very good mitigation strategy.
- superkuh 1y agoIndeed. curl | sh is literally the #1 recommended and most common way to install the rust development toolchain (because it changes too rapidly to effectively be in any repos). It's crazy that a language that prioritizes security so highly in it's design itself is only compiled through such insecure methods. Ref: https://www.rust-lang.org/tools/install https://www.rust-lang.org/tools/install >Using rustup (Recommended) >It looks like you’re running macOS, Linux, or another Unix-like OS. To download Rustup and install Rust, run the following in your terminal, then follow the on-screen instructions. See "Other Installation Methods" if you are on Windows. >curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- goku12 1y agoThat's a misunderstanding. You can completely avoid the curl bash pattern if you can install the rustup binary and setup the relevant environment variables (like PATH) manually. Everything else, including cargo and various toolchain versions are installed and managed by rustup. And rustup doesn't have as much churn as the rest of the tools. So, rustup can be (and is) packaged for many distributions. That's all that's necessary in practice. They recommend curl bash because it automates all the above in a single script without exposing such lengthy explanations to a beginner.
- superkuh 1y ago>You can completely avoid the curl bash pattern if you can install the rustup binary and setup the relevant environment variables (like PATH) manually. Are you saying that if you avoid the curl bash pattern then you can avoid the curl bash pattern? This is true, and trivial, and completely irrelevant to what the rust website recommends and what most people do. There's definitely been a misunderstanding. The misunderstanding is that you think people are installing rust from rustup from their repos. The website shows you this is not the most common case. I do get your point that it doesn't have to be this way anymore. That rustup itself could be in repos and still work (even rustc/etc can't). But this is not not how it has been done for rust's entire existence and change is slow and hard. Is there a single distro that does do this now?
- kibwen 1y ago> That rustup itself could be in repos and still work So surely you acknowledge that rustup not being in any given distro's repo isn't something that the Rust developers have control over? How do you expect the Rust devs to distribute the compiler? If you want to build from source, that's extremely easy. For people who want convenient binaries, Rust also offers binaries via the most convenient means available, which is curl-to-bash. This isn't a security flaw any more than running the compiler itself is.
- veber-alex 1y ago
- jjgreen 1y agoSplendid idea, especially since "curl | bash" can be detected on the server [1] (which if compromised could serve hostile content to only those who do it) [1] https://web.archive.org/web/20250622061208/http://idontplaydarts.com/2016/04/detecting-curl-pipe-bash-server-side/ https://web.archive.org/web/20250622061208/http://idontplayd...
- falcor84 1y agoYes, ... but if the server is compromised, they could also just inject malware directly into the binary that it's installing, right? As I see it, at the end of the day you're only safe if you're directly downloading a package whose hash you can confirm via a separate trusted source. Anything else puts you at the mercy of the server you're downloading from.
- sim7c00 1y agodepending on what you run one method might have more success than another. protections for malicious scripts vs. modified binaries are often different tools or different components of the same tool that can have varying degrees of success. you could also use the script to fingerprint and beacon to check if the target is worth it and what you might want to inject into said binary if thats your pick. still i think i agree, if you gonna trust a binary from that server or a scripts its potato potato... check what you run before you run it with whatever tools or skills u got and hope for the best. if you go deepest into this rabbithole, you cant trust your hard disk or network card etc. so its then at some point just impossible to do anyhting. microcode patches, malicious firmwares, whatever. for pragmatic reasons line needs to be drawn. if your paranoid good luck and dont learn too much about cybersecurity, or you will need to build your own computer :p
- IshKebab 1y agoThis is one of those theoretical issues that has absolutely no practical implications.
- dgl 1y ago
- gchamonlive 1y agoI like that vet, which wraps the `curl | bash` pattern, can be installed via the `curl | bash` pattern but it's documented under https://github.com/vet-run/vet?tab=readme-ov-file#the-trusting-one-liner-the-anti-pattern https://github.com/vet-run/vet?tab=readme-ov-file#the-trusti.... I don't see it in arch's aur though. That would be my preferred install method. Maybe I'd take a look at it later if it's really not available there.
- Sanzig 1y agoI wonder if domain validation might be a good addition to this? You could encode a public key in a TXT record for the domain, and if present, vet could check a signature in the shell script against the key in the TXT record. It wouldn't stop attacks where the owner lost control of the DNS records, but it would stop the "webserver hijack" attack vector.
- goku12 1y agoThat's what they do in DKIM signing of emails. But if you want to go that route, there are easier solutions. For example, Github and Gitlab expose your SSH keys at a specific URL. You could use those (for ssh signing) if you trust the account. Another even easier method is to use something like cosign (sigstore) if you trust a PKI. Or you could use WebFinger to advertise signify keys or Web Key Directory (WKD) to expose OpenPGP keys, etc.
- maxboone 1y agoTLSA records exist, but are for the entire server rather than a single binary or script.
- tyingq 1y agoAn option to run the potentially harmful script in a rootless container, then dump filesystem diffs, audit events, etc...might be helpful. I get containers aren't perfect isolation, but...
- nailer 1y agoReminder that the pattern has the same risk as downloading software that you haven’t audited and verified the binary matches the source.
- mrspuratic 1y agoReminder that there is the reductive argument that basically everything you download is arbitrary code, but throwing away the code that is run seems uniquely silly.
- aflag 1y agoHow is it silly to throw away code that you'll run only once?
- nailer 1y ago> Reminder that there is the reductive argument that basically everything you download is arbitrary code I'm not sure why you think pointing out the risk of regular unaudited unverifiable downloads is reductive as you haven't provided any supporting arguments, only snark. You seem like a cunt. > throwing away the code that is run seems uniquely silly. Neither traditional downloads and curl | bash are commonly stored long term for analysis.
- pxeger1 1y agoMy problem with curl|bash is not that the script might be malicious - the software I'm installing could equally be malicious. It's that it may be written incompetently, or just not with users like me in mind, and so the installation gets done in some broken, brittle, or non-standard way on my system. I'd much rather download a single binary and install it myself in the location I know it belongs in.
- stouset 1y agoYes! What I really want from something like this is sandboxing the install process to give me a guaranteed uninstall process.
- hsbauauvhabzb 1y agoWhy would you possibly want to remove my software?
- ChocolateGod 1y agoThis reminded me how if you wanted to remove something like cPanel back in the day your really only option was to just reinstall the whole OS.
- mjmas 1y agotinycorelinux reinstalls its extensions into a tmpfs every boot which works nicely. (and you can have different lists of extensions that get loaded)
- jerf 1y agoI've also seen really wonderfully-written scripts that, if you read them manually, allow you to change where whatever it is is installed, what features it may have, optional integration with Python environments, or other things like that. I at least skim all the scripts I download this way before I run them. There's just all kinds of reasons to, ranging all the way from the "is this malicious" to "does this have options they're not telling me about that I want to use". A particular example is that I really want to know if you're setting up something that integrates with my distro's package manager or just yolo'ing it somewhere into my user's file system, and if so, where.
- jraph 1y agoNice. Next step: provide an interactive shell (plugin) that detects curl | (ba)sh and suggests running vet instead.
- networked 1y agoYou can also use vipe from moreutils: curl -sSL https://example.com/install.sh | vipe | sh This will open the output of the curl command in your editor and let you review and modify it before passing it on to the shell. If it seems shady, clear the text. vet looks safer. (Edit: It has the diff feature and defaults to not running the script. However, it also doesn't display a new script for review by default.) The advantage of vipe is that you probably have moreutils available in your system's package repositories or already installed.
- TZubiri 1y agoHuh Why not just use the tools separately instead of bringing a third tool for this. Curl -o script.sh Cat script.sh Bash script.sh What a concept
- panki27 1y agoAt this point, the whole world is just a complexity Olympiad
- networked 1y agoWhat it comes down to is that people want a one-liner. Telling them they shouldn't use a one-liner doesn't work. Therefore, it is better to provide a safer one-liner. This assumes that securing `curl | sh` separately from the binaries and packages the script downloads makes sense. I think it does. Theoretically, someone can compromise your site http://example.com http://example.com with the installation script https://example.com/install.sh https://example.com/install.sh but not your binary downloads on GitHub. Reviewing the script lets the user notice that, for example, the download is not coming from the project's GitHub organization.
- adolph 1y agoSame but less instead of cat so my fingers stay in the keyboard. Vet, vite, etc are kind of like kitchen single-taskers like avocado slicer-scoopers. Surely some people get great value out of them but a table-knife works just fine for me and useful in many task flows. I'd get more value out of a cross-platform copy-paster so I'm not skip-stepping in my mind between pbpaste and xclip.
- johnfn 1y agoAm I missing something? Even if you do `vet foobar-downloader.sh` instead of `curl foobar-downloader.sh | bash`, isn't your next command going to be to execute `foobar` regardless, "blindly trusting" that all the source in the `foobar` repository isn't compromised, etc?
- lr0 1y agoNo it says that it will show you the script first so you can review it. What I don't get is why do you nee d a program for this, you can simple curl the script to a file, `cat` it, and review it.
- simonw 1y agoIt shows you the installation script but that doesn't help you evaluate if the binary that the script installs is itself safe to run.
- dotancohen 1y agoRight, this tool does one thing - make it easy to see the script. Another tool does something else. That's kind of the UNIX Philosophy.
- deleted 1y ago[deleted]
- geysersam 1y agoYes but even if you inspect the code of the installation script the program you just installed might still be compromised/malicious? It doesn't seem more likely that an attacker managed to compromise an installation script, than that they managed to compromise the released binary itself.
- loloquwowndueo 1y agoIf you’re just going to run it blindly you don’t need vet. It’s not automatic - just gives you a chance to review the script before run I h it.
- exitb 1y agoI was hoping this would have a curl | bash installer. Was not disappointed!
- do_not_redeem 1y agoIt's crazy that so much ink is spilled on curl | bash, but then those same people will happily run the 50MB binary it downloads for you without a second thought. Someone explain this to me, please. Let's consider rust: https://www.rust-lang.org/tools/install https://www.rust-lang.org/tools/install Specifically, consider these two files: A. a shell script, written by the Rust core developers, hosted on the Rust official website behind TLS B. a compiler binary, written by the Rust core developers, hosted on the Rust official website behind TLS Why is everyone so afraid of A, but not afraid of B?
- Galanwe 1y agoThe whole point of "curl|bash" is to skip dependency on package managers and install on a barebone machine. Installing a tool that allow to install tools without installation tool is...
- chii 1y agobut then it needs to come with a curl|bash uninstall tool. Most of these install scripts are just half the story, and the uninstalling part doesn't exist.
- ryandrake 1y agoSadly, a great many 3rd party developers don't give a single shit about uninstallation, and won't lift a finger to do it cleanly, correctly and completely. If their installer/packager happens to do it, great, but they're not going to spend development cycles making it wonderful.
- thewebguyd 1y agoThis is why its so upsetting over in Linux land how so many people are just itching to move away from distro package managers and package maintainers. Curl | bash is everywhere now because "packaging is hard" and devs can't be arsed to actually package their software for the OS they developed it for. Like, yeah I get it - it's frustrating when xyz software you want isn't in the repos, but (assuming it's open source) you're also welcome to package it up for your distro yourself. We already learned lessons from Windows where installers and "uninstallers" don't respect you or your filesystem. Package managers solved this problem many, many years ago.
- maccard 1y agoWhat package manager would you recommend that allows a one line install on windows (wsl), Mac, debian, fedora and arch?
- jrpear 1y ago
- baq 1y agowe've been curl | bashing software on windows since forever, it was called 'downloading and running an installer' and yes, there was the occasional malware. the solution to that was antivirus software. at this point even the younger hners should see how the wheel of history turns. meanwhile, everyone everywhere is npm installing and docker running without second thoughts.
- fragmede 1y agosoftware running in docker's a bit more sandboxed than running outside of it, even if it's not bulletproof.
- simonw 1y ago"the solution to that was antivirus software" How well did that work out?
- esafak 1y agoGreat. It motivated me to drop kick Windows and move to Linux and MacOS.
- 1y ago
- bongodongobob 1y agoTired of pointless "security" nonsense. This is silly.
- lorenzohess 1y agocurl github.com/vet-run/install.sh | bash
- sgc 1y agoGiven the conversations in this thread about the annoying package management that leads to so much use of curl | bash, I have a question: Which Linux distro is the least annoying in this regard? Specifically, I mean 1) packages are installed in a predictable location (not one of 3-5 legacy locations, or split between directories); 2) configuration files are installed in a predictable location; 3) Packages are up to date; 4) There is a a large selection of software in the repositories; 5) Security is a priority for the distro maintainers; 6) It's not like pulling teeth if I want/need to customize my setup away from the defaults. I have always used Debian / Ubuntu because I started with my server using them and have wanted to keep the same tech stack between server and desktop - and they have a large repository ecosystem. But the fragmentation and often times byzantine layout is really starting to grind my gears. I sometimes find a couple overlapping packages installed, and it requires research and testing to figure out which one has priority (mainly networking...). Certainly, there is no perfect answer. I am just trying to discover which ones come close.
- lima 1y agoThe only distros that are cleanly customizable are declarative ones approaches like NixOS or guix.
- GrantMoyer 1y agoTry Arch Linux. It hits all your points except maybe 5. 1. It symlinks redundant bin and lib directories to /usr/bin, and its packages don't install anything to /usr/local. 2. You can keep most config files in /etc or $XDG_CONFIG_HOME. Occasionally software doesn't follow the standards, but that's hardly the distro's fault. 3. Arch is bleeding edge 4. Arch repos are pretty big, plus thete's the AUR, plus packaging software yourself from source or binaries is practically trivial. 5. Security is not the highest priority over usability. You can configure SELinux and the like, but they're not on by default. See https://wiki.archlinux.org/title/Security https://wiki.archlinux.org/title/Security. 6. There are few defaults to adhear to on Arch. Users are expected to customize.
- Elfener 1y agoI switched to NixOS to solve this sort of problem. Configuration of system-wide things is done in the nix langauge in one place. It also has the most packages of any distro. And I found packaging to be more approachable than other distros, so if something isn't packaged you can do it properly rather than just curl|bash-ing.
- jwilk 1y agoIf bat is not available, vet uses less, which is not a faithful pager: https://github.com/jwilk/unfaithful-less https://github.com/jwilk/unfaithful-less It seems at least some versions of bat have the same problem, but I didn't look into the details.
- dgl 1y agohttps://github.com/vet-run/vet/pull/22 https://github.com/vet-run/vet/pull/22
- evertheylen 1y agoAnother approach I wrote to protect your system from untrusted dependencies (for Linux devs): https://evertheylen.eu/p/probox-intro/ https://evertheylen.eu/p/probox-intro/ Happy to hear other people's thoughts!
- xyst 1y agoCan’t recall the last time I used `curl … | bash` to install anything on personal or remote devices. Switched to nix + home-manager as a package manager to replace defacto package managers on some operating systems (ie, darwin uses macports or homebrew). In cases where the package isn’t available in nixpkgs, can create my own derivation and build it from source. If I am super paranoid, spin up sandboxed vm with minimal nixos. Use nixos-anywhere to setup vm. Install/build suspicious package. Then do reconnaissance. Nuke the vm after I am done. Nix, like any other software, isn’t fool proof. Something is likely to get through. In that case, identify the malicious package in nix store. Update your flake to remove/patch software that introduced it. Then nuke the system completely. Then rebuild system using your declarative system configuration without malicious software. Is nix for everyone? God no, there’s a massive learning curve. But I will say that once you get past this learning curve, you will never need to install anything with this pattern.
- jimmaswell 1y agoHad there been a single notable incident of curlbash leading to a malware outbreak that this would have prevented?
- ojosilva 1y agoFunny, I had this need just today, but with a not-so-popular GitHub repo I cloned today. Before running it, I opened the folder in Cursor and requested a check for suspicious activities, which after a good scan of README and source files, Cursor reported back that it was ok to proceed. I think getting an (optional?) AI heads-up before reviewing it myself would be great for cURL shell scripts as well. I'm prone to not seeing dark patterns in editor, and tools like vet could as well be tricked into not seeing the dark pattern, malicious intent, or just hazardous code lurking.
- alienbaby 1y agoI wouldn't quite trust an AI's opinion in wether given code is malicious or not, maybe in the future, but not quite yet.
- bugsMarathon88 1y agoThe solution to executing untrusted code is not to execute more untrusted code, especially through a tool which has not itself been "vetted".
- djha-skin 1y agoI love articles like these that show me new tools instead of showing me new AI tricks. This is the kind of thing I'm in on Hacker News for. I missed the 2010s because people were writing tools for other people. Nowadays it's all about how can I get AI to write it for me poorly.
- fsckboy 1y agoa zillion comments here and it's not mentioned yet: packages are installed as root/admin with elevated privilege packages are run as ordinarly lusers this is why curl|bash is a more dangerous thing to do. traditionally, the people with the root password were experienced and trained for this type of analysis, but with personal machines this line of defense does not exist yes, there are scripts also built into package installers. now you can understand why there shouldn't be, or at least the post-install script can be inspected (this is a major benefit of scripts) all the noise you want to make about how different distros make the problem harder is part of the problem if your solution is to capitulate to practices which are unsafe-by-design
- aezart 1y agoI think aside from any safety issues, another reason to prefer a deb or something over curl | bash is that it lets your package manager know what you're installing. It can warn you about unmet dependencies, it knows where all the individual components are installed, etc. When I see a deb I feel more confident that the software will play nicely with other stuff on the system.
- marssaxman 1y agoI wonder what this program's `diff` feature is intended for? I can't think of a time when I've wanted to run the same install script more than once.
- codedokode 1y agoThis shows how bad things are in Linux land and how unfriendly Linux is for third-party apps. The idea that someone will package every application for every Linux distribution is delusional. The proper solution is to provide a standard API and make applications against this API. And of course there should be a sandbox for third-party apps. Compare this to Windows where there is a standard API, standard set of pre-installed fonts and libraries, you download an exe and it "just works". However Windows has no sandbox and is not secure at all if you install any third-party apps. There are antiviruses, but they cannot guarantee detection of malicious code, and do not even try to block less malicious code like tracking and telemetry. One might notice that there are Snap/Flatpak, however the issue with them is that the applications there mostly not work properly and have lot of bugs. Also they do not sandbox properly, for example, do not prevent reading serial numbers of equipment.
- neilv 1y agoSome municipalities operate relatively safe locations where drug addicts can shoot up. But it the conventional wisdom is that it's better not to shoot up at all.
- jrm4 1y agoAs an old-timer, going through this thread, I must say that there's just not enough hate for the whole Windows/Mac OS inclination to not want to let users be experimental. Everyone here is sort of caught up in this weird middle ground, where you're expecting an environment that is both safe and experimental -- but the two dominant Oses do EVERYTHING THEY CAN to kill the latter, which, funny enough, can also make the former worse. Do not forget, for years you have been in a world in which Apple and Microsoft do not want you to have any real power.
- lodefende 1y agoGog hacker
- lofaszvanitt 1y agoThis is dangerous. The script could be malicious, the server could be compromised, or a transient network error could result in executing a partial script. ---- 0.001% chance. But ok.
- wpollock 1y agoFor Linux, I used to use checkinstall to create a package when installing from make. It watches the make, and adds an uninstall. Works for several package management systems such as .rpm and .deb. For Cmake there is a similar tool I believe, Cpack. Is there any such tool for shell script installers?
- MathMonkeyMan 1y agoI do this: $ curl 'https://who.knows.man/installer.sh' >/tmp/install $ vim /tmp/install [... time passes ...] $ sh /tmp/install
- burnt-resistor 1y agoThe greater problem pattern is not running first inside of a sandbox and auditing the various food groups including dependencies, network interactions, modifications, and final results. In reality, system packaging and configuration management tend to be the preferred way outs at scale rather than creating system entropy of ("here, run this script"). Btw, there is a tool on debian I abuse to replace system dependencies and package things (in lieu of checkinstall) called equivs. And, to find changes, I use cruft-ng which depends upon plocate.
- totetsu 1y agoIsn't it better to run with firejail or bubblewrap to contain the changes to an overlayfs or whatever and see exactly what the script would do before running it?
- smallerfish 1y agoYes but it's clunky as hell. We need something like a curl x.sh | firejail --new, which prompts a) do you want overlayfs? b) do you want network isolation? c) do you want to allow home directory access? And then, some equivalent for actually running whatever was installed. This would need to introspect what the installation script did and expose new binaries, which of course run inside the sandbox when invoked. To move past the "| bash" lazy default, people need an easy to remember command. The complexity of the UI of these tools hinders adoption.
- oytis 1y agoCan't see what security it adds at all. The whole looks like a lot like enterprise-quality fizzbuzz, with the core being a small script essentially doing `curl | bash`, but much more verbosely - and a lot of boilerplate (tests, packaging etc.) around it.
- mid-kid 1y agoIn my experience, too many of these curl scripts are a bootstrap for another script or tarball which gets downloaded from somewhere else, and then downloads more stuff. Looking at just the main script tells you nothing. Consider for example the rust install procedure: It downloads a binary rustup, for bootstrapping, which then does the installation procedure and embeds itself into your system, and then downloads the actual compiler, and you have no chance of verifying the whole chain, nor really knowing what it changes until after the fact. Consider also systems like `pip` which through packages like puccinialin do the same inscrutable installation procedure, when a rust-based python package needs to be compiled. Suffice to say, it's best to avoid any of this, and do it using the package manager, or manually. I only run scripts like this on systems that I otherwise don't care about, or in throwaway containers.
- globular-toast 1y agoThere are some more obvious things you should do (in order): 1. Have backups. You are running software all the time that can corrupt your files either maliciously or, more likely, accidentally. It doesn't really matter where it comes from, 2. Get into the habit of running things in sandboxes. You don't need anything magical here, a separate (unprivileged) user account is a good enough sandbox for many things. I outline an approach for installing Calibre like this on my blog[0] (the official site uses the `curl ... | sudo sh` pattern!) You could do more clever things like using bwrap[1] to isolate things, or use a distro designed for this kind of thing. Be aware if using a separate user account that your home directory might still be readable so if you're worried about privacy check that, or use bwrap so it's not exposed at all. [0] https://blog.gpkb.org/posts/calibre-rootless-install/ https://blog.gpkb.org/posts/calibre-rootless-install/ [1] https://github.com/containers/bubblewrap https://github.com/containers/bubblewrap