Loading...
Skip to main content

CVE-2022-24817 — Vulnerability in...

CRITICAL

Improper kubeconfig validation allows arbitrary code execution

Published May 16, 2022Updated December 2, 2025Source: osv

Summary

Flux2 can reconcile the state of a remote cluster when provided with a [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#file-references) with the correct access rights. `Kubeconfig` files can define [commands](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins) to be executed to generate on-demand authentication tokens. A malicious user with write access to a Flux source or direct access to the target cluster, could craft a `kubeconfig` to execute arbitrary code inside the controller’s container. In multi-tenancy deployments this can also lead to privilege escalation if the controller's service account has elevated permissions. ### Impact Within the affected versions range, one of the permissions set below would be required for the vulnerability to be exploited: - Direct access to the cluster to create Flux `Kustomization` or `HelmRelease` objects and Kubernetes Secrets. - Direct access to the cluster to modify existing Kubernetes secrets being used as `kubeconfig` in existing Flux `Kustomization` or `HelmRelease` objects. - Direct access to the cluster to modify existing Flux `Kustomization` or `HelmRelease` objects and access to create or modify existing Kubernetes secrets. - Access rights to make changes to a configured Flux Source (i.e. Git repository). ### Patches This vulnerability was fixed in kustomize-controller [v0.23.0](https://github.com/fluxcd/kustomize-controller/releases/tag/v0.23.0) and helm-controller [v0.19.0](https://github.com/fluxcd/helm-controller/releases/tag/v0.19.0), both included in flux2 [v0.29.0](https://github.com/fluxcd/flux2/releases/tag/v0.29.0). Starting from the fixed versions, both controllers disable the use of command execution from `kubeconfig` files by default, users have to opt-in by adding the flag `--insecure-kubeconfig-exec` to the controller’s command arguments. Users are no longer allowed to refer to files in the controller’s filesystem in the `kubeconfig` files provided for the remote apply feature. ### Workarounds - The functionality can be disabled via Validating Admission webhooks (e.g. OPA Gatekeeper, Kyverno) by restricting users from being able to set the `spec.kubeConfig` field in Flux `Kustomization` and `HelmRelease` objects. - Applying restrictive AppArmor and SELinux profiles on the controller’s pod to limit what binaries can be executed. ### Credits The Flux engineering team found and patched this vulnerability. ### For more information If you have any questions or comments about this advisory please open an issue in the [flux2 repository](http://github.com/fluxcd/flux2).

Advisory Timeline

  • First published May 16, 2022 (1610 days ago).
  • Last revised December 2, 2025 — 1296 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Go
Update github.com/fluxcd/kustomize-controller to 0.23.0 or later
go get github.com/fluxcd/kustomize-controller@v0.23.0
Go
Update github.com/fluxcd/helm-controller to 0.19.0 or later
go get github.com/fluxcd/helm-controller@v0.19.0
Go
Update github.com/fluxcd/flux2 to 0.29.0 or later
go get github.com/fluxcd/flux2@v0.29.0

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (3)

Affects 1 ecosystem: go (3).

PackageEcosystemAffectedFixed In
github.com/fluxcd/kustomize-controller
go
All versions0.23.0
github.com/fluxcd/helm-controller
go
All versions0.19.0
github.com/fluxcd/flux2
go
All versions0.29.0

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.9 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2022-24817?
Improper kubeconfig validation allows arbitrary code execution This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.9/10).
How do I check if my project is affected by CVE-2022-24817?
CVE-2022-24817 affects github.com/fluxcd/kustomize-controller, github.com/fluxcd/helm-controller and github.com/fluxcd/flux2. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2022-24817 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.9

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-vvmq-fwmg-2gjc
BIT-flux-2022-24817
BIT-kustomize-2022-24817

Related CVEs

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies