CVE-2022-36035: Github.com/fluxcd/flux2 Flux CLI Workload Injection Vulnerability

HIGH
Advisory Identifier: GHSA-xwf3-6rgv-939r
CVSS 7.7
CWE-22
Published
Advisory Summary

CVE-2022-36035 is a HIGH (CVSS 7.7) flux cli workload injection vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Github.com/fluxcd/flux2 libraries in the Go ecosystem. The issue involves flux cli workload injection. Remediation is available by upgrading affected packages to version 0.32.0.

CVE-2022-36035 at a Glance

CVE Identifier CVE-2022-36035
GHSA Identifier GHSA-xwf3-6rgv-939r
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Github.com/fluxcd/flux2
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:L/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H).

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

How to Fix CVE-2022-36035

To remediate this vulnerability, upgrade all affected Github.com/fluxcd/flux2 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/flux2 fixed: 0.32.0
Upgrade github.com/fluxcd/flux2 to 0.32.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/flux2

How to Check if You Are Affected

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

inspect dependencies for github.com/fluxcd/flux2

Analyze the terminal output to locate any version of Github.com/fluxcd/flux2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.32.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/flux2, 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

Flux CLI allows users to deploy Flux components into a Kubernetes cluster via command-line. The vulnerability allows other applications to replace the Flux deployment information with arbitrary content which is deployed into the target Kubernetes cluster instead. The vulnerability is due to the improper handling of user-supplied input, which results in a path traversal that can be controlled by the attacker. ### Impact Users sharing the same shell between other applications and the Flux CLI commands could be affected by this vulnerability. In some scenarios no errors may be presented, which may cause end users not to realise that something is amiss. ### Workarounds A safe workaround is to execute Flux CLI in ephemeral and isolated shell environments, which can ensure no persistent values exist from previous processes. However, upgrading to the latest version of the CLI is still the recommended mitigation strategy. ### Credits The Flux engineering team found and patched this vulnerability. ### For more information If you have any questions or comments about this advisory: - Open an issue in any of the affected repositories. - Contact us at the CNCF Flux Channel.

CVE-2022-36035 Affected Github.com/fluxcd/flux2 Versions

1 component(s)
Fixed Versions:
0.32.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/fluxcd/flux2
Go
≥ 0.21.0
< 0.32.0
0.32.0

References

Frequently Asked Questions

What is CVE-2022-36035?
CVE-2022-36035 is a security vulnerability in Github.com/fluxcd/flux2 involving Flux CLI Workload Injection under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Github.com/fluxcd/flux2 versions are affected?
Affected versions include releases prior to 0.32.0 across affected packages: github.com/fluxcd/flux2.
What version fixes CVE-2022-36035?
Upgrading to 0.32.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/fluxcd/flux2 affected?
Yes, github.com/fluxcd/flux2 is affected in releases prior to 0.32.0. Upgrade your dependency to 0.32.0 or later.
What is the CVSS score of CVE-2022-36035?
CVE-2022-36035 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2022-36035?
CVE-2022-36035 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (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.).
How can I check Go dependencies for CVE-2022-36035?
Run the dependency tree command: 'inspect dependencies for github.com/fluxcd/flux2'. 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-xwf3-6rgv-939r",
  "modified" : "2022-09-01T22:15:35Z",
  "published" : "2022-09-01T22:15:35Z",
  "aliases" : [ "CVE-2022-36035" ],
  "summary" : "Flux CLI Workload Injection",
  "details" : "Flux CLI allows users to deploy Flux components into a Kubernetes cluster via command-line. The vulnerability allows other applications to replace the Flux deployment information with arbitrary content which is deployed into the target Kubernetes cluster instead.\n\nThe vulnerability is due to the improper handling of user-supplied input, which results in a path traversal that can be controlled by the attacker.\n\n### Impact\nUsers sharing the same shell between other applications and the Flux CLI commands could be affected by this vulnerability.\n\nIn some scenarios no errors may be presented, which may cause end users not to realise that something is amiss.\n\n### Workarounds\n\nA safe workaround is to execute Flux CLI in ephemeral and isolated shell environments, which can ensure no persistent values exist from previous processes. However, upgrading to the latest version of the CLI is still the recommended mitigation strategy.\n\n### Credits\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:\n- Open an issue in any of the affected repositories.\n- Contact us at the CNCF Flux Channel.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/fluxcd/flux2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.21.0"
      }, {
        "fixed" : "0.32.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/fluxcd/flux2/security/advisories/GHSA-xwf3-6rgv-939r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-36035"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/fluxcd/flux2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fluxcd/flux2/releases/tag/v0.32.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-01T22:15:35Z",
    "nvd_published_at" : "2022-08-31T15:15:00Z"
  }
}