The vulnerability, identified as CVE-2026-1580, stems from improper input validation in the ingress-nginx controller, which allows for the injection of arbitrary configuration into the nginx server. This can lead to remote code execution or information disclosure.
The analysis of the patches between the vulnerable version 1.13.6 and the fixed version 1.13.7 revealed two primary points of vulnerability:
-
auth-method Annotation Injection: The core of the reported vulnerability lies in the parsing of the nginx.ingress.kubernetes.io/auth-method annotation. The regular expression used for validation lacked start and end anchors (^ and $). This oversight allowed an attacker to append arbitrary nginx configuration directives to a valid HTTP method (e.g., GET, <injected_config>), which would then be written to the nginx configuration file. The fix, found in commit a91d165fcc9309f5739c5dc42c8a7497381ce111, was to add these anchors to the regex to ensure the entire string matches a valid HTTP method.
-
location and server_name Directive Injection: A broader configuration injection vulnerability was discovered and fixed in commit c423b85bee1ed47af95d27a7ddb7cfe3c73c1070. The buildLocation function in internal/ingress/controller/template/template.go and the nginx.tmpl template did not properly sanitize or quote values used in location and server_name directives. This allowed an attacker to craft malicious Ingress paths, hostnames, or aliases containing special characters (", \) to inject arbitrary nginx configuration. The fix involved introducing a sanitizeQuotedRegex function to escape these characters and ensuring all relevant values are properly quoted in the final configuration.
In summary, the root cause is a failure to properly sanitize user-provided input from Ingress objects before incorporating it into the nginx configuration. This allowed attackers to inject malicious directives, compromising the security of the ingress controller and potentially the entire cluster.