The vulnerability arises from the MinIO Operator not correctly specifying and verifying the 'audience' for Kubernetes Service Account tokens used in its STS AssumeRoleWithWebIdentity flow.
- The
ValidateServiceAccountJWT function in pkg/controller/sts.go was responsible for preparing the TokenReview request. Prior to the patch (d586294), it did not set the spec.audiences field. This caused the Kubernetes API server to default the audience, typically to its own, which is not specific enough for the MinIO STS use case.
- The
AssumeRoleWithWebIdentityHandler function in pkg/controller/sts_handlers.go, which processes the AssumeRoleWithWebIdentity request and uses the result of ValidateServiceAccountJWT, did not check the status.audiences field in the TokenReview response to ensure the token was intended for sts.min.io.
The patch d586294 addresses both issues: ValidateServiceAccountJWT was modified to include sts.min.io in spec.audiences of the TokenReview request, and AssumeRoleWithWebIdentityHandler was modified to explicitly check for sts.min.io in the status.audiences of the TokenReview response. Both functions were integral to the vulnerable process: one for not requesting the correct audience scope, and the other for not verifying the audience of the validated token.