CVE-2022-4318: Github.com/cri o/cri o CRI-O Vulnerable To /etc/passwd Tampering Vulnerability

MODERATE
Advisory Identifier: GHSA-cm9x-c3rh-7rc4
CVSS 6.1
CWE-913 CWE-538
Published
Advisory Summary

CVE-2022-4318 is a MODERATE (CVSS 6.1) cri-o vulnerable to /etc/passwd tampering vulnerability (CWE-913: Improper Control of Dynamically-Managed Code Resources) affecting Github.com/cri o/cri o libraries in the Go ecosystem. The issue involves cri-o vulnerable to /etc/passwd tampering resulting in privilege escalation. Remediation is available by upgrading affected packages to version 1.26.0.

CVE-2022-4318 at a Glance

CVE Identifier CVE-2022-4318
GHSA Identifier GHSA-cm9x-c3rh-7rc4
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-913: Improper Control of Dynamically-Managed Code Resources
Affected Product Github.com/cri o/cri o
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.1

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

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

How to Fix CVE-2022-4318

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.26.0
Upgrade github.com/cri-o/cri-o to 1.26.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/cri-o/cri-o

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-4318, 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.26.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-913: Improper Control of Dynamically-Managed Code Resources, where the product does not properly restrict reading from or writing to dynamically-managed code resources such as variables, objects, classes, attributes, functions, or executable instructions or statements. 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 It is possible to craft an environment variable with newlines to add entries to a container's /etc/passwd. It is possible to circumvent admission validation of username/UID by adding such an entry. Note: because the pod author is in control of the container's /etc/passwd, this is not considered a new risk factor. However, this advisory is being opened for transparency and as a way of tracking fixes. ### Patches 1.26.0 will have the fix. More patches will be posted as they're available. ### Workarounds Additional security controls like SELinux should prevent any damage a container is able to do with root on the host. Using SELinux is recommended because this class of attack is already possible by manually editing the container's /etc/passwd ### References

CVE-2022-4318 Affected Github.com/cri o/cri o Versions

1 component(s)
Fixed Versions:
1.26.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/cri-o/cri-o
Go
< 1.26.0
1.26.0

References

Frequently Asked Questions

What is CVE-2022-4318?
CVE-2022-4318 is a security vulnerability in Github.com/cri o/cri o involving CRI-O vulnerable to /etc/passwd tampering resulting in Privilege Escalation under CWE-913: Improper Control of Dynamically-Managed Code Resources.
Which Github.com/cri o/cri o versions are affected?
Affected versions include releases prior to 1.26.0 across affected packages: github.com/cri-o/cri-o.
What version fixes CVE-2022-4318?
Upgrading to 1.26.0 (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.26.0. Upgrade your dependency to 1.26.0 or later.
What is the CVSS score of CVE-2022-4318?
CVE-2022-4318 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:L/I:H/A:N.
What CWE is associated with CVE-2022-4318?
CVE-2022-4318 is classified under CWE-913: Improper Control of Dynamically-Managed Code Resources (The product does not properly restrict reading from or writing to dynamically-managed code resources such as variables, objects, classes, attributes, functions, or executable instructions or statements.).
How can I check Go dependencies for CVE-2022-4318?
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-cm9x-c3rh-7rc4",
  "modified" : "2022-12-29T01:49:47Z",
  "published" : "2022-12-29T01:49:47Z",
  "aliases" : [ "CVE-2022-4318" ],
  "summary" : "CRI-O vulnerable to /etc/passwd tampering resulting in Privilege Escalation",
  "details" : "### Impact\nIt is possible to craft an environment variable with newlines to add entries to a container's /etc/passwd. It is possible to circumvent admission validation of username/UID by adding such an entry.\n\nNote: because the pod author is in control of the container's /etc/passwd, this is not considered a new risk factor. However, this advisory is being opened for transparency and as a way of tracking fixes.\n\n### Patches\n1.26.0 will have the fix. More patches will be posted as they're available.\n\n### Workarounds\nAdditional security controls like SELinux should prevent any damage a container is able to do with root on the host. Using SELinux is recommended because this class of attack is already possible by manually editing the container's /etc/passwd \n\n### References\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:L/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cri-o/cri-o"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.26.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cri-o/cri-o/security/advisories/GHSA-cm9x-c3rh-7rc4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-4318"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cri-o/cri-o/pull/6450"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2023:1033"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2023:1503"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2022-4318"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2152703"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cri-o/cri-o"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-538", "CWE-913" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-12-29T01:49:47Z",
    "nvd_published_at" : "2023-09-25T20:15:10Z"
  }
}