-
Notifications
You must be signed in to change notification settings - Fork 40.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CVE-2020-8554: Man in the middle using LoadBalancer or ExternalIPs #97076
Comments
@tallclair: There are no sig labels on this issue. Please add an appropriate label by using one of the following commands:
Please see the group list for a listing of the SIGs, working groups, and committees available. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@tallclair: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This ticket is sparse on details. May either more detail or a POC be provided? |
I'm particularly confused by this line:
Is traffic intercepted if the client is using the service discovery name or another DNS name that resolves to the targeted IP? Or is this only intercepted if the client uses the IP address without DNS? |
If you create a service with an arbitrary external IP, then traffic to that external IP from within the cluster will be routed to that service. This lets an attacker that has permission to create a service with an external IP to intercept traffic to any target IP. The routing happens at the IP layer, so I don't think it matters if they use DNS or not (once DNS resolves to the target IP, I think it will still be intercepted). |
Ah, I see. So I could create a Service like this to intercept some or all UDP traffic from Pods in the cluster to Google DNS: apiVersion: v1
kind: Service
metadata:
name: my-evil-service
namespace: my-evil-namespace
spec:
selector:
app: my-evil-dns-server
ports:
- name: dns
protocol: UDP
port: 53
targetPort: 9053
externalIPs:
- 8.8.8.8
- 8.8.4.4 |
I'm closing this issue, since #97110 captures the follow up items. |
I'll try to finish my write up tonight, but when I did all my tests |
For those looking to reproduce from the above ^
|
I actually tried to set kube-proxy has similar parallel logic to handle them: https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/iptables/proxier.go#L1088 and https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/iptables/proxier.go#L1164 so the finding is aligned |
@champtar
|
@maplain what LoadBalancer are you using ? if just setting |
Thanks. But I could not reproduce the problem in my minikube 1.19 cluster following the steps. Here is what I got:
|
@champtar I'm working on a gatekeeper policy to block attempts to exploit CVE-2020-8554. Can you please give me your feedback open-policy-agent/gatekeeper-library#45 |
@champtar so in your write-up you mention |
You should not give permission to your users / applications to create Now in 3a / 3b what I was doing is setting the EIP or LBIP to the IP of a victim pod, pod exposed behind a clusterIP, that's why I name it endpoint at some point
|
@champtar thanks for the speedy clarification! the default namespace But also with this not covered and being able to specify any IP, I'm worried there's more resources vulnerable to this as well. |
If I remember correctly by creating |
Is there a path forward to remediate this issue within the k8s? |
you can enable an admission controller #97395 |
/label official-cve-feed (Related to kubernetes/sig-security#1) |
If users are denied RBAC privilege to PATCH their services as mitigation for this, is there any other way they can update their services (for non-malicious purposes)? |
CVSS Rating: Medium (CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L)
This issue affects multitenant clusters. If a potential attacker can already create or edit services and pods, then they may be able to intercept traffic from other pods (or nodes) in the cluster.
An attacker that is able to create a ClusterIP service and set the spec.externalIPs field can intercept traffic to that IP. An attacker that is able to patch the status (which is considered a privileged operation and should not typically be granted to users) of a LoadBalancer service can set the status.loadBalancer.ingress.ip to similar effect.
This issue is a design flaw that cannot be mitigated without user-facing changes.
Affected Components and Configurations
All Kubernetes versions are affected. Multi-tenant clusters that grant tenants the ability to create and update services and pods are most vulnerable.
Mitigations
There is no patch for this issue, and it can currently only be mitigated by restricting access to the vulnerable features. Because an in-tree fix would require a breaking change, we will open a conversation about a longer-term fix or built-in mitigation after the embargo is lifted
To restrict the use of external IPs we are providing an admission webhook container: k8s.gcr.io/multitenancy/externalip-webhook:v1.0.0. The source code and deployment instructions are published at https://github.com/kubernetes-sigs/externalip-webhook.
Alternatively, external IPs can be restricted using OPA Gatekeeper. A sample ConstraintTemplate and Constraint can be found here: https://github.com/open-policy-agent/gatekeeper-library/tree/master/library/general/externalip.
No mitigations are provided for LoadBalancer IPs since we do not recommend granting users patch service/status permission. If LoadBalancer IP restrictions are required, the approach for the external IP mitigations can be copied.
Detection
ExternalIP services are not widely used, so we recommend manually auditing any external IP usage. Users should not patch service status, so audit events for patch service status requests authenticated to a user may be suspicious.
If you find evidence that this vulnerability has been exploited, please contact security@kubernetes.io
Acknowledgements
This vulnerability was reported by Etienne Champetier (@champtar) of Anevia.
/area security
/kind bug
/committee product-security
/sig network
The text was updated successfully, but these errors were encountered: