I spent some time diving into the details of the recent NGINX (ingress-nginx) exploit publication — #IngressNightmare — and here’s a simplified breakdown I put together:
TL;DR:
This attack targets NGINX by tricking it into executing a malicious configuration that leverages dangerous directives (like ssl_engine) to take over the Kubernetes Pod and escalate privileges.
First things first, the attacker needs to be inside the Kubernetes perimeter and able to communicate with the ingress-nginx-controller Pod. This is more common than you’d think — many clusters are deployed without any network segmentation policies in place.
From there, the attack unfolds in two phases:
1. Upload a malicious module to the file system of the ingress-nginx-controller Pod.
2. Send a configuration to ingress-nginx that uses the ssl_engine directive to load that malicious module.
The brilliance of this attack lies in the details. Let me walk you through how it works:
In the first step, the attacker exploits a feature called Client Body Buffers. When an HTTP request exceeds 8KB, NGINX starts writing the body to disk instead of keeping it in memory. To ensure the malicious module is properly staged for the next step, the attacker sets a Content-Length header that leaves the server “waiting” for more data.
Then comes phase two: the attacker floods the ingress-nginx-controller with requests containing an AdmissionReview that includes a config using ssl_engine, pointing to the malicious module injected earlier (e.g., /proc/$PID/fd/$FD). Since the attacker doesn’t know the exact process ID or file descriptor, they brute-force it. But because containerized environments typically have very few processes, this brute-force step is trivial.
Once the attacker guesses the correct combination, NGINX loads the malicious module — and just like that, command execution is achieved.
From that point on, the attacker can use the container’s service account token to read secrets, access config files, move laterally, and ultimately take control of the entire cluster.
https://www.wiz.io/blog/ingress-nginx-kubernetes-vulnerabilities