Ingress-nginx `path` sanitization can be bypassed with newline character
Description
A security issue was discovered in ingress-nginx where a user that can create or update ingress objects can use a newline character to bypass the sanitization of the spec.rules[].http.paths[].path field of an Ingress object (in the networking.k8s.io or extensions API group) to obtain the credentials of the ingress-nginx controller. In the default configuration, that credential has access to all secrets in the cluster.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A user with ingress create/update permissions can inject a newline in the path field to bypass sanitization and steal the ingress-nginx controller's credentials, which can access all cluster secrets.
CVE-2021-25748 is a vulnerability in ingress-nginx where the sanitization of the spec.rules[].http.paths[].path field in Ingress objects can be bypassed using a newline character [1][4]. This insufficient input validation allows an attacker to inject malicious content that leads to the exposure of the ingress-nginx controller's credentials.
An attacker must have the ability to create or update Ingress objects in the cluster. The newline character bypasses the existing sanitization logic, enabling the injection of arbitrary content into the generated NGINX configuration [4]. This attack is particularly relevant in multitenant environments where non-admin users are granted permissions to manage Ingress resources.
Successful exploitation grants the attacker the credentials of the ingress-nginx controller. In the default configuration, this service account has access to all secrets in the cluster, potentially leading to full cluster compromise [1][4].
The vulnerability is fixed in ingress-nginx version 1.2.1 [4]. Users unable to upgrade immediately can mitigate the issue by implementing an admission policy that restricts the path field to a set of known safe characters, as suggested in the security advisory [4]. The fix was implemented in pull request #8623 [2].
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
k8s.io/ingress-nginxGo | < 1.2.1 | 1.2.1 |
Affected products
17- osv-coords16 versionspkg:apk/chainguard/ingress-nginx-controllerpkg:apk/chainguard/ingress-nginx-controller-1.9pkg:apk/chainguard/ingress-nginx-controller-compatpkg:apk/chainguard/ingress-nginx-controller-compat-1.9pkg:apk/chainguard/ingress-nginx-controller-compat-fips-1.9pkg:apk/chainguard/ingress-nginx-controller-fipspkg:apk/chainguard/ingress-nginx-controller-fips-1.9pkg:apk/chainguard/ingress-nginx-controller-fips-compatpkg:apk/chainguard/kube-webhook-certgenpkg:apk/chainguard/kube-webhook-certgen-1.9pkg:apk/chainguard/kube-webhook-certgen-fipspkg:apk/chainguard/kube-webhook-certgen-fips-1.9pkg:apk/wolfi/ingress-nginx-controllerpkg:apk/wolfi/ingress-nginx-controller-compatpkg:apk/wolfi/kube-webhook-certgenpkg:golang/k8s.io/ingress-nginx
< 0+ 15 more
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 1.2.1
- Kubernetes/Kubernetes ingress-nginxv5Range: unspecified
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
6- github.com/advisories/GHSA-863x-868h-968xghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2021-25748ghsaADVISORY
- github.com/kubernetes/ingress-nginx/issues/8686ghsaWEB
- github.com/kubernetes/ingress-nginx/pull/8623ghsaWEB
- github.com/kubernetes/ingress-nginx/releases/tag/controller-v1.2.1ghsaWEB
- groups.google.com/g/kubernetes-security-announce/c/avaRYa9c7I8ghsaWEB
News mentions
0No linked articles in our index yet.