CVE-2022-4886

8.8 HIGH

📋 TL;DR

This vulnerability allows attackers to bypass path sanitization in ingress-nginx by using the log_format directive, potentially enabling path traversal attacks. It affects Kubernetes ingress-nginx deployments where custom log formats are configured. Attackers could access restricted files or directories.

💻 Affected Systems

Products:
  • ingress-nginx
Versions: All versions before 1.8.2
Operating Systems: Linux
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when custom log_format directives are configured in ingress-nginx.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full path traversal allowing access to sensitive system files, configuration files, or source code from the nginx container.

🟠

Likely Case

Limited path traversal within the container filesystem, potentially exposing application configuration or secrets.

🟢

If Mitigated

No impact if proper network segmentation and container security controls prevent lateral movement.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending specially crafted HTTP requests to bypass path sanitization.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.8.2

Vendor Advisory: https://groups.google.com/g/kubernetes-security-announce/c/ge7u3qCwZLI

Restart Required: Yes

Instructions:

1. Update ingress-nginx to version 1.8.2 or later. 2. Update the ingress-nginx controller deployment. 3. Verify the new version is running.

🔧 Temporary Workarounds

Remove custom log_format directives

linux

Remove any custom log_format configurations from ingress-nginx to eliminate the vulnerability vector.

kubectl edit configmap ingress-nginx-controller
Remove log_format entries from nginx-configuration

🧯 If You Can't Patch

  • Implement network segmentation to restrict ingress-nginx access to trusted sources only.
  • Deploy WAF rules to detect and block path traversal attempts in HTTP requests.

🔍 How to Verify

Check if Vulnerable:

Check if ingress-nginx version is below 1.8.2 and has custom log_format configurations.

Check Version:

kubectl describe pod -n ingress-nginx | grep Image

Verify Fix Applied:

Verify ingress-nginx version is 1.8.2 or higher and test path traversal attempts are blocked.

📡 Detection & Monitoring

Log Indicators:

  • Unusual path patterns in nginx access logs
  • Failed path traversal attempts in error logs

Network Indicators:

  • HTTP requests with encoded path traversal sequences
  • Multiple 403/404 responses for unusual paths

SIEM Query:

source="nginx" AND (uri="*..%2f*" OR uri="*%2e%2e%2f*")

🔗 References

📤 Share & Export