CVE-2024-3154: Github.com/cri o/cri o CRI-O Vulnerable To An Arbitrary Vulnerability

HIGH
Advisory Identifier: GHSA-2cgq-h8xw-2v5j
CVSS 7.2
CWE-77
Published
Advisory Summary

CVE-2024-3154 is a HIGH (CVSS 7.2) cri-o vulnerable to an arbitrary vulnerability (CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')) affecting Github.com/cri o/cri o libraries in the Go ecosystem. The issue involves cri-o vulnerable to an arbitrary systemd property injection. Remediation is available by upgrading affected packages to version 1.29.4, 1.28.6, 1.27.6.

CVE-2024-3154 at a Glance

CVE Identifier CVE-2024-3154
GHSA Identifier GHSA-2cgq-h8xw-2v5j
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
Affected Product Github.com/cri o/cri o
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.2

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:U/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 Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-3154

To remediate this vulnerability, upgrade all affected Github.com/cri o/cri o 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/cri-o/cri-o fixed: 1.29.4
Upgrade github.com/cri-o/cri-o to 1.29.4
github.com/cri-o/cri-o fixed: 1.28.6
Upgrade github.com/cri-o/cri-o to 1.28.6
github.com/cri-o/cri-o fixed: 1.27.6
Upgrade github.com/cri-o/cri-o to 1.27.6
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/cri-o/cri-o

How to Check if You Are Affected

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

inspect dependencies for github.com/cri-o/cri-o

Analyze the terminal output to locate any version of Github.com/cri o/cri o in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.29.4), 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-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where the product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. In Github.com/cri o/cri o, 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 On CRI-O, it looks like an arbitrary systemd property can be injected via a Pod annotation: ``` --- apiVersion: v1 kind: Pod metadata: name: poc-arbitrary-systemd-property-injection annotations: # I believe that ExecStart with an arbitrary command works here too, # but I haven't figured out how to marshalize the ExecStart struct to gvariant string. org.systemd.property.SuccessAction: "'poweroff-force'" spec: containers: - name: hello image: [quay.io/podman/hello](http://quay.io/podman/hello) ``` This means that any user who can create a pod with an arbitrary annotation may perform an arbitrary action on the host system. Tested with CRI-O v1.24 on minikube. I didn't test the latest v1.29 because it is incompatible with minikube: https://github.com/kubernetes/minikube/pull/18367 Thanks to Cédric Clerget (GitHub ID @cclerget) for finding out that CRI-O just passes pod annotations to OCI annotations: https://github.com/opencontainers/runc/pull/3923#discussion_r1532292536 CRI-O has to filter out annotations that have the prefix "org.systemd.property." See also: - https://github.com/opencontainers/runtime-spec/blob/main/features.md#unsafe-annotations-in-configjson - https://github.com/opencontainers/runc/pull/4217 ### Workarounds Unfortunately, the only workarounds would involve an external mutating webhook to disallow these annotations ### References

CVE-2024-3154 Affected Github.com/cri o/cri o Versions

3 component(s)
Fixed Versions:
1.29.41.28.61.27.6
Product / Package Ecosystem Affected Versions Fixed Version
github.com/cri-o/cri-o
Go
≥ 1.29.0
< 1.29.4
1.29.4
github.com/cri-o/cri-o
Go
≥ 1.28.0
< 1.28.6
1.28.6
github.com/cri-o/cri-o
Go
< 1.27.6
1.27.6

References

Frequently Asked Questions

What is CVE-2024-3154?
CVE-2024-3154 is a security vulnerability in Github.com/cri o/cri o involving CRI-O vulnerable to an arbitrary systemd property injection under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').
Which Github.com/cri o/cri o versions are affected?
Affected versions include releases prior to 1.29.4, 1.28.6, 1.27.6 across affected packages: github.com/cri-o/cri-o.
What version fixes CVE-2024-3154?
Upgrading to 1.29.4, 1.28.6, 1.27.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/cri-o/cri-o affected?
Yes, github.com/cri-o/cri-o is affected in releases prior to 1.29.4, 1.28.6, 1.27.6. Upgrade your dependency to 1.29.4, 1.28.6, 1.27.6 or later.
What is the CVSS score of CVE-2024-3154?
CVE-2024-3154 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-3154?
CVE-2024-3154 is classified under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') (The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2024-3154?
Run the dependency tree command: 'inspect dependencies for github.com/cri-o/cri-o'. 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-2cgq-h8xw-2v5j",
  "modified" : "2024-05-01T13:06:49Z",
  "published" : "2024-04-30T09:39:38Z",
  "aliases" : [ "CVE-2024-3154" ],
  "summary" : "CRI-O vulnerable to an arbitrary systemd property injection",
  "details" : "### Impact\nOn CRI-O, it looks like an arbitrary systemd property can be injected via a Pod annotation:\n```\n---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: poc-arbitrary-systemd-property-injection\n  annotations:\n    # I believe that ExecStart with an arbitrary command works here too,\n    # but I haven't figured out how to marshalize the ExecStart struct to gvariant string.\n    org.systemd.property.SuccessAction: \"'poweroff-force'\"\nspec:\n  containers:\n    - name: hello\n      image: [quay.io/podman/hello](http://quay.io/podman/hello)\n```\n\nThis means that any user who can create a pod with an arbitrary annotation may perform an arbitrary action on the host system.\n\nTested with CRI-O v1.24 on minikube.\nI didn't test the latest v1.29 because it is incompatible with minikube: https://github.com/kubernetes/minikube/pull/18367\n\nThanks to Cédric Clerget (GitHub ID @cclerget) for finding out that CRI-O just passes pod annotations to OCI annotations:\nhttps://github.com/opencontainers/runc/pull/3923#discussion_r1532292536\n\nCRI-O has to filter out annotations that have the prefix \"org.systemd.property.\"\n\nSee also:\n- https://github.com/opencontainers/runtime-spec/blob/main/features.md#unsafe-annotations-in-configjson\n- https://github.com/opencontainers/runc/pull/4217\n\n\n### Workarounds\nUnfortunately, the only workarounds would involve an external mutating webhook to disallow these annotations\n\n### References\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cri-o/cri-o"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.29.0"
      }, {
        "fixed" : "1.29.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.29.3"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cri-o/cri-o"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.28.0"
      }, {
        "fixed" : "1.28.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.28.5"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cri-o/cri-o"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.27.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.27.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cri-o/cri-o/security/advisories/GHSA-2cgq-h8xw-2v5j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-3154"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/opencontainers/runc/pull/4217"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2024-3154"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2272532"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cri-o/cri-o"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/opencontainers/runtime-spec/blob/main/features.md#unsafe-annotations-in-configjson"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-04-30T09:39:38Z",
    "nvd_published_at" : null
  }
}