Skip to content
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

Portmap: append, rather than prepend, entry rules - CVE-2019-9946 #269

Merged
merged 1 commit into from
Mar 15, 2019

Conversation

squeed
Copy link
Member

@squeed squeed commented Feb 26, 2019

This means that portmapped connections can be more easily controlled / firewalled.

@squeed squeed force-pushed the portmap-prepend branch 2 times, most recently from 75e49fb to 29f9ba5 Compare February 27, 2019 16:14
@matthewdupre
Copy link
Member

I'll try this out with Calico

This means that portmapped connections can be more easily controlled /
firewalled.
@squeed squeed force-pushed the portmap-prepend branch from 29f9ba5 to f8fcb35 Compare March 6, 2019 16:17
Copy link
Contributor

@bboreham bboreham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dcbw
Copy link
Member

dcbw commented Mar 15, 2019

/lgtm

@dcbw dcbw merged commit a62711a into containernetworking:v0.7 Mar 15, 2019
@matthewdupre
Copy link
Member

(Seems to work with Calico)

@philips philips changed the title Portmap: append, rather than prepend, entry rules Portmap: append, rather than prepend, entry rules - CVE-2019-9946 Mar 28, 2019
@philips
Copy link
Contributor

philips commented Mar 28, 2019

This issue was coordinated with the CNI team as it caused a potential security issue with Kubernetes.

See the details below.

A security issue was discovered with interactions between the CNI (Container Networking Interface) portmap plugin versions prior to 0.7.5 and Kubernetes. The CNI portmap plugin is embedded into Kubernetes releases so new releases of Kubernetes are required to fix this issue. The issue is Medium and upgrading to Kubernetes 1.11.9, 1.12.7, 1.13.5, and 1.14.0 is encouraged to fix this issue if this plugin is used in your environment.

Am I vulnerable?

As this affects a Kubernetes plugin interface it is difficult to say with certainty without a complete understanding of your Kubernetes configuration. The issue was identified in a configuration of kube-proxy in IPVS mode along with a pod using a HostPort. However, other network configurations may use the CNI portmap plugin as well.

Run kubectl version --short | grep Server and if it does not say 1.11.9, 1.12.7, 1.13.5, and 1.14.0 or newer you are running a vulnerable version if paired with a CNI configuration that uses the portmap plugin.

How do I upgrade?

Follow your management tool or vendor instructions to upgrade to the latest release of Kubernetes.

Vulnerability Details

Before this fix the 'portmap' plugin, used to setup HostPorts for CNI, would insert rules at the front of the iptables nat chains; which would take precedence over the KUBE- SERVICES chain. Because of this, the HostPort/portmap rule could match incoming traffic even if there were better fitting, more specific service definition rules like NodePorts later in the chain.

Switching the portmap plugin to append its rules, rather than prepend, allows traffic to be processed by KUBE-SERVICES rules first. Only if traffic does not match a service will it be considered for HostPorts. This is compatible with the behavior of the legacy ‘kubenet’ network driver.

See the GitHub issue for details. kubernetes/kubernetes#75455 and #269

Thank you

Thank you to Etienne Champetier of Anevia for identifying the issue, Tim Hockin, Dan Williams, Casey Callendrello, Dujun, Tim Pepper, and the patch release managers for the coordination is making this release.

Thank You,

Brandon on behalf of the Kubernetes Product Security Committee

@thockin
Copy link

thockin commented Apr 1, 2019

I have identified 2 specific variants of this CVE, all covered by the same fix.

  1. As before, you need a pod with a hostPort and a service using the same port number. In this case the service has to be type=LoadBalancer
    and your LB implementation has to assign LB IPs to local interfaces on nodes. In that case, the LB IP is considered "local" and will match the hostPort before matching the service.

  2. If you have a service of type NodePort or LoadBalancer, and I can learn the exact nodePort number for your Service, I can craft a pod using that as a hostPort, which will match before the service. This includes any load-balancer or ingress which uses the nodePort to route traffic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants