CVE-2022-24817 Improper kubeconfig validation allows arbitrary code execution

Critical 9.9 Published Updated

Attackers can execute arbitrary code and escalate privileges by submitting malicious kubeconfig files to Flux2 controllers.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-24817?

CVE-2022-24817 is a critical code injection vulnerability in fluxcd flux2, published on 6 May 2022. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

Flux2 is an open and extensible continuous delivery solution for Kubernetes. Flux2 versions between 0.1.0 and 0.29.0, helm-controller 0.1.0 to v0.19.0, and kustomize-controller 0.1.0 to v0.23.0 are vulnerable to Code Injection via malicious Kubeconfig. In multi-tenancy deployments this can also lead to privilege escalation if the controller's service account has elevated permissions. Workarounds include disabling functionality via Validating Admission webhooks by restricting users from setting the `spec.kubeConfig` field in Flux `Kustomization` and `HelmRelease` objects. Additional mitigations include applying restrictive AppArmor and SELinux profiles on the controller’s pod to limit what binaries can be executed. This vulnerability is fixed in kustomize-controller v0.23.0 and helm-controller v0.19.0, both included in flux2 v0.29.0

Weakness: CWE-94

Which versions are affected by CVE-2022-24817?

8 open source packages ship an affected version, including github.com/fluxcd/flux2, flux and kustomize. It affects 3 products.

PackageAffectedFixed in
github.com/fluxcd/flux2 GoFrom 0.1.00.29.0
github.com/fluxcd/flux2 GoFrom 0.1.00.29.0
flux BitnamiFrom 0.1.00.29.0
kustomize BitnamiFrom 0.1.00.23.0
github.com/fluxcd/helm-controller GoFrom 0.2.00.19.0
github.com/fluxcd/helm-controller GoFrom 0.2.00.19.0
2 more packages
github.com/fluxcd/kustomize-controller GoFrom 0.1.00.23.0
github.com/fluxcd/kustomize-controller GoFrom 0.1.00.23.0

Products include Fluxcd Flux2, Fluxcd Helm-Controller, Fluxcd Kustomize-Controller.

How do I fix CVE-2022-24817?

Upgrade github.com/fluxcd/flux2 to 0.29.0 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2022-24817 being exploited?

There is no known exploitation of CVE-2022-24817 in the wild and no public exploit code.

Sources

Also known as BIT-flux-2022-24817, BIT-kustomize-2022-24817, GHSA-vvmq-fwmg-2gjc.

Is CVE-2022-24817 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free