AI pentesting guides / By tech stack

Stack guide: Kubernetes

Kubernetes ingress security testing

Kubernetes ingress testing checks what the cluster exposes at its edge: which hosts and paths the ingress controller routes to which services, whether any internal service is reachable that should not be, and whether authentication applied at the ingress can be sidestepped.

The ingress layer concentrates risk. A single misplaced rule can publish an admin dashboard, and the controller itself is a privileged component with access to cluster secrets.

Routing and exposure mistakes

  • Internal tools (dashboards, metrics, Argo CD, Grafana, Prometheus) given ingress rules for convenience.
  • Wildcard host rules or a default backend that answers for unexpected Host headers.
  • Path rules with prefix matching that expose more than intended, or that normalise paths differently from the backend.
  • Services of type LoadBalancer or NodePort that bypass the ingress and its authentication entirely.

Auth at the edge

Authentication added through ingress annotations, such as external auth or basic auth, protects only traffic that passes through that ingress. Backends must not trust identity headers the ingress sets unless they can be sure clients cannot send them directly. Testers try the same path with injected identity headers, alternative hostnames and direct service addresses.

The controller itself

  • IngressNightmare (CVE-2025-1974 and related CVEs, March 2025, CVSS 9.8) allowed code execution in ingress-nginx via its admission webhook, reachable from the pod network, exposing secrets across namespaces. Fixed in v1.12.1 and v1.11.5.
  • Kubernetes announced in November 2025 that ingress-nginx would be retired, with best-effort maintenance ending in March 2026 and no further security fixes after that. Clusters still running it should plan migration, for example to Gateway API implementations.
  • Snippet annotations that inject raw NGINX configuration let anyone who can create an Ingress change controller behaviour.

TLS and certificate exposure

Certificate transparency logs reveal every hostname that received a public certificate, including staging and internal names that were never meant to be advertised. Wildcard certificates hide individual names but make it harder to tell which hosts are live. Testers enumerate these names, check that each one serves the intended application, and look for expired or mismatched certificates that indicate forgotten ingress rules.

With Pentest-Swarm

Testing ingress with Pentest-Swarm

From outside the cluster, Pentest-Swarm tests what the ingress exposes over HTTP; with authorised internal access, its arsenal and playbooks extend further.

  • Run the external-asm playbook against your domains to enumerate hostnames and find exposed services behind the ingress.
  • Use --scope with your domains and --exclude for shared infrastructure, so testing stays strictly inside the assets you name.
  • kube_hunter is part of the tool arsenal, and the internal-network playbook covers authorised internal ranges.
  • Run web and API playbooks against each exposed application behind the ingress.

Where it falls short

External testing cannot see RBAC, network policies or who can create Ingress objects, which is where several controller attacks start. Use cluster configuration scanners and admission policies alongside it, and review ingress manifests in code review.

Questions

Was IngressNightmare exploitable from the internet?

The admission webhook was reachable from the pod network, not normally the internet, but any foothold in the cluster could use it to take over the controller.

Is ingress-nginx still safe to run?

Existing deployments keep working, but after the March 2026 retirement there are no new security fixes. Plan migration to a maintained controller or Gateway API implementation.

How do I find internal services exposed by mistake?

Enumerate hostnames from DNS and certificates, request each with varied Host headers, and compare responses. Attack surface tooling automates this.

Sources

  1. Kubernetes blog: Ingress-nginx CVE-2025-1974
  2. Kubernetes blog: Ingress NGINX retirement