The vulnerability lies in the authentication logic of the Kargo API server. Specifically, the authInterceptor.authenticate function, which is used as a gRPC interceptor to authenticate incoming requests, had a flaw in its token validation process.
Before the patch, the authenticate function had a fallback mechanism. If a provided Authorization header contained a Bearer token that was not a valid JWT, the function would assume it was an opaque token intended for the Kubernetes API server and would pass it through without validation. This is evident from the removed code in the patch.
This behavior was also present for JWTs with an unrecognized issuer.
The GetConfig and RefreshResource API endpoints do not rely on the Kubernetes API server for their operations and thus do not have a subsequent authentication check. As a result, any request to these endpoints with a non-empty Bearer token in the Authorization header was incorrectly treated as authenticated, leading to an authentication bypass.
The patch fixes this vulnerability by removing the permissive fallback logic. Now, if a token is not a valid JWT or is a JWT that cannot be verified by Kargo or the underlying Kubernetes cluster, the authenticate function returns an "invalid token" error, effectively denying access.
Therefore, the authInterceptor.authenticate function is the root of the vulnerability. During exploitation, a profiler would show this function in the call stack for a request to the GetConfig or RefreshResource endpoints.