CVE-2025-1098

8.8 HIGH

📋 TL;DR

This vulnerability in ingress-nginx allows attackers to inject arbitrary nginx configuration via the 'mirror-target' and 'mirror-host' annotations, potentially leading to remote code execution and disclosure of Kubernetes Secrets. It affects all Kubernetes clusters using ingress-nginx with these annotations enabled. The controller's default permissions allow access to all cluster-wide Secrets.

💻 Affected Systems

Products:
  • kubernetes/ingress-nginx
Versions: All versions prior to the fix
Operating Systems: All platforms running Kubernetes
Default Config Vulnerable: ⚠️ Yes
Notes: Requires ability to create or modify Ingress resources with the vulnerable annotations. Default controller permissions allow access to all Secrets.

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full cluster compromise via arbitrary code execution as ingress-nginx controller, leading to data exfiltration, lateral movement, and complete control over affected Kubernetes workloads.

🟠

Likely Case

Privilege escalation to controller service account, enabling access to sensitive Secrets and potential deployment of malicious workloads.

🟢

If Mitigated

Limited impact if proper network policies, RBAC restrictions, and annotation validation are in place, potentially preventing successful exploitation.

🌐 Internet-Facing: HIGH
🏢 Internal Only: HIGH

🎯 Exploit Status

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

Exploitation requires permissions to create/modify Ingress resources. Public exploit code is available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Check latest ingress-nginx releases for specific version

Vendor Advisory: https://github.com/kubernetes/ingress-nginx/security/advisories

Restart Required: Yes

Instructions:

1. Update ingress-nginx controller to latest patched version. 2. Delete and recreate controller pods to ensure new version is active. 3. Verify annotations are properly validated.

🔧 Temporary Workarounds

Restrict Ingress creation permissions

all

Limit who can create/modify Ingress resources using Kubernetes RBAC

kubectl create clusterrole ingress-restricted --verb=get,list,watch --resource=ingresses
kubectl create clusterrolebinding restricted-ingress-binding --clusterrole=ingress-restricted --user=restricted-user

Disable mirror annotations via admission controller

all

Use OPA/Gatekeeper or Kyverno to block Ingress resources containing mirror-target or mirror-host annotations

Example Gatekeeper constraint: apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sRequiredAnnotations
metadata:
  name: block-mirror-annotations
spec:
  match:
    kinds:
      - apiGroups: ["networking.k8s.io"]
        kinds: ["Ingress"]
  parameters:
    annotations:
      - key: nginx.ingress.kubernetes.io/mirror-target
        allowedRegex: "^$"
      - key: nginx.ingress.kubernetes.io/mirror-host
        allowedRegex: "^$"

🧯 If You Can't Patch

  • Implement strict RBAC controls to limit who can create/modify Ingress resources
  • Deploy admission controllers (OPA/Gatekeeper, Kyverno) to validate and reject Ingress resources with mirror annotations

🔍 How to Verify

Check if Vulnerable:

Check if ingress-nginx controller version is vulnerable by examining controller pod version and verifying if mirror annotations are accepted without validation

Check Version:

kubectl get pods -n ingress-nginx -l app.kubernetes.io/component=controller -o jsonpath='{.items[*].spec.containers[*].image}'

Verify Fix Applied:

Attempt to create an Ingress with malicious mirror annotations - should be rejected or properly sanitized

📡 Detection & Monitoring

Log Indicators:

  • Unusual nginx configuration changes
  • Ingress resources with mirror-target or mirror-host annotations containing suspicious values
  • Controller pod executing unexpected commands

Network Indicators:

  • Unexpected outbound connections from ingress-nginx controller
  • Traffic mirroring to unauthorized destinations

SIEM Query:

source="kubernetes" AND ("mirror-target" OR "mirror-host") AND annotation_value=~"(?i).*(exec|curl|wget|bash|sh).*"

🔗 References

📤 Share & Export