REDHAT-BUG-2302259: High severity Red Hat OpenShift Container Platform vulnerability
OpenShift allows a user to create his own images with the help of the build component. This component has three primary build strategies available (Docu - Understanding image builds):
Docker build Source-to-Image (S2I) build Custom build
As the builds are running in a privileged container, a vulnerability in this process allows an attacker to escalate their permissions on the cluster and host nodes.
The custom build is not safe, because they can execute any code within a privileged container and are disabled by default. The other two strategies are considered as safe and are enabled for all users that can create builds.
But there is a note about the docker strategy:
Grant docker build permissions with caution, because a vulnerability in the Dockerfile processing logic could result in a privileges being granted on the host node.
See: https://docs.openshift.com/container-platform/4.16/cicd/builds/securing-builds-by-strategy.html
The docker strategy / the image used during the build has a vulnerability, which allows an attacker to override files inside the privileged build container with the help of the spec.source.secrets.secret.destinationDir attribute of the BuildConfig definition. After overriding the binary, execution of this overriden file can be triggered with another secret and the malicious code is executed in the privileged container.
As stated above, running code in a privileged container allows an attacker to escalate their permissions on the cluster and host nodes. As an example the host filesystem of the worker node can be mounted and a new SSH key can be added to user core of the Red Hat Enterprise Linux CoreOS (RHCOS).
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Ensure the custom build strategy is disabled (custom builds are not safe because they can execute arbitrary code in a privileged build container).
OpenShift build component custom build strategy = disabled - Configuration
Grant docker build permissions with caution; restrict who can create Docker builds via RBAC to trusted administrators only.
OpenShift build component docker build permission = restricted to trusted users - Configuration
Disallow or restrict use of spec.source.secrets.secret.destinationDir in BuildConfig so secrets cannot be used to overwrite files inside the privileged build container.
OpenShift BuildConfig spec.source.secrets[].destinationDir = not allowed / do not use - Configuration
Configure build pods and SecurityContextConstraints so builds do not run in privileged containers to reduce the risk of host/node escalation from build-time code execution.
OpenShift builds privileged = false / do not run privileged builds - Operational
If exploitation is suspected, inspect worker nodes for compromise (for example mounted host filesystem or added SSH keys to the core user on RHCOS), remove unauthorized keys, and rotate any potentially exposed credentials.
Event History
Frequently Asked Questions
What is the severity of REDHAT-BUG-2302259?
The severity of REDHAT-BUG-2302259 is classified as high due to potential risks in image creation and build strategies.
How do I fix REDHAT-BUG-2302259?
To fix REDHAT-BUG-2302259, update Red Hat OpenShift to the latest version that addresses this vulnerability.
What are the affected components of REDHAT-BUG-2302259?
The affected component of REDHAT-BUG-2302259 is the OpenShift build component responsible for creating images.
Is REDHAT-BUG-2302259 under active exploitation?
There is currently no evidence to suggest that REDHAT-BUG-2302259 is under active exploitation.
What can be done to mitigate risks associated with REDHAT-BUG-2302259?
To mitigate risks associated with REDHAT-BUG-2302259, implement strict access controls and auditing on build strategies.