Skip to content

Fix token type hint injection vulnerability in TokenIntrospectionEndpoint - #46752

Merged
ahus1 merged 2 commits into
keycloak:mainfrom
RepoRonin:fix-token-introspection-injection
Mar 3, 2026
Merged

Fix token type hint injection vulnerability in TokenIntrospectionEndpoint#46752
ahus1 merged 2 commits into
keycloak:mainfrom
RepoRonin:fix-token-introspection-injection

Conversation

@RepoRonin

Copy link
Copy Markdown
Contributor

Description

This PR addresses a security vulnerability in the TokenIntrospectionEndpoint where unsanitized user input from the token_type_hint parameter was being reflected directly into error responses.

Changes Made

  • Changed error message to static string to prevent reflection of user input
  • Added event.detail(Details.TOKEN_TYPE, tokenTypeHint) for server-side auditing
  • Added event.error(Errors.INVALID_REQUEST) before throwing exception
  • Prevents potential log injection and issues in downstream systems

Before

{
  "error": "invalid_request",
  "error_description": "Unsupported token type [ATTACKER_INPUT]."
}

After

{
  "error": "invalid_request",
  "error_description": "Unsupported token type."
}

The token_type_hint value is now properly logged in the server's audit logs via event.detail() for debugging purposes, without exposing it in the client-facing error response.

Security Impact
This fix prevents:

Log injection attacks through malicious token_type_hint values
Potential issues in downstream systems that render the error_description
Information leakage through error message reflection
Closes #46689

Signed-off-by: Shashank Goel goelshashank13@gmail.com

…oint

- Changed error message to static string to prevent reflection of user input
- Added event.detail(Details.TOKEN_TYPE, tokenTypeHint) for server-side auditing
- Added event.error(Errors.INVALID_REQUEST) before throwing exception
- Prevents potential log injection and issues in downstream systems

Signed-off-by: Shashank Goel <goelshashank13@gmail.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
@ahus1 ahus1 self-assigned this Mar 3, 2026
@ahus1
ahus1 enabled auto-merge (squash) March 3, 2026 09:08
@ahus1
ahus1 merged commit 770c4ab into keycloak:main Mar 3, 2026
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove user input reflection in Token Introspection error responses

2 participants