/

CVE-2025-15566

Severity:

HIGH RISK

(8.8)

Improper Input Validation in ingress-nginx

CVE-2025-15566

Awaiting Analysis

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20

Impact:

Remote Code Execution and Sensitive Data Exposure

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An improper input validation flaw in ingress-nginx allows the nginx.ingress.kubernetes.io/auth-proxy-set-headers annotation to inject raw configuration into the underlying nginx instance.

Under certain configurations, this can be abused to achieve arbitrary code execution in the context of the ingress-nginx controller and to exfiltrate Kubernetes Secrets that the controller can access, which by default may include all cluster-wide Secrets.

Affected context

This vulnerability affects Kubernetes clusters using ingress-nginx where:

  • The controller honors the nginx.ingress.kubernetes.io/auth-proxy-set-headers annotation, and
  • Ingress resources can be created or modified by users or workloads that are not fully trusted, and
  • The controller runs with access to a broad set of Kubernetes Secrets (often cluster-wide in default deployments).

The issue appears when ingress annotations are treated as safe configuration fragments, allowing user-controlled input to influence nginx configuration more broadly than intended.

Exploit preconditions

  • Attack surface: Kubernetes API via Ingress objects managed by ingress-nginx.
  • Required access: Ability to create or update Ingress resources with the nginx.ingress.kubernetes.io/auth-proxy-set-headers annotation in the affected cluster/namespace.
  • Trigger point: Application of a crafted Ingress resource causing ingress-nginx to reload and apply the injected configuration to nginx.
  • Why exploitation is possible: The controller does not sufficiently validate or constrain the contents of the auth-proxy-set-headers annotation, allowing attacker-controlled values to flow into nginx configuration, which can be leveraged to run commands or facilitate data exfiltration.

Why this happens

The root cause is improper validation and trust of user-controlled configuration delivered through Kubernetes annotations.

ingress-nginx interprets the nginx.ingress.kubernetes.io/auth-proxy-set-headers annotation as a source of additional headers and effectively merges its contents into the nginx configuration. Without strict parsing, sanitization, or structural validation, this flexible mechanism allows an attacker to smuggle arbitrary nginx directives or configuration fragments into the server configuration. This aligns with CWE-20: Improper Input Validation, where external input is accepted without sufficient checks, enabling unintended behavior and configuration injection.

Potential impact

  • Arbitrary code execution in the security context of the ingress-nginx controller pod.
  • Disclosure of Kubernetes Secrets accessible to the controller, potentially including cluster-wide Secrets in default setups.
  • Unauthorized access to sensitive application data routed through the ingress.
  • Pivoting within the cluster by using the compromised controller to access other services or resources.
  • Service disruption or traffic hijacking by manipulating nginx behavior (e.g., routing, TLS termination, logging).

General mitigation guidance

Effective mitigation emphasizes reducing trust in Ingress annotations and constraining what configuration user workloads can influence:

  • Limit which users or service accounts can create or modify Ingress resources, especially annotations that impact nginx behavior.
  • Constrain or disable powerful, free-form configuration annotations when not strictly required, preferring safer, higher-level configuration options.
  • Apply strict validation to annotation values, rejecting inputs that do not conform to expected formats or that contain suspicious directives.
  • Run ingress-nginx with least privilege, limiting its access to Secrets and other cluster resources to only what is operationally necessary.
  • Segment ingress controllers by trust level (e.g., separate controllers for trusted platform components vs. multi-tenant workloads) to contain blast radius.
  • Consider policy enforcement using admission controls to block risky combinations of annotations.

How teams detect issues like this

Detection can focus on both configuration review and behavioral monitoring:

  • Use static configuration scanning to flag Ingress resources using nginx.ingress.kubernetes.io/auth-proxy-set-headers and other powerful annotations, especially where values appear non-standard or complex.
  • Implement Kubernetes admission policies (e.g., with OPA/Gatekeeper, Kyverno) that deny or require approval for high-risk annotations or suspicious patterns in their values.
  • Review RBAC policies to identify broad permissions to create or modify Ingress resources, tightening where feasible.
  • Monitor ingress-nginx controller logs and nginx error logs for unexpected configuration reloads, directives, or command execution behavior.
  • Employ runtime security monitoring tools to detect anomalous processes, network connections, or file access originating from the ingress-nginx controller pod.

Sources

SourceLink
github.comgithub.com/kubernetes/kubernetes/issues/136789

Frequently asked

questions

Indirectly. An attacker typically must have the ability to interact with the Kubernetes API to create or modify Ingress resources. In managed or multi-tenant environments where external users can define Ingress objects, this can effectively become remotely exploitable.

The attacker needs permissions to create or update Ingress objects that are processed by the vulnerable ingress-nginx controller, including the ability to set the nginx.ingress.kubernetes.io/auth-proxy-set-headers annotation.

Restrict and validate user-controlled configuration inputs. Specifically, constrain or disable powerful annotations that inject configuration, validate annotation values against strict schemas, and reduce the privileges of ingress-nginx so that a compromise has limited blast radius.

Treat annotations and other dynamic configuration sources as untrusted input: enforce robust input validation, apply least-privilege principles to controllers, separate control planes for different trust levels, and use admission policies and automated reviews to catch unsafe configuration patterns before they reach production.

Find out what's already
exploitable in your codebase.