The vulnerability is caused by the improper validation of the subject_token parameter in the TokenEndpoint. When an authenticated user with low privileges sends an oversized subject_token, the token is silently dropped, and the system falls back to using the client's credentials. This allows the user to gain the permissions of the client's service account, leading to a privilege escalation.
The patch addresses this vulnerability by introducing a new mechanism to handle "token" parameters. The TokenEndpoint.checkParameters method is modified to differentiate between regular parameters and "token" parameters. It now uses a larger size limit for token parameters and fails the request if the limit is exceeded, instead of silently ignoring the parameter. This prevents the fallback to client credentials and mitigates the privilege escalation vulnerability.
The key changes are in the TokenEndpoint.java file, where the checkParameters method is modified to handle token parameters differently. The OIDCProviderConfig.java file is also modified to introduce new configuration properties for token parameters. Finally, the OAuth2GrantType.java interface and its implementations are modified to identify which parameters are token parameters.