Last year, the Cloud Native Computing Foundation (CNCF) initiated a process of conducting third-party security audits for its own projects. The aim of these security audits was to improve the overall security of the CNCF ecosystem.
CoreDNS, Envoy and Prometheus are some of the CNCF projects which underwent these audits, resulting in identification of several security issues and vulnerabilities in the projects. With the help of the audit results, CoreDNS, Envoy and Prometheus addressed their security issues and later, provided users with documentation for the same.
CNCF CTO Chris Aniszczyk says “The main takeaway from these initial audits is that a public security audit is a great way to test the quality of an open source project along with its vulnerability management process and more importantly, how resilient the open source project’s security practices are.” He has also announced that, later this year, CNCF will initiate a bounty program for researchers who identify bugs and other cybersecurity shortcomings in their projects.
After tasting initial success, CNCF formed a Security Audit Working Group to provide security audits to their graduated projects, using the funds provided by the CNCF community. CNCF’s graduated projects include Kubernetes, Envoy, Fluentd among others. Due to the complexity and wide scope of the project, the Working group appointed two firms called the Trail of Bits and Atredis Partners to perform Kubernetes security audits. Trail of Bits implements high-end security research to identify security vulnerabilities and reduce risk and strengthen the code. Similarly, Atredis Partners also does complex and research-driven security testing and consulting.
Kubernetes security audit findings
Three days ago, the Trail of Bits team released an assessment report called the Kubernetes Security Whitepaper, which includes all the key aspects of the Kubernetes attack surface and security architecture. It aims to empower administrators, operators, and developers to make better design and implementation decisions. The Security Whitepaper presents a list of potential threats to Kubernetes cluster.
We have been working on a security audit of #Kubernetes since Oct '18(!) I’m so proud to say that today, with @trailofbits and @Atredis, we’ve published the final reports. Huge thank you to the @CloudNativeFdn, @jaybeale, Joel Smith, and @cji! https://t.co/i4HE0lGRS2
— Aaron Small (@Atlas_Hugged) August 6, 2019
Kubernetes cluster vulnerabilities
A Kubernetes cluster consists of several base components such as kubelet, kube-apiserver, kube-scheduler, kube-controller-manager, and a kube-apiserver storage backend. Components like controllers and schedulers in Kubernetes assist in networking, scheduling, or environment management. Once a base Kubernetes cluster is configured, the Kubernetes clusters are managed by operator-defined objects. These operator-defined objects are referred as abstractions, which represents the state of the Kubernetes cluster. To provide an easy way of configuration and portability, the abstractions also include the component-agnostic. This again increases the operational complexity of a Kubernetes cluster.
Since Kubernetes is a large system with many functionalities, the security audit was conducted on selected eight components within the larger Kubernetes ecosystem:
- Kube-apiserver
- Etcd
- Kube-scheduler
- Kube-controller-manager
- Cloud-controller-manager
- Kubelet
- Kube-proxy
- Container Runtime
The Trail of Bits team firstly identified three types of attackers within a Kubernetes cluster:
- External attackers (who did not have access to the cluster)
- Internal attackers (who had transited a trust boundary)
- Malicious Internal users (who abuse their privilege within the cluster)
The security audits resulted in total 37 findings, including 5 high severity, 17 medium severity, 8 low severity and 7 informational in the access control, authentication, timing, and data validation of a Kubernetes cluster. Some of the findings include:
- Insecure TLS is in use by default
- Credentials are exposed in environment variables and command-line arguments
- Names of secrets are leaked in logs
- No certificate revocation
- seccomp is not enabled by default
Recommendations for Kubernetes cluster administrators and developers
The Trail of Bits team have proposed a list of best practices and guideline recommendations for cluster administrators and developers.
Recommendations for cluster administrators
- Attribute Based Access Controls vs Role Based Access Controls: Role-Based Access Controls (RBAC) can be configured dynamically while a cluster is operational. In contrast, Attribute Based Access Control (ABAC) are static in nature. This increases the difficulty of ensuring proper deployment and enforcement of controls.
- RBAC best practices: Administrators are advised to test their RBAC policies to ensure that the policies defined on the cluster are backed by an appropriate component configuration and that the policies properly restrict behavior.
- Node-host configurations and permissions: Appropriate authentication and access controls should be in place for the cluster nodes as an attacker with network access can use Kubernetes components to compromise other nodes.
- Default settings and backwards compatibility: Kubernetes contains many default settings which negatively impact the security of a cluster. Hence, cluster operators and administrators must ensure that the component and workload settings are rapidly changed and redeployed, in case of a compromise or an update.
- Networking: Due to the complexity of Kubernetes networking, there are many recommendations for maintaining a secure network. Some of them include: proper segmentation, isolation rules of the underlying cluster hosts should be defined. An executing control-plane components host should be isolated to the greatest extent possible.
- Environment considerations: The security of a cluster’s operating environment should be addressed. If a cluster is hosted on a cloud provider, administrators should ensure that best-practice hardening rules are implemented.
- Logging and alerting: Centralized logging of both workload and cluster host logs is recommended to enable debugging and event reconstruction.
Recommendations for developers
- Avoid hardcoding paths to dependencies: Developers are advised to be conservative and cautious when handling external paths. Users should be warned if a path was not found, and have an option to specify it through a configuration variable.
- File permissions checking: Kubernetes should provide users the ability to perform file permissions checking, and enable this feature by default. This will help prevent common file permissions misconfigurations and help promote more secure practices.
- Monitoring processes on Linux: A Linux process is uniquely identified in the user-space via a process identifier or PID. A PID will point to a given process as long as the process is alive. If it dies, the PID can be reused by another spawned process.
- Moving processes to a cgroup: While moving a given process to a less restricted cgroup, it is necessary to validate that the process is the correct process after performing the movement.
- Future cgroup considerations for Kubernetes: Both Kubernetes and the components it uses (runc, Docker) have no support for cgroups. Currently, it is not an issue, however, it would be good to track this topic as it might change in the future.
- Future process handling considerations for Kubernetes: Tracking and participating in the development of a processes (or threads) on Linux is highly recommended.
Kubernetes security audit sets precedent for other open source projects
By conducting security audits and open sourcing the findings, Kubernetes, a widely used container-orchestration system, is setting a great precedent to other projects. This shows Kubernetes’ interest in maintaining security in their ecosystem. Though the number of security flaws found in the audit may upset a Kubernetes developer, it surely assures them that Kubernetes is trying its best to stay ahead of potential attackers. The Security Whitepaper and the threat model, provided in the security audit is expected to be of great help to Kubernetes community members for future references.
Developers have also appreciated CNCF for undertaking great efforts in securing the Kubernetes system.
It's a common misconception that #opensource is less secure, but the latest security audit from CNCF shows how resilient the #Kubernetes security processes can be with best practices. https://t.co/HW1C6GS2YP
— Kong (@thekonginc) August 8, 2019
It would be really rad to be in the security biz right about now! Great write up @cra https://t.co/RAAuBRSmnY
— kris nóva (@krisnova) August 9, 2019
So cool! Open sourcing the kubernetes security audit by cloud native computing foundation. 🎉 https://t.co/DBkRagxqSO
— Zachary Schafer (@zacharyschafer) August 9, 2019
To know more details about the security audit of Kubernetes, check out the Kubernetes Security Whitepaper.
Read Next
Introducing Ballista, a distributed compute platform based on Kubernetes and Rust
CNCF releases 9 security best practices for Kubernetes, to protect a customer’s infrastructure