Bug 1926568 (CVE-2021-20238)

Summary: CVE-2021-20238 openshift/machine-config-operator: unauthenticated access to Machine Config Server ignition config
Product: [Other] Security Response Reporter: Sam Fowler <sfowler>
Component: vulnerabilityAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: amurdaca, bmontgom, danken, danw, dhellmann, dramseur, eparis, jburrell, jhunter, nstielau, rbryant, ricardo.arguello, sfowler, sponnaga, walters, wking
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
It was found in OpenShift Container Platform 4 that ignition config, served by the Machine Config Server, can be accessed externally from clusters without authentication. The MCS endpoint (port 22623) provides ignition configuration used for bootstrapping Nodes and can include some sensitive data, e.g. registry pull secrets. There are two scenarios where this data can be accessed. The first is on Baremetal, OpenStack, Ovirt, Vsphere and KubeVirt deployments which do not have a separate internal API endpoint and allow access from outside the cluster to port 22623 from the standard OpenShift API Virtual IP address. The second is on cloud deployments when using unsupported network plugins, which do not create iptables rules that prevent to port 22623. In this scenario, the ignition config is exposed to all pods within the cluster and cannot be accessed externally.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1925494    
Bug Blocks: 1926028, 1965031    

Description Sam Fowler 2021-02-09 04:38:22 UTC
When running OpenShift with Red Hat supported network types, applications in the cluster are blocked from sending traffic to ports 22623 or 22624 via iptables rules injected into the pod.  This ensures that no unprivileged workloads are able to access the Machine Config Server (MCS) and download ignition configuration, which may contain sensitive information.

Unfortunately, this security measure is implemented within the code for the network plugins, so a cluster that uses another network plugin (like Calico, for example), would not have this protection mechanism in place.

In other words, all applications running on OpenShift clusters not using Red Hat supported network types will be able to access the MCS.

Comment 5 Sam Fowler 2021-04-30 06:50:20 UTC
Statement:

This flaw is planned to be addressed in a future enhancement:

https://issues.redhat.com/browse/GRPA-3642

Comment 7 Sam Fowler 2021-05-04 04:51:42 UTC
Mitigation:

- If deployed on Baremetal, OpenStack, Ovirt, Vsphere or KubeVirt, check if the ignition config is accessible from outside the cluster, e.g.
   
https://api.$cluster_name.$base_domain:22623/config/worker
  
Prevent access to this endpoint with an external firewall or load balancer.

- To protect the MCS endpoint within clusters, use a supported network plugin with OpenShift, namely: OpenShift SDN, OVN Kubernetes or kuryr.

- Ensure untrusted workloads are not run with hostNetwork access.

Comment 9 Sam Fowler 2021-05-04 05:01:14 UTC
Cluster types allowing external access to ignition config:

https://github.com/openshift/installer/blob/master/pkg/asset/ignition/machine/node.go#L36..L46

Comment 10 Sam Fowler 2021-05-04 05:01:35 UTC
Upstream issue:

https://github.com/openshift/okd/issues/176