News for hackers. Stuff that matters.
Re:Kubernetes ingress-nginx controller vulnerability by jeffbee on Friday October 22, 2021 @10:21AM (#28957526)
Are they for real with that curl? Normalize better security practices!
Re:Kubernetes ingress-nginx controller vulnerability by tbrownaw on Friday October 22, 2021 @10:32AM (#28957707)
I think it's contrary to currently-recommended ops practice (clearly imperative rather than nominally declarative), but how is it bad security practice? If you don't trust the origin, it's not like saving to a temporary file first is going to help you. Unless you're suggesting that everyone should always do their own code review and then compile from source...
Re:Kubernetes ingress-nginx controller vulnerability by junon on Friday October 22, 2021 @11:12AM (#28958242)
> but how is it bad security practice?

Companies / organizations / team members go rogue sometimes. We've seen this even recently with e.g. kicad, freenode, the timezone database, etc.

Just because you trust the source doesn't mean you should trust all of the scripts they tell you to run. Even if it's a good-faith script, you have no idea if it's making assumptions about your system that are not true and opening you up to sidechannel attacks and the like.

Curl to a file first, inspect the script, consider it within the context of your own system, then run it if you deem it's safe.

Re:Kubernetes ingress-nginx controller vulnerability by k8sToGo on Friday October 22, 2021 @11:36AM (#28958531)
> Curl to a file first, inspect the script, consider it within the context of your own system, then run it if you deem it's safe.

But you can still do that if you want? It is not like this is a hidden executable or something.

Re:Kubernetes ingress-nginx controller vulnerability by ZeroMinx on Friday October 22, 2021 @11:50AM (#28958696)
Sure, but as OP put it, "Normalize better security practices!".
Re:Kubernetes ingress-nginx controller vulnerability by notabee on Friday October 22, 2021 @01:22PM (#28959969)
Here's some discussion about that. But to put it simply, security is done in layers. Checking something simple like a script before running it is relatively easy and can catch low-effort malicious attempts. Sure, it won't protect against an advanced persistent threat doing a supply chain attack, but you're probably much more likely to be hit with low effort attacks that could be avoided by just not being careless.

https://news.ycombinator.com/item?id=17636032

Re:Kubernetes ingress-nginx controller vulnerability by justinclift on Friday October 22, 2021 @11:25AM (#28958421)
> If you don't trust the origin, it's not like saving to a temporary file first is going to help you.

Huh? The whole point is to review the the code before you run it.

If it seems like many people _don't_, well frankly, that's their problem.

Encouraging bad practise is not the right direction.

Re:Kubernetes ingress-nginx controller vulnerability by asguy on Friday October 22, 2021 @11:09AM (#28958221)
At minimum you could download software that is at least signed by someone you trust. Rather than streaming arbitrary commands from a source that the extent of the authentication is that their CDN's TLS certs matches their domain.
Re:Kubernetes ingress-nginx controller vulnerability by jl6 on Friday October 22, 2021 @11:40AM (#28958570)
Saving to a file first means you can at least run it in a test environment first, then be confident you’re running the same thing when moving into production.
Re:Kubernetes ingress-nginx controller vulnerability by doesnotexist on Friday October 22, 2021 @10:41AM (#28957832)
Yeah I think everyone feels icky about 'curl https://.. | sh' but to what degree is doing so any more insecure than other "normalized" software distribution practices? See also: https://twitter.com/moyix/status/1451318133021675520
Re:Kubernetes ingress-nginx controller vulnerability by jeffbee on Friday October 22, 2021 @10:44AM (#28957869)
You can check for this vulnerability using the existing tooling any k8s admin already has on their systems by necessity. It's always foolish to install unknown software and security professionals should never advise that.
Re:Kubernetes ingress-nginx controller vulnerability by tbrownaw on Friday October 22, 2021 @11:14AM (#28958273)
> unknown software

Looking at the blog URL and header bar, and the script URL, this is pretty clearly a company blog recommending to use the company's own product. I hardly think that context counts as "unknown".

Re:Kubernetes ingress-nginx controller vulnerability by justinclift on Friday October 22, 2021 @11:30AM (#28958475)
Lets say (for example) that was published on a wordpress site, and the admins for whatever reason didn't secure it properly.

The article in question which _today_ looks all legit and points to a nice working script, might tomorrow be pointing to someone else's script that's a lot less legit.

And yes, in this imaginary scenario that wordpress install leads to a host of other problems for the company.

No need to make them your problems too though. ;)

Re:Kubernetes ingress-nginx controller vulnerability by 015a on Friday October 22, 2021 @11:20AM (#28958345)
I will argue until the day I die: curl | bash is actually more secure than most traditional software delivery mechanisms. Slightly, but meaningfully.

With curl | bash, the URL of the bash script is right there. I can copy it, plug it into my browser, and inspect with ease the shell script that will run. If its on Github or a similar site, I can see in plain language the exact organization who published it (I wouldn't implicitly trust whoever "armosec" is, but I would trust, for example, "kubernetes", "microsoft", or "google" e.g.).

Alternatives?

- For something like this, to generate a report on whether you're affected? Maybe just a copy-paste bit of code? Isn't that the same thing, but less convenient?

- apt-get install something. Who published it? Does apt have security scanning (no lol)? Where's the source code for that package (scattered to the wind no doubt)? Does it have reproducible builds so I can be certain the code I eventually find is what I install (lol no. but bash scripts do!)

- Let's talk about `snap` for a second; Did you know that there's a `snap install aws-cli` package available [1], published by "Amazon Web Services", with a verified checkmark. Sounds great. Except, for years, no one on the actual aws-cli team had any idea where it came from [2]. They didn't authorize it, and they don't maintain it. It turns out, it was probably the result of a hackathon project by one AWS engineer. "Better security practices" for sure!

The only legitimate risk I've heard about 'curl | bash' is that web servers can detect whether the site is being accessed by a browser versus curl, and serve different content. Legit risky, good to educate about; don't curl | bash from sites you don't recognize. But this is a GitHub link!

I would agree that package managers are superior from a security angle, if most package managers had strong security review processes, on both the package content and the publisher. The problem is: they don't. They're all lacking in this regard, from apt to flatpak to the Apple App Store. The most sophisticated is probably the Play Store, but binary command line distribution channels are nowhere close to having reproducible builds, verified Real ID developers, static analysis on distributed binaries, etc. Package managers are literally just "curl | bash" with some steps added. By and large, anyone can publish anything under any name; educating people that they're "safe" is actually a massive disservice.

[1] https://snapcraft.io/aws-cli

[2] https://github.com/aws/aws-cli/issues/5142

Re:Kubernetes ingress-nginx controller vulnerability by jamescostian on Friday October 22, 2021 @12:36PM (#28959341)
> The only legitimate risk I've heard about 'curl | bash' is that web servers can detect whether the site is being accessed by a browser versus curl, and serve different content

This is the reason why you shouldn't do curl ... | bash, you should do bash -c "$(curl ...)"

The former is truly vulnerable, for the exact reason you mention, while the latter isn't.

> With curl | bash, the URL of the bash script is right there. I can copy it, plug it into my browser, and inspect with ease the shell script that will run

Not exactly, see http://thejh.net/misc/website-terminal-copy-paste

More savvy users might have set their shell up in a way that mitigates this risk, and some users will, as you mentioned, copy and paste URL, but go ahead and try that with the command in the link I provided - note that if you copy just the git URL, it only copies that bit, and then you can paste it into your browser, and not realize that there's a malicious bit before it

Of course, copying and pasting a command involving apt/dnf/etc is also vulnerable to that same attack :)

Re:Kubernetes ingress-nginx controller vulnerability by 015a on Friday October 22, 2021 @12:51PM (#28959556)
'bash -c $(curl )' doesn't mitigate a website's ability to detect whether you're downloading a file via curl versus accessing it in a browser (e.g. if (headers.USER_AGENT.includes("curl")) {}).

It does mitigate a different issue whereby the website can detect if you're piping the output of 'curl' directly to bash.

The safest option is definitely --> curl to file, audit what you downloaded locally, not in a browser, then bash -c that downloaded file.

But, again, this only really mitigates attacks from sketchy websites. If the website is trustworthy; both the website you're getting the curl | bash download string from, and the website the script is hosted at, such as Github, where 90% of these scripts are hosted; its not really mitigating a legitimate threat.

The copy-paste thing is interesting, but frankly: That's an argument for why the web is insecure, and that insecurity impacts every single method of software distribution which touches it. Copy-pasting a 'sudo apt-get install' line is the same class of risk here as copy-pasting a 'curl | bash' or 'bash -c $(curl)' line; you could swap the script to a new URL, or you could have them install a malicious package from apt, or even just nuke the apt-get install part and just do a curl | bash anyway. Definitely something that's great to know and educate about, but its not the strongest argument against curl | bash.

Re:Kubernetes ingress-nginx controller vulnerability by jamescostian on Friday October 22, 2021 @01:01PM (#28959691)
I agree 100% with that comment :) Including the first part:

> 'bash -c $(curl )' doesn't mitigate a website's ability to detect whether you're downloading a file via curl versus accessing it in a browser

You're totally right, I forgot about this one! It's wild how many tricks there are in the security world

Re:Kubernetes ingress-nginx controller vulnerability by dreyfan on Friday October 22, 2021 @11:46AM (#28958650)
The people downvoting you did so while waiting on npm install to run.
Re:Kubernetes ingress-nginx controller vulnerability by slig on Friday October 22, 2021 @12:22PM (#28959146)
>I can copy it, plug it into my browser, and inspect with ease the shell script that will run

If the source is some shady site, it's possible to serve two different versions: one for curl/wget users and one for browsers.

Re:Kubernetes ingress-nginx controller vulnerability by chmod-777 on Saturday October 23, 2021 @03:20PM (#28971383)
I see you can also download it from Git and try it out, probably just tried to make it easier for people.