CVE-2022-24878: Github.com/fluxcd/kustomize controller Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-7pwf-jg34-hxwp
CVSS 7.7
CWE-674
Published
Advisory Summary

CVE-2022-24878 is a HIGH (CVSS 7.7) denial of service vulnerability (CWE-674: Uncontrolled Recursion) affecting Github.com/fluxcd/kustomize controller libraries in the Go ecosystem. The issue involves improper path handling in kustomization files allows for denial of service. Remediation is available by upgrading affected packages to version 0.24.0, 0.29.0.

CVE-2022-24878 at a Glance

CVE Identifier CVE-2022-24878
GHSA Identifier GHSA-7pwf-jg34-hxwp
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-674: Uncontrolled Recursion
Affected Product Github.com/fluxcd/kustomize controller
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2022-24878

To remediate this vulnerability, upgrade all affected Github.com/fluxcd/kustomize controller dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/fluxcd/kustomize-controller fixed: 0.24.0
Upgrade github.com/fluxcd/kustomize-controller to 0.24.0
github.com/fluxcd/flux2 fixed: 0.29.0
Upgrade github.com/fluxcd/flux2 to 0.29.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/fluxcd/kustomize-controller

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-24878, inspect your project dependencies for Github.com/fluxcd/kustomize controller:

inspect dependencies for github.com/fluxcd/kustomize-controller

Analyze the terminal output to locate any version of Github.com/fluxcd/kustomize controller in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.24.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. In Github.com/fluxcd/kustomize controller, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The kustomize-controller enables the use of Kustomize’s functionality when applying Kubernetes declarative state onto a cluster. A malicious user can use a specially crafted `kustomization.yaml` to cause Denial of Service at controller level. In multi-tenancy deployments this can lead to multiple tenants not being able to apply their Kustomizations until the malicious `kustomization.yaml` is removed and the controller restarted. ### Impact Within the affected versions, users with write access to a Flux source are able to craft a malicious `kustomization.yaml` file which causes the controller to enter an endless loop. ### Patches This vulnerability was fixed in kustomize-controller v0.24.0 and included in flux2 v0.29.0 released on 2022-04-20. The changes introduce better handling of Kustomization files blocking references that could lead to endless loops. ### 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).

CVE-2022-24878 Affected Github.com/fluxcd/kustomize controller Versions

2 component(s)
Fixed Versions:
0.24.00.29.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/fluxcd/kustomize-controller
Go
≥ 0.16.0
< 0.24.0
0.24.0
github.com/fluxcd/flux2
Go
≥ 0.19.0
< 0.29.0
0.29.0

References

Frequently Asked Questions

What is CVE-2022-24878?
CVE-2022-24878 is a security vulnerability in Github.com/fluxcd/kustomize controller involving Improper path handling in Kustomization files allows for denial of service under CWE-674: Uncontrolled Recursion.
Which Github.com/fluxcd/kustomize controller versions are affected?
Affected versions include releases prior to 0.24.0, 0.29.0 across affected packages: github.com/fluxcd/kustomize-controller, github.com/fluxcd/flux2.
What version fixes CVE-2022-24878?
Upgrading to 0.24.0, 0.29.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/fluxcd/kustomize-controller affected?
Yes, github.com/fluxcd/kustomize-controller is affected in releases prior to 0.24.0. Upgrade your dependency to 0.24.0 or later.
Is github.com/fluxcd/flux2 affected?
Yes, github.com/fluxcd/flux2 is affected in releases prior to 0.29.0. Upgrade your dependency to 0.29.0 or later.
What is the CVSS score of CVE-2022-24878?
CVE-2022-24878 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:N/A:H.
What CWE is associated with CVE-2022-24878?
CVE-2022-24878 is classified under CWE-674: Uncontrolled Recursion (The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.).
How can I check Go dependencies for CVE-2022-24878?
Run the dependency tree command: 'inspect dependencies for github.com/fluxcd/kustomize-controller'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7pwf-jg34-hxwp",
  "modified" : "2022-05-20T16:58:38Z",
  "published" : "2022-05-20T16:58:38Z",
  "aliases" : [ "CVE-2022-24878" ],
  "summary" : "Improper path handling in Kustomization files allows for denial of service",
  "details" : "The kustomize-controller enables the use of Kustomize’s functionality when applying Kubernetes declarative state onto a cluster. A malicious user can use a specially crafted `kustomization.yaml` to cause Denial of Service at controller level.\n\nIn multi-tenancy deployments this can lead to multiple tenants not being able to apply their Kustomizations until the malicious `kustomization.yaml` is removed and the controller restarted.\n\n### Impact\n\nWithin the affected versions, users with write access to a Flux source are able to craft a malicious `kustomization.yaml` file which causes the controller to enter an endless loop.\n\n### Patches\n\nThis vulnerability was fixed in kustomize-controller v0.24.0 and included in flux2 v0.29.0 released on 2022-04-20. The changes introduce better handling of Kustomization files blocking references that could lead to endless loops.\n\n### Credits\n\nThe Flux engineering team found and patched this vulnerability.\n\n### For more information\n\nIf you have any questions or comments about this advisory please open an issue in the [flux2 repository](http://github.com/fluxcd/flux2).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/fluxcd/kustomize-controller"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.16.0"
      }, {
        "fixed" : "0.24.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/fluxcd/flux2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.19.0"
      }, {
        "fixed" : "0.29.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/fluxcd/flux2/security/advisories/GHSA-7pwf-jg34-hxwp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24878"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/fluxcd/flux2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-674" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-05-20T16:58:38Z",
    "nvd_published_at" : "2022-05-06T02:15:00Z"
  }
}