CVE-2021-20218

7.4 HIGH

📋 TL;DR

This vulnerability in fabric8 kubernetes-client allows malicious pods/containers to exploit the copy command to extract files outside the intended working directory path. Applications using the vulnerable kubernetes-client library for file operations in Kubernetes environments are affected. The primary risks are file integrity compromise and potential system availability impacts.

💻 Affected Systems

Products:
  • fabric8 kubernetes-client
Versions: 4.2.0 through 4.13.1, 5.0.0 through 5.0.1
Operating Systems: All operating systems running Kubernetes with vulnerable kubernetes-client
Default Config Vulnerable: ⚠️ Yes
Notes: Only applications using the kubernetes-client copy command functionality are vulnerable. The vulnerability requires attacker to have pod/container execution privileges.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Malicious container could extract sensitive system files, configuration data, or secrets from the host or other containers, leading to complete cluster compromise and data exfiltration.

🟠

Likely Case

Attackers with pod execution privileges could read files from other containers or the host filesystem, potentially accessing sensitive application data or credentials.

🟢

If Mitigated

With proper pod security policies, network segmentation, and least privilege principles, impact would be limited to the compromised container's namespace.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: HIGH

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires pod/container execution access. The vulnerability is a path traversal issue in the copy command implementation.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: kubernetes-client-4.13.2, kubernetes-client-5.0.2, kubernetes-client-4.11.2, kubernetes-client-4.7.2

Vendor Advisory: https://bugzilla.redhat.com/show_bug.cgi?id=1923405

Restart Required: Yes

Instructions:

1. Identify applications using fabric8 kubernetes-client. 2. Update dependency to patched version (4.13.2, 5.0.2, 4.11.2, or 4.7.2). 3. Rebuild and redeploy applications. 4. Restart affected services.

🔧 Temporary Workarounds

Restrict pod security context

all

Implement pod security policies to restrict container capabilities and filesystem access

kubectl apply -f pod-security-policy.yaml

Disable copy command usage

all

Avoid using kubernetes-client copy command functionality in vulnerable applications

🧯 If You Can't Patch

  • Implement strict pod security policies with readOnlyRootFilesystem: true and minimal capabilities
  • Use network policies to isolate vulnerable pods and implement egress filtering

🔍 How to Verify

Check if Vulnerable:

Check application dependencies for fabric8 kubernetes-client versions 4.2.0-4.13.1 or 5.0.0-5.0.1

Check Version:

mvn dependency:tree | grep kubernetes-client OR check pom.xml/gradle.build files

Verify Fix Applied:

Verify kubernetes-client version is 4.13.2, 5.0.2, 4.11.2, or 4.7.2 in application dependencies

📡 Detection & Monitoring

Log Indicators:

  • Unusual file access patterns from containers
  • Copy operations attempting paths with '../' sequences
  • Container accessing files outside expected directories

Network Indicators:

  • Unexpected outbound data transfers from containers to external systems

SIEM Query:

container_logs | where operation contains 'copy' and path contains '../'

🔗 References

📤 Share & Export