CVE-2022-24877: Github.com/fluxcd/kustomize controller Path Traversal Vulnerability
CRITICALCVE-2022-24877 is a CRITICAL (CVSS 9.9) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Github.com/fluxcd/kustomize controller libraries in the Go ecosystem. The issue involves improper path handling in kustomization files allows path traversal. Remediation is available by upgrading affected packages to version 0.24.0, 0.29.0.
CVE-2022-24877 at a Glance
Security Impact
CVSS: 9.9
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:H/I:H/A:H).
How to Fix CVE-2022-24877
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.
Upgrade github.com/fluxcd/kustomize-controller to 0.24.0
Upgrade github.com/fluxcd/flux2 to 0.29.0
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-24877, 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. 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
CVE-2022-24877 Affected Github.com/fluxcd/kustomize controller Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/fluxcd/kustomize-controller
|
Go |
< 0.24.0
|
0.24.0
|
|
github.com/fluxcd/flux2
|
Go |
< 0.29.0
|
0.29.0
|
References
Frequently Asked Questions
What is CVE-2022-24877?
Which Github.com/fluxcd/kustomize controller versions are affected?
What version fixes CVE-2022-24877?
Is github.com/fluxcd/kustomize-controller affected?
Is github.com/fluxcd/flux2 affected?
What is the CVSS score of CVE-2022-24877?
What CWE is associated with CVE-2022-24877?
How can I check Go dependencies for CVE-2022-24877?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-j77r-2fxf-5jrw",
"modified" : "2022-06-02T17:41:47Z",
"published" : "2022-05-04T18:04:07Z",
"aliases" : [ "CVE-2022-24877" ],
"summary" : "Improper path handling in kustomization files allows path traversal",
"details" : "The kustomize-controller enables the use of Kustomize’s functionality when applying Kubernetes declarative state onto a cluster. A malicious user can use built-in features and a specially crafted `kustomization.yaml` to expose sensitive data from the controller’s pod filesystem. In multi-tenancy deployments this can lead to privilege escalation if the controller's service account has elevated permissions.\n\nWithin the affected versions, users with write access to a Flux source are able to use built-in features to expose sensitive data from the controller’s pod filesystem using a malicious `kustomization.yaml` file.\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 a new Kustomize file system implementation which ensures that all files being handled are contained within the Kustomization working directory, blocking references to any files that do not meet that requirement.\n\nAutomated tooling (e.g. conftest) could be employed as a workaround, as part of a user's CI/CD pipeline to ensure that their `kustomization.yaml` files conform with specific policies, blocking access to sensitive path locations.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/fluxcd/kustomize-controller"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.24.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/fluxcd/flux2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.29.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/fluxcd/flux2/security/advisories/GHSA-j77r-2fxf-5jrw"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24877"
}, {
"type" : "WEB",
"url" : "https://github.com/fluxcd/kustomize-controller/commit/f4528fb25d611da94e491346bea056d5c5c3611f"
}, {
"type" : "WEB",
"url" : "https://github.com/fluxcd/pkg/commit/0ec014baf417fd3879d366a45503a548b9267d2a"
}, {
"type" : "PACKAGE",
"url" : "github.com/fluxcd/kustomize-controller"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-05-04T18:04:07Z",
"nvd_published_at" : "2022-05-06T01:15:00Z"
}
}