CVE-2022-4318

7.8 HIGH

📋 TL;DR

This vulnerability in cri-o allows attackers to inject arbitrary lines into the /etc/passwd file using a specially crafted environment variable. This could enable privilege escalation or unauthorized access to containerized systems. Organizations using vulnerable versions of cri-o for container orchestration are affected.

💻 Affected Systems

Products:
  • cri-o
Versions: cri-o versions before 1.25.3, 1.26.0-rc.4, and 1.24.6
Operating Systems: Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Affects systems using cri-o as container runtime, particularly in Kubernetes environments. Requires ability to create or modify containers with crafted environment variables.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full container escape leading to host compromise, privilege escalation to root, and potential lateral movement across the Kubernetes cluster.

🟠

Likely Case

Privilege escalation within containers, unauthorized access to sensitive container data, and potential manipulation of container user accounts.

🟢

If Mitigated

Limited impact with proper container isolation, minimal container privileges, and restricted environment variable usage.

🌐 Internet-Facing: MEDIUM - Exploitation requires access to container runtime, typically not directly internet-facing but could be exposed through orchestration APIs.
🏢 Internal Only: HIGH - Container runtimes are commonly deployed internally, and successful exploitation could lead to significant internal compromise.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires ability to create containers with malicious environment variables. Public proof-of-concept demonstrates the injection technique.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: cri-o 1.25.3, 1.26.0-rc.4, or 1.24.6

Vendor Advisory: https://access.redhat.com/security/cve/CVE-2022-4318

Restart Required: Yes

Instructions:

1. Update cri-o to version 1.25.3, 1.26.0-rc.4, or 1.24.6. 2. Restart cri-o service. 3. Restart affected containers. 4. Verify no containers are using vulnerable versions.

🔧 Temporary Workarounds

Restrict Environment Variable Usage

linux

Limit environment variables that can be passed to containers and validate them before container creation.

# Configure Kubernetes admission controllers to restrict env vars
# Use Pod Security Standards to limit container capabilities

Implement Container Security Context

linux

Apply security contexts that restrict container privileges and prevent privilege escalation.

# Apply Kubernetes security context:
apiVersion: v1
kind: Pod
metadata:
  name: secure-pod
spec:
  securityContext:
    runAsNonRoot: true
    runAsUser: 1000
  containers:
  - name: app
    securityContext:
      allowPrivilegeEscalation: false
      readOnlyRootFilesystem: true

🧯 If You Can't Patch

  • Implement strict network policies to isolate cri-o runtime from untrusted networks
  • Deploy runtime security monitoring to detect /etc/passwd modification attempts

🔍 How to Verify

Check if Vulnerable:

Check cri-o version with: crio --version | grep -E '1\.(24\.([0-5]|5\.[0-5])|25\.([0-2]|2\.[0-2])|26\.0-rc\.[0-3])'

Check Version:

crio --version

Verify Fix Applied:

Verify cri-o version is 1.25.3, 1.26.0-rc.4, or 1.24.6 with: crio --version

📡 Detection & Monitoring

Log Indicators:

  • Unexpected modifications to /etc/passwd in container logs
  • Suspicious environment variable names or values in container creation logs
  • Failed authentication attempts using newly created users

Network Indicators:

  • Unusual container-to-container communication patterns
  • Unexpected outbound connections from cri-o runtime

SIEM Query:

source="container_logs" AND ("passwd modification" OR "useradd" OR "usermod")

🔗 References

📤 Share & Export