# CVE-2022-4318: Cri-o: /etc/passwd tampering privesc

> Attackers can escalate privileges by injecting arbitrary lines into /etc/passwd via a crafted environment variable in CRI-O.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 25 Sep 2023
- **Updated:** 3 Aug 2024
- **Also known as:** AZL-39873, GHSA-cm9x-c3rh-7rc4, GO-2022-1206, RHSA-2023:1033, RHSA-2023:1503

## What is CVE-2022-4318?

CVE-2022-4318 is a high-severity vulnerability in Fedoraproject Extra Packages for Enterprise Linux, published on 25 Sep 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

A vulnerability was found in cri-o. This issue allows the addition of arbitrary lines into /etc/passwd by use of a specially crafted environment variable.

Weakness: CWE-913 (Improper Control of Dynamically-Managed Code Resources), CWE-538 (Insertion of Sensitive Information into Externally-Accessible File or Directory)

## Which versions are affected by CVE-2022-4318?

3 open source packages ship an affected version, including github.com/cri-o/cri-o. It affects 7 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/cri-o/cri-o` | Go | All versions | 1.26.0 |
| `github.com/cri-o/cri-o` | Go | All versions | 1.26.0 |
| `github.com/cri-o/cri-o` | Go | All versions | 1.26.0 |
| `cri-o` | Red Hat:openshift:4.11::el8 | All versions | 0:1.24.4-10.rhaos4.11.git1ed5ac5.el8 |
| `cri-o-debuginfo` | Red Hat:openshift:4.11::el8 | All versions | 0:1.24.4-10.rhaos4.11.git1ed5ac5.el8 |
| `cri-o-debugsource` | Red Hat:openshift:4.11::el8 | All versions | 0:1.24.4-10.rhaos4.11.git1ed5ac5.el8 |
| `cri-o` | Red Hat:openshift:4.12::el8 | All versions | 0:1.25.2-10.rhaos4.12.git0a083f9.el8 |
| `cri-o-debuginfo` | Red Hat:openshift:4.12::el8 | All versions | 0:1.25.2-10.rhaos4.12.git0a083f9.el8 |
| `cri-o-debugsource` | Red Hat:openshift:4.12::el8 | All versions | 0:1.25.2-10.rhaos4.12.git0a083f9.el8 |
| `cri-o` | Red Hat:openshift:4.12::el9 | All versions | 0:1.25.2-9.rhaos4.12.git0a083f9.el9 |
| `cri-o-debuginfo` | Red Hat:openshift:4.12::el9 | All versions | 0:1.25.2-9.rhaos4.12.git0a083f9.el9 |
| `cri-o-debugsource` | Red Hat:openshift:4.12::el9 | All versions | 0:1.25.2-9.rhaos4.12.git0a083f9.el9 |

Products: Fedoraproject Extra Packages for Enterprise Linux, Fedoraproject Fedora, Kubernetes Cri-O, Redhat Openshift Container Platform for Arm64, Redhat Openshift Container Platform for Linuxone, Redhat Openshift Container Platform for Power, Redhat Openshift Container Platform Ibm Z Systems.

## How do I fix CVE-2022-4318?

Upgrade github.com/cri-o/cri-o to 1.26.0 or later.

## Is CVE-2022-4318 being exploited?

There is no known exploitation of CVE-2022-4318 in the wild and no public exploit code.

## Other vulnerabilities in Fedoraproject Extra Packages for Enterprise Linux

- [CVE-2023-34152](https://insights.sbomify.com/CVE-2023-34152/): Command injection in ImageMagick (critical 9.8)
- [CVE-2022-4170](https://insights.sbomify.com/CVE-2022-4170/): Code injection in rxvt-unicode (critical 9.8)
- [CVE-2022-40315](https://insights.sbomify.com/CVE-2022-40315/): Moodle Minor SQL injection risk in admin user browsing (critical 9.8)
- [CVE-2022-45152](https://insights.sbomify.com/CVE-2022-45152/): Moodle blind Server-Side Request Forgery (SSRF) vulnerability in LTI provider library (critical 9.1)
- [CVE-2022-24882](https://insights.sbomify.com/CVE-2022-24882/): Server side NTLM does not properly check parameters in FreeRDP (critical 9.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-4318 and fix it if it is affected.

What it is: CVE-2022-4318 is a high-severity vulnerability in Fedoraproject Extra Packages for Enterprise Linux, published on 25 Sep 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-4318 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/cri-o/cri-o (Go): affected all versions; fixed in 1.26.0
- github.com/cri-o/cri-o (Go): affected all versions; fixed in 1.26.0
- github.com/cri-o/cri-o (Go): affected all versions; fixed in 1.26.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-4318/ (Markdown: https://insights.sbomify.com/CVE-2022-4318/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-4318
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-4318
- OSV: https://osv.dev/vulnerability/CVE-2022-4318

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-4318/
Summaries are generated and may contain mistakes; the official description above is the record.
