The vulnerability lies in the generated NGINX configuration, not in a specific Go function that has a memory corruption or similar flaw. The Go code in the ingress-nginx controller is responsible for generating this configuration based on a Go template file (nginx.tmpl). The vulnerability was that for authentication subrequests (auth-url), the template did not include proxy_intercept_errors off;. This meant that if the authentication backend returned an error (like 401 Unauthorized), NGINX would intercept it and try to serve a custom error page. If a misconfigured custom error backend then returned a 200 OK response, the authentication check would be bypassed.
The patch for this vulnerability was to add proxy_intercept_errors off; to the relevant section of the nginx.tmpl file, as seen in commit 9685608059fff03918e05356f02ebc4e20c50917. This ensures that errors from the authentication backend are not intercepted by the custom error page mechanism and are handled correctly by the ingress-nginx logic.
From a runtime profiling perspective of the controller, the functions responsible for generating the configuration would be active when an Ingress is created or updated. The function NGINXController.OnUpdate is the high-level function that starts this process. It calls other functions, eventually leading to NGINXController.syncNginxConfig, which directly executes the template. Therefore, both of these functions are relevant as they are part of the chain that produces the vulnerable configuration.