7 ms·
Kubernetes Security Assessment [pdf]
- caniszczyk 7y agoThe Trail of Bits folks also open sourced the code behind their audit: https://twitter.com/lojikil/status/1159190646478913536 https://twitter.com/lojikil/status/1159190646478913536 https://github.com/trailofbits/audit-kubernetes https://github.com/trailofbits/audit-kubernetes
- tptacek 7y agoThis is good stuff. A nit: Users should not use AES-CBC or GCM for encryption. Secretbox should be the default mode of storing information and users should be encouraged to use KMS. I see where this is coming and agree in spirit, but GCM is actually idiomatic Go and implemented through the crypto/aead interface, which does about as good a job as any library at being user-proof. I too would probably prefer code that used Nacl primitives over Seal/Open, but I would probably not flag code that didn't.
- bdesimone 7y ago> I see where this is coming and agree in spirit, but GCM is actually idiomatic Go and implemented through the crypto/aead interface, which does about as good a job as any library at being user-proof. Good point, and I appreciate the (updated) Kubernetes docs do a pretty good job of telling you what the implications of using aesgcm vs secretbox are. However, I was surprised that XChaCha20-Poly1305 wasn't recommended. XChaCha appears to check all the boxes you mentioned and is nonce-misuse resistant.
- tptacek 7y agoIt's "NMR" in the sense that the nonce is long enough to safely use random nonces, you mean? In practice, Kubernetes can use random GCM nonces safely too. Real NMR ciphers don't just have misuse-resistant ergonomics, but also better failure modes when the ergonomics fail: if you reuse a Chapoly nonce, it blows up. That doesn't happen with AEZ or SIV.
- bdesimone 7y agoI agree that both can be used safely. And, yes to be clear, NMR here means "less likely to happen" not "better able to handle failure." Unfortunately, AES-GCM-SIV (or AEZ) aren't yet in Go's standard lib. But, why not use XChaCha20-Poly1305 over AES-GCM in Go? Both are "implemented through the crypto/aead" and -- to my eyes -- seem equally user-proof. Why not take the bigger nonce size?
- tptacek 7y agoI would prefer Chapoly to GCM. https://latacora.micro.blog/2018/04/03/cryptographic-right-answers.html https://latacora.micro.blog/2018/04/03/cryptographic-right-a...
- yalogin 7y agoAES-GCM or even CBC for that matter is not vulnerable/broken. Why did they recommend Secretbox? Is there an implementation error? I am not talking about the potential of making mistakes and using platform supported constructs. Does it make sense to make this recommendation even if the dev did not choose a vulnerable algorithm and there aren't any issues with implementation?
- bdesimone 7y agoIn the document they say that AES-CBC is vulnerable to padding oracle attacks, and AES-GCM uses random nonces and requires key rotation after so many iterations.
- tptacek 7y agoCBC is vulnerable to error oracles if you don't encrypt-then-MAC it properly (without the MAC it's also malleable, which is a game-over flaw). GCM is vulnerable to a bunch of its own misuse issues; it doesn't "use" random nonces, it is conceivably (through not really realistically) unsafe to use random nonces, and if you screw up nonce handling it blows up worse than CBC does. My point is just, these things all have rough edges.
- tptacek 7y agoFirst: it's not as simple as "broken" or "not broken". GCM in Go is provided through an AEAD abstraction that is in fact pretty close to secretbox, ergonomically. In Python, Fernet provides AES-CBC with HMAC-SHA2 with similar ergonomics. So you can't just look at the constructions in isolation. Using CBC in a Go program would be bad indeed. Second, while you can make CBC secure, it isn't secure by default. New designs should generally avoid CBC mode in favor of a mainstream AEAD. So while I'd happily recommend Fernet to people --- it also dates back to a time when AEAD ciphers were a little less mainstream than they've become --- I would see CBC as a design smell in a newer library.
- geggam 7y agoGiven all of the security issues I am curious who thinks this is production ready ?
- persistent 7y agoWhich of these issues strikes you as being a meaningful risk to a realistic deployment of Kubernetes?
- geggam 7y agoThe better question is when you deploy k8s in a production how do you ensure none of the risks are being exploited. Given todays landscape of hardware and software exploits adding a complex orchestration layer with identified issues seems like less than prudent behavior. I currently work on kubernetes in production and am migrating large clients into these systems. I see the distinct lack of knowledge around securing systems and more so when adding kubernetes.
- persistent 7y agoI'm not running antagonistic workloads in k8s though, I'm just running my own junk, each component of which also has its own laundry list of security nightmares.
- raesene9 7y agoAs with anything in security, this will depend on your threat model and the benefits of using k8s. There is some good information about securing k8s around, although we could always do with more. There's a free oReilly eBook on k8s security from aqua (https://info.aquasec.com/kubernetes-security https://info.aquasec.com/kubernetes-security) Also the CIS benchmark for k8s is reasonably up to date, although could use expanding, which should be happening for the next version. On top of that there have been quite a few conf. talks now about k8s security https://www.youtube.com/playlist?list=PLKDRii1YwXnLmd8ngltnf9Kzvbja3DJWx https://www.youtube.com/playlist?list=PLKDRii1YwXnLmd8ngltnf... for some examples
- deleted 7y ago
- dkhenry 7y agoI know the Kubernetes Assessment was the one to make all the news, but the teams actually audited a bunch of CNCF projects. Here is the one for the Vitess project https://vitess.io/blog/2019-03-12-vitess-security-audit/ https://vitess.io/blog/2019-03-12-vitess-security-audit/
- jey 7y agoVitess is > A database clustering system for horizontal scaling of MySQL > Vitess combines many important MySQL features with the scalability of a NoSQL database. Its built-in sharding features let you grow your database without adding sharding logic to your application. What a quirky project. Is this for folks who started out with MySQL then find themselves needing to scale out in "NoSQL" style? > Vitess automatically rewrites queries that hurt database performance. That sounds scary.
- sciurus 7y agoVitess was created by Youtube. But they're hardly the only places scaling out MySQL. Facebook and Slack are two other prominent examples.
- halbritt 7y agoFacebook has taken MySQL scaling to extremes well beyond what Vitess offers. Not sure if that's a good thing.
- pas 7y agoAnd to understand scaling and extremes: FB basically uses RocksDB and/or MySQL as a low level storage layer for whatever thing they want to. (And on top they build the clustering stuff, with the particular CAP choices they think is best for that particular service/purpose.)
- dkhenry 7y agoSlack actually uses Vitess to scale out its databases.
- alexnewman 7y agoSeems as though a bunch of nonsense burgers. But then i realized they are all just low impact
- muricula 7y agoThere's a nice table with five high security issues. The lack of authentication within the cluster is pretty damning.
- raesene9 7y agoyeah that one is kind of interesting, really needs more detail. I think what they're talking about is that it's possible to configure insecure connections between the different components. However, if that's the case, that's a distribution specific issue and not really anything intrinsic in k8s. Edit - there's a GH issue here https://github.com/kubernetes/kubernetes/issues/81112 https://github.com/kubernetes/kubernetes/issues/81112
- deleted 7y ago[deleted]
- alexnewman 7y agoYea I just don't buy it. The fact that you can use any tls cert is obviously how it should work. It complains loudly
- alexnewman 7y agoOK misread it and only found mediums. Sorry for being wrong, where's the high ones?
- raesene9 7y agoFor me, the largest one mentioned is a known security issue with k8s architecture, which is the lack of support for certificate revocation. So anywhere client cert's are used for authN, if one is lost there's no way to revoke it, short of rolling the whole certificate authority. when you combine that with the 200k+ Internet exposed Kubernetes clusters, that's quite a large potential for attack. The GH issue for this has been open since 2015 https://github.com/kubernetes/kubernetes/issues/18982 https://github.com/kubernetes/kubernetes/issues/18982
- raesene9 7y agoThere is a GH issue tracking the findings from the report https://github.com/kubernetes/kubernetes/issues/81146 https://github.com/kubernetes/kubernetes/issues/81146
- dpedu 7y ago> Fix the hard-coded Docker daemon process name. The process name should be dockerd instead of docker. Why is this a security issue? Also, beyond naming convention, why?
- tedivm 7y agoIt's definitely a bug, not just a convention- > The container manager used in kubelet checks for docker daemon process either via pidfile or process name. While the pidfile points to the docker daemon process PID, the dockerProcessName constant stores a docker cli name (docker) instead of docker daemon name (dockerd). They're trying to look up the process by a name the process isn't using.
- fulafel 7y agoI think the HTTP proxy based architecture is just weird and inherently insecure. Everything would be much simpler and and easier to analyze in a normal end-to-end scenario.
- gtirloni 7y agoI think that's because of the WebSockets support in kubectl so you can tunnel things, but it's been a long time since I read about it.