VYPR
Moderate severityNVD Advisory· Published May 24, 2023· Updated Jan 16, 2025

Ingress-nginx `path` sanitization can be bypassed with newline character

CVE-2021-25748

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.

PackageAffected versionsPatched versions
k8s.io/ingress-nginxGo
< 1.2.11.2.1

Affected products

17

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

6

News mentions

0

No linked articles in our index yet.