SSRF via Unvalidated sector_identifier_uri in Dynamic Client Registration
Description
RegisterParamsValidator.validateRedirectUris() validates a client-supplied sector_identifier_uri by checking only that its URI scheme equals "https" -- there is no host/IP validation. The server then makes a direct outbound GET request to this attacker-supplied URL. Notably, even the scheme check does not gate the request: there is no continue/return after "valid = false" is set, so the outbound request fires regardless of scheme. An attacker able to reach the Dynamic Client Registration endpoint can direct the auth server to make requests to arbitrary internal hosts (cloud metadata endpoints, internal admin APIs, unauthenticated internal services).
Details
File: jans-auth-server/server/src/main/java/io/jans/as/server/model/registration/RegisterParamsValidator.java
In validateRedirectUris(), the sector_identifier_uri validation block:
if (valid && StringUtils.isNotBlank(sectorIdentifierUrl)) { try { URI uri = new URI(sectorIdentifierUrl); if (!HTTPS.equalsIgnoreCase(uri.getScheme())) { valid = false; }
jakarta.ws.rs.client.Client clientRequest = ClientBuilder.newClient(); String entity = null; try { Response clientResponse = clientRequest.target(sectorIdentifierUrl).request().buildGet().invoke(); ...
Two issues:
- No host/IP validation of any kind -- any hostname or IP address is accepted.
- The scheme check sets valid=false but has no continue/return, so clientRequest.target(sectorIdentifierUrl)...invoke() executes unconditionally, even for non-https schemes.
For comparison, jwks_uri and other client-supplied external URLs used elsewhere in DCR/software-statement validation are fetched via UriService.loadJson() (io.jans.as.server.service.net.UriService), which enforces a configurable allowlist (externalUriWhiteList) through UriService.canCall() before making any request:
public JSONObject loadJson(String uri) { if (!canCall(uri)) { return null; } return JwtUtil.getJSONWebKeys(uri); }
sector_identifier_uri is the only external-URL fetch in RegisterParamsValidator that bypasses this shared protection, using a separate raw JAX-RS client instead. This strongly suggests a missed protection rather than an intentional design choice, given the existing, consistently-applied pattern elsewhere in the same class of operations.
PoC
Environment: JDK 17+, Maven, git, bash
A self-contained script is available that:
- Clones jans and builds the internal dependency chain in order (jans-bom, jans-orm, jans-core, agama, jans-auth-server modules) since jans-auth-server depends on internal artifacts not on Maven Central.
- Extracts the real runtime classpath for jans-auth-server/server.
- Instantiates the real, unmodified RegisterParamsValidator with its two lightweight dependencies (AppConfiguration, ErrorResponseFactory) injected via reflection (to avoid bootstrapping the full CDI container), and calls validateRedirectUris() with a sector_identifier_uri pointing at a local mock HTTP server.
Observed result: the mock server receives a real GET request from the auth server code, confirming the outbound SSRF request fires. Reproduced consistently (3/3 runs).
I'm happy to share the full PoC script and source directly through this advisory.
Impact
Server-Side Request Forgery (CWE-918). Any actor able to reach the Dynamic Client Registration endpoint (/register) can cause the jans auth server to make outbound HTTP requests to arbitrary hosts, including internal-only services and cloud metadata endpoints (e.g. 169.254.169.254), potentially exposing internal network topology, credentials, or triggering unintended side effects on internal services that trust requests originating from the auth server.
Severity depends on whether /register requires an initial access token in your default configuration -- I was not able to fully confirm this from static analysis alone and would appreciate your assessment. If authentication is required, this is a lower-privilege SSRF (still exploitable by any registered/authenticated client). If open registration is permitted, this is unauthenticated SSRF.