CVE-2024-22036: Github.com/rancher/rancher Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-h99m-6755-rgwc
CVSS 9.1
CWE-269
Published
Advisory Summary

CVE-2024-22036 is a CRITICAL (CVSS 9.1) remote code execution vulnerability (CWE-269: Improper Privilege Management) affecting Github.com/rancher/rancher libraries in the Go ecosystem. The issue involves rancher remote code execution via cluster/node drivers. Remediation is available by upgrading affected packages to version 2.7.16, 2.8.9, 2.9.3.

CVE-2024-22036 at a Glance

CVE Identifier CVE-2024-22036
GHSA Identifier GHSA-h99m-6755-rgwc
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-269: Improper Privilege Management
Affected Product Github.com/rancher/rancher
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.1

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

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

How to Fix CVE-2024-22036

To remediate this vulnerability, upgrade all affected Github.com/rancher/rancher 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/rancher/rancher fixed: 2.7.16
Upgrade github.com/rancher/rancher to 2.7.16
github.com/rancher/rancher fixed: 2.8.9
Upgrade github.com/rancher/rancher to 2.8.9
github.com/rancher/rancher fixed: 2.9.3
Upgrade github.com/rancher/rancher to 2.9.3
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/rancher/rancher

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-22036, inspect your project dependencies for Github.com/rancher/rancher:

inspect dependencies for github.com/rancher/rancher

Analyze the terminal output to locate any version of Github.com/rancher/rancher in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.7.16), 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-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. In Github.com/rancher/rancher, 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

### Impact A vulnerability has been identified within Rancher where a cluster or node driver can be used to escape the `chroot` jail and gain root access to the Rancher container itself. In production environments, further privilege escalation is possible based on living off the land within the Rancher container itself. For the test and development environments, based on a –privileged Docker container, it is possible to escape the Docker container and gain execution access on the host system. This happens because: - During startup, Rancher appends the `/opt/drivers/management-state/bin` directory to the `PATH` environment variable. - In Rancher, the binaries `/usr/bin/rancher-machine`, `/usr/bin/helm_v3`, and `/usr/bin/kustomize` are assigned a UID of 1001 and a GID of 127 instead of being owned by the root user. - Rancher employs a jail mechanism to isolate the execution of node drivers from the main process. However, the drivers are executed with excessive permissions. - During the registration of new node drivers, its binary is executed with the same user as the parent process, which could enable an attacker to gain elevated privileges by registering a malicious driver. - Lack of validation on the driver file type, which allows symbolic links to be used. Please consult the associated [MITRE ATT&CK - Technique - Privilege Escalation](https://attack.mitre.org/tactics/TA0004/) and [MITRE ATT&CK - Technique - Execution](https://attack.mitre.org/tactics/TA0002/) for further information about this category of attack. **Since they run at a privileged level, it is recommended to use trusted drivers only.** ### Patches The fix involves some key areas with the following changes: Fixing the `PATH` environment variable: - Remove the step that appends `/opt/drivers/management-state/bin` to the `PATH` environment variable. Binaries permissions: - Correct the permission of the binaries `/usr/bin/rancher-machine`, `/usr/bin/helm_v3`, and `/usr/bin/kustomize` so that they are owned by the root user. Improving Rancher jail security mechanism: - A new group `jail-accessors` has been created, and the rancher user has been added to this group. - The `jail-accessors` group is granted read and execute permissions for the directories `/var/lib/rancher`, `/var/lib/cattle`, and `/usr/local/bin`. - The jail mechanism has been enhanced to execute commands using the non-root `rancher` user and the `jail-accessors` group. Additionally, a new setting, `UnprivilegedJailUser`, has been introduced to manage this behavior, allowing users to opt-out if they need to run drivers in a more privileged context. - Limit the devices copied to the jail directory to a minimal set. Fixing node driver registration: - The `NewPlugin(driver)` function in the `rancher/machine` module has been updated to allow setting the UID and GID for starting the plugin server. If the environment variables `MACHINE_PLUGIN_UID` and `MACHINE_PLUGIN_GID` are set, their values will be used to configure the user credentials for launching the plugin server. - Rancher now sets these environment variables with a non-root UID and GID before invoking the `NewPlugin(driver)` function and then unsets them after retrieving the creation flags. Improvements on driver package: - The `driver` package has been revised to verify that the downloaded driver binary is a regular file. - The `driver` package has been revised to verify that the target file in the downloaded tar file is a regular file. - The `driver` package now executes the downloaded driver binary within a jail, with a default timeout of 5 seconds. Other improvements: - The helm package has been updated to ensure appropriate permissions are set on the generated kubeconfig file. - The `nodeConfig` package has been updated to ensure proper permissions are applied when extracting the node configuration. Patched versions include releases `2.7.16`, `2.8.9` and `2.9.3`. ### Workarounds If you can't upgrade to a fixed version, please make sure that: 1. Drivers are only executed from trusted sources. 2. The use of Admins/Restricted Admins is limited to trusted users. ### References If you have any questions or comments about this advisory: - Reach out to the [SUSE Rancher Security team](https://github.com/rancher/rancher/security/policy) for security related inquiries. - Open an issue in the [Rancher](https://github.com/rancher/rancher/issues/new/choose) repository. - Verify with our [support matrix](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/) and [product support lifecycle](https://www.suse.com/lifecycle/).

CVE-2024-22036 Affected Github.com/rancher/rancher Versions

3 component(s)
Fixed Versions:
2.7.162.8.92.9.3
Product / Package Ecosystem Affected Versions Fixed Version
github.com/rancher/rancher
Go
≥ 2.7.0
< 2.7.16
2.7.16
github.com/rancher/rancher
Go
≥ 2.8.0
< 2.8.9
2.8.9
github.com/rancher/rancher
Go
≥ 2.9.0
< 2.9.3
2.9.3

References

Frequently Asked Questions

What is CVE-2024-22036?
CVE-2024-22036 is a security vulnerability in Github.com/rancher/rancher involving Rancher Remote Code Execution via Cluster/Node Drivers under CWE-269: Improper Privilege Management.
Which Github.com/rancher/rancher versions are affected?
Affected versions include releases prior to 2.7.16, 2.8.9, 2.9.3 across affected packages: github.com/rancher/rancher.
What version fixes CVE-2024-22036?
Upgrading to 2.7.16, 2.8.9, 2.9.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/rancher/rancher affected?
Yes, github.com/rancher/rancher is affected in releases prior to 2.7.16, 2.8.9, 2.9.3. Upgrade your dependency to 2.7.16, 2.8.9, 2.9.3 or later.
What is the CVSS score of CVE-2024-22036?
CVE-2024-22036 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2024-22036?
CVE-2024-22036 is classified under CWE-269: Improper Privilege Management (The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.).
How can I check Go dependencies for CVE-2024-22036?
Run the dependency tree command: 'inspect dependencies for github.com/rancher/rancher'. 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-h99m-6755-rgwc",
  "modified" : "2025-04-16T13:17:21Z",
  "published" : "2024-10-25T19:37:22Z",
  "aliases" : [ "CVE-2024-22036" ],
  "summary" : "Rancher Remote Code Execution via Cluster/Node Drivers",
  "details" : "### Impact\nA vulnerability has been identified within Rancher where a cluster or node driver can be used to escape the `chroot` jail and gain root access to the Rancher container itself. In production environments, further privilege escalation is possible based on living off the land within the Rancher container itself. For the test and development environments, based on a –privileged Docker container, it is possible to escape the Docker container and gain execution access on the host system. \n\nThis happens because:\n- During startup, Rancher appends the `/opt/drivers/management-state/bin` directory to the `PATH` environment variable.\n- In Rancher, the binaries `/usr/bin/rancher-machine`, `/usr/bin/helm_v3`, and `/usr/bin/kustomize` are assigned a UID of 1001 and a GID of 127 instead of being owned by the root user.\n- Rancher employs a jail mechanism to isolate the execution of node drivers from the main process. However, the drivers are executed with excessive permissions.\n- During the registration of new node drivers, its binary is executed with the same user as the parent process, which could enable an attacker to gain elevated privileges by registering a malicious driver.\n- Lack of validation on the driver file type, which allows symbolic links to be used.\n\n\nPlease consult the associated  [MITRE ATT&CK - Technique - Privilege Escalation](https://attack.mitre.org/tactics/TA0004/) and [MITRE ATT&CK - Technique - Execution](https://attack.mitre.org/tactics/TA0002/) for further information about this category of attack.\n\n**Since they run at a privileged level, it is recommended to use trusted drivers only.**\n\n### Patches\nThe fix involves some key areas with the following changes:\n\nFixing the `PATH` environment variable:\n- Remove the step that appends `/opt/drivers/management-state/bin` to the `PATH` environment variable.\n\nBinaries permissions:\n- Correct the permission of the binaries `/usr/bin/rancher-machine`, `/usr/bin/helm_v3`, and `/usr/bin/kustomize` so that they are owned by the root user.\n\nImproving Rancher jail security mechanism:\n- A new group `jail-accessors` has been created, and the rancher user has been added to this group.\n- The `jail-accessors` group is granted read and execute permissions for the directories `/var/lib/rancher`, `/var/lib/cattle`, and `/usr/local/bin`.\n- The jail mechanism has been enhanced to execute commands using the non-root `rancher` user and the `jail-accessors` group. Additionally, a new setting, `UnprivilegedJailUser`, has been introduced to manage this behavior, allowing users to opt-out if they need to run drivers in a more privileged context.\n- Limit the devices copied to the jail directory to a minimal set.\n\nFixing node driver registration:\n- The `NewPlugin(driver)` function in the `rancher/machine` module has been updated to allow setting the UID and GID for starting the plugin server. If the environment variables `MACHINE_PLUGIN_UID` and `MACHINE_PLUGIN_GID` are set, their values will be used to configure the user credentials for launching the plugin server. \n- Rancher now sets these environment variables with a non-root UID and GID before invoking the `NewPlugin(driver)` function and then unsets them after retrieving the creation flags.\n\nImprovements on driver package:\n- The `driver` package has been revised to verify that the downloaded driver binary is a regular file.\n- The `driver` package has been revised to verify that the target file in the downloaded tar file is a regular file.\n- The `driver` package now executes the downloaded driver binary within a jail, with a default timeout of 5 seconds.\n\nOther improvements:\n- The helm package has been updated to ensure appropriate permissions are set on the generated kubeconfig file.\n- The `nodeConfig` package has been updated to ensure proper permissions are applied when extracting the node configuration.\n\nPatched versions include releases `2.7.16`, `2.8.9` and `2.9.3`.\n\n### Workarounds\nIf you can't upgrade to a fixed version, please make sure that:\n1. Drivers are only executed from trusted sources.\n2. The use of Admins/Restricted Admins is limited to trusted users.\n\n\n### References\nIf you have any questions or comments about this advisory:\n- Reach out to the [SUSE Rancher Security team](https://github.com/rancher/rancher/security/policy) for security related inquiries.\n- Open an issue in the [Rancher](https://github.com/rancher/rancher/issues/new/choose) repository.\n- Verify with our [support matrix](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/) and [product support lifecycle](https://www.suse.com/lifecycle/).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/rancher/rancher"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.7.0"
      }, {
        "fixed" : "2.7.16"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/rancher/rancher"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.0"
      }, {
        "fixed" : "2.8.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/rancher/rancher"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.9.0"
      }, {
        "fixed" : "2.9.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rancher/rancher/security/advisories/GHSA-h99m-6755-rgwc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-22036"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.suse.com/show_bug.cgi?id=CVE-2024-22036"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rancher/rancher"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-269" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-10-25T19:37:22Z",
    "nvd_published_at" : "2025-04-16T09:15:27Z"
  }
}