Enhance JWT authorization by validating issuer before fetching public keys#24
Open
adamweeks wants to merge 1 commit into
Open
Enhance JWT authorization by validating issuer before fetching public keys#24adamweeks wants to merge 1 commit into
adamweeks wants to merge 1 commit into
Conversation
… keys to prevent SSRF attacks. Remove hardcoded identity broker URL and improve error handling for missing or invalid issuer claims.
nagashree-angadi
approved these changes
Dec 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔒 Critical Security Fix: Prevent SSRF Attacks in JWT Validation
Summary
This PR fixes a critical SSRF (Server-Side Request Forgery) vulnerability in the JWT authorization handler that could allow attackers to make the server send HTTP requests to arbitrary URLs.
Problem
The
JWTAuthorizationHandler.validateToken()method was callingfetchPublicKeys()with an unvalidated issuer claim extracted from incoming JWT tokens. An attacker could craft a malicious JWT with any issuer URL and force the server to make HTTP requests to:https://evil-attacker.com/idb)http://192.168.1.1/idb,http://localhost:8080/idb)http://169.254.169.254/latest/meta-data)This could lead to:
Solution
Added issuer validation BEFORE any network requests are made:
issclaimLIST_VALID_ISSUERSbefore fetching keysAccessTokenExceptionimmediately for invalid issuersChanges Made
validateToken()method (lines 56-66)DEFAULT_IDENTITY_BROKER_URLconstantfetchPublicKeys()URL construction (issuer now guaranteed to be valid)Files Changed:
src/main/java/com/cisco/wccai/grpc/server/interceptors/JWTAuthorizationHandler.javaAttack Vectors Prevented
✅ External attacker domains
✅ Internal network scanning (localhost, private IPs)
✅ Cloud metadata service access (AWS, GCP, Azure)
✅ Domain hijacking attempts (
idbrokerbts.webex.com.evil.com)✅ URL parsing bypasses (
webex.com@evil.com)✅ Protocol downgrade attacks (HTTP instead of HTTPS)
Backward Compatibility
✅ 100% backward compatible - All legitimate Webex JWT tokens continue to work
✅ Only rejects tokens with invalid issuers (which should never occur in legitimate traffic)
Valid Issuers (Unchanged)
The following Webex issuers remain valid:
https://idbrokerbts.webex.com/idbhttps://idbrokerbts-eu.webex.com/idbhttps://idbroker.webex.com/idbhttps://idbroker-eu.webex.com/idbhttps://idbroker-b-us.webex.com/idbhttps://idbroker-ca.webex.com/idbReferences
Deployment Notes
Severity: 🔴 Critical
Type: Security Fix
Breaking Changes: None