CVE-2022-24817
Flux Kustomize Controller vulnerability analysis and mitigation

Overview

Flux2, an open and extensible continuous delivery solution for Kubernetes, was found to contain a critical vulnerability (CVE-2022-24817) discovered in May 2022. The vulnerability affects Flux2 versions between 0.1.0 and 0.29.0, helm-controller versions 0.1.0 to v0.19.0, and kustomize-controller versions 0.1.0 to v0.23.0. This security issue involves improper kubeconfig validation that could allow arbitrary code execution (GitHub Advisory).

Technical details

The vulnerability stems from Flux2's feature to reconcile the state of remote clusters using kubeconfig files with access rights. Kubeconfig files can define commands to be executed to generate on-demand authentication tokens. The issue lies in the fact that the use of executables in kubeconfigs was enabled by default, allowing malicious users to craft a kubeconfig that could lead to arbitrary code execution inside the controller's container. The vulnerability has been assigned a CVSS v3.1 base score of 9.9 (Critical) with the vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H (GitHub Advisory).

Impact

The vulnerability could be exploited by users with either direct access to the cluster to create/modify Flux Kustomization or HelmRelease objects and Kubernetes Secrets, or access rights to make changes to a configured Flux Source. In multi-tenancy deployments, this vulnerability could lead to privilege escalation if the controller's service account has elevated permissions (GitHub Advisory).

Exploitability

To exploit this vulnerability, an attacker would need one of the following permissions: direct access to create Flux objects and Kubernetes Secrets, ability to modify existing Kubernetes secrets used as kubeconfig, or access to modify existing Flux objects combined with secret creation/modification rights. At the time of disclosure, there were no known public exploits in the wild (Kubernetes Discussion).

Mitigation and workarounds

The vulnerability was fixed in kustomize-controller v0.23.0 and helm-controller v0.19.0, both included in flux2 v0.29.0. The fix disables command execution from kubeconfig files by default, requiring users to explicitly opt-in using the --insecure-kubeconfig-exec flag. Temporary workarounds include using Validating Admission webhooks to restrict users from setting the spec.kubeConfig field in Flux objects, and applying restrictive AppArmor and SELinux profiles on the controller's pod to limit executable binaries (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Related Flux Kustomize Controller vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2022-24817CRITICAL9.9
  • Flux Kustomize Controller logoFlux Kustomize Controller
  • cpe:2.3:a:fluxcd:kustomize-controller
NoYesMay 06, 2022
CVE-2022-24877HIGH8.8
  • Flux Kustomize Controller logoFlux Kustomize Controller
  • github.com/fluxcd/kustomize-controller
NoYesMay 06, 2022
CVE-2021-41254HIGH8.8
  • Flux Kustomize Controller logoFlux Kustomize Controller
  • github.com/fluxcd/kustomize-controller
NoYesNov 12, 2021
CVE-2022-24878MEDIUM6.5
  • Flux Kustomize Controller logoFlux Kustomize Controller
  • cpe:2.3:a:fluxcd:kustomize-controller
NoYesMay 06, 2022
CVE-2022-39272MEDIUM4.3
  • Flux CLI logoFlux CLI
  • github.com/fluxcd/source-controller/api
NoYesOct 22, 2022

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management