REDHAT-BUG-2589109: Medium severity KubeMacPool vulnerability
Reported by EZO Labs Security.
A flaw was found in kubemacpool. The pod and virtual machine mutating admission webhooks are served with a server certificate only and do not authenticate the client. From a pod in the cluster, a caller can submit an AdmissionReview that the handlers apply to the in-memory MAC pool.
Pod allocations are recorded without an expiry and are released when a real pod deletion is observed. Reservations made for pods that never exist therefore remain until the kubemacpool process restarts. Virtual machine allocations are different: when KubeVirt is installed, stale entries are removed after the configured wait (300 seconds in the shipped manifests) if the virtual machine object was never created.
Both webhooks are deployed with failurePolicy Fail. Once allocation fails, or the webhook does not answer in time, the API server rejects the admission. In the shipped configuration the virtual machine webhook applies unless a namespace opts out, so new virtual machine creation is denied cluster-wide. Existing virtual machines continue to run. The pod webhook is opt-in. Forged responses are not used by the API server, and the flaw does not expose or create credentials.
The behavior is present on current upstream main and in every supported downstream build, cnv-4.12 through cnv-5.0. Restarting the process rebuilds the pool from live objects and restores admission, but does not prevent the condition from being created again. A NetworkPolicy in front of the service is not a sufficient workaround. The fix belongs in the design: perform allocation from the controller, which already watches real pods and virtual machines, and keep the webhook from committing pool state.
No upstream issue, advisory, or fix has been published.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Move MAC-pool allocation to the controller, which watches real pods and virtual machines, and prevent the webhook from committing pool state.
- Operational
Restart the kubemacpool process to rebuild the pool from live objects and restore admission; this does not prevent the condition from recurring.
Event History
Frequently Asked Questions
Who can exploit this issue in a typical deployment?
A caller needs to be able to send requests from a pod inside the cluster to the mutating admission webhook. The webhooks do not authenticate clients, so an in-cluster pod can submit forged AdmissionReview requests.
Are pod and virtual machine workloads affected in the same way?
No. The pod webhook is opt-in, while the virtual machine webhook applies by default in the shipped configuration unless a namespace opts out. For virtual machines, stale allocations for objects that were never created are removed after the configured wait, which is 300 seconds in the shipped manifests when KubeVirt is installed.
What is the operational impact of successful exploitation?
Forged pod allocation requests for pods that never exist remain in the in-memory MAC pool until the kubemacpool process restarts. If allocation is exhausted or a webhook times out, failurePolicy Fail causes the API server to reject admissions; in the shipped configuration this can deny new virtual machine creation cluster-wide, while existing virtual machines continue running.
Does this allow an attacker to obtain credentials or spoof admission results to the API server?
No. Forged responses are not used by the API server, and the flaw does not expose or create credentials.