# GHSA-R4CV-3M8P-43J8: SSRF protection bypass via IPv6 transition addresses (NAT64 / 6to4 / Teredo) in sector\_identifier\_uri and client\_id URL validation

- Database: GitHub
- Severity: CVSS 8.6 (High)
- Published: 2026-07-30
- Modified: 2026-07-30

## Affected versions

- io.jans.jans-auth-server (Maven): fixed in 2.3.0

## Description

# SSRF protection bypass via IPv6 transition addresses (NAT64 / 6to4 / Teredo) in sector_identifier_uri and client_id URL validation

## Summary

The `isPrivateAddress` methods in both `SectorIdentifierUriService` and `ClientIdMetadataService` use Java's `InetAddress` methods (`isLoopbackAddress`, `isSiteLocalAddress`, `isLinkLocalAddress`, `isAnyLocalAddress`, `isMulticastAddress`) plus a manual ULA check (`fc00::/7`), but do not recognize IPv6 transition addresses (NAT64, 6to4, Teredo) that embed private IPv4 destinations. An attacker can register an OpenID Connect client with a `sector_identifier_uri` or `client_id` URL using a NAT64/6to4 address to make the auth server fetch from internal services.

## Affected component / versions

- Package: `JanssenProject/jans` (jans-auth-server)
- Affected versions: all versions including current HEAD (`ec4c0ba74bf0`)
- Vulnerable files:
  - [`jans-auth-server/server/src/main/java/io/jans/as/server/service/net/SectorIdentifierUriService.java` L95-106](https://github.com/JanssenProject/jans/blob/ec4c0ba74bf0/jans-auth-server/server/src/main/java/io/jans/as/server/service/net/SectorIdentifierUriService.java#L95-L106)
  - [`jans-auth-server/server/src/main/java/io/jans/as/server/service/ClientIdMetadataService.java` L359-364](https://github.com/JanssenProject/jans/blob/ec4c0ba74bf0/jans-auth-server/server/src/main/java/io/jans/as/server/service/ClientIdMetadataService.java#L359-L364)

## Details

### Root cause (CWE-918)

**SectorIdentifierUriService.java:95-106:**
```java
boolean isPrivateAddress(InetAddress address) {
    if (address.isLoopbackAddress()
            || address.isSiteLocalAddress()
            || address.isLinkLocalAddress()
            || address.isAnyLocalAddress()
            || address.isMulticastAddress()) {
        return true;
    }
    byte[] bytes = address.getAddress();
    return bytes.length == 16 && (bytes[0] & 0xFE) == 0xFC; // fc00::/7 ULA
}
```

**ClientIdMetadataService.java:359-364:**
```java
public boolean isPrivateAddress(InetAddress address) {
    return address.isLoopbackAddress() ||
            address.isSiteLocalAddress() ||
            address.isLinkLocalAddress() ||
            address.isAnyLocalAddress();
}
```

The `ClientIdMetadataService` version is even weaker -- no multicast check and no ULA check.

For `64:ff9b::a9fe:a9fe` (NAT64 encoding of 169.254.169.254):
- `isLoopbackAddress()` = false
- `isSiteLocalAddress()` = false (checks fec0::/10, not NAT64)
- `isLinkLocalAddress()` = false (checks fe80::/10)
- `isAnyLocalAddress()` = false
- `isMulticastAddress()` = false
- ULA: `(0x00 & 0xFE)` = 0x00 != 0xFC -> false
- Result: NOT private -> bypass

### Reachability / trust boundary

Both services validate URLs provided during OpenID Connect Dynamic Client Registration (RFC 7591):
- `sector_identifier_uri`: fetched by the auth server to retrieve the list of redirect URIs for pairwise subject identifiers
- `client_id` URL (OAuth 2.0 Client ID URL): fetched to retrieve client metadata

The project explicitly validates these URLs against private addresses to prevent SSRF (the methods are called `isPrivateAddress` / `isPrivateOrUnresolvableHost`). The `SectorIdentifierUriService` even resolves ALL DNS records (not just the first) and fails closed on resolution failure. This indicates a deliberate SSRF defense that the IPv6 transition addresses bypass.

### Attack chain

1. Attacker sends Dynamic Client Registration request with `sector_identifier_uri: "http://[64:ff9b::a9fe:a9fe]/latest/meta-data/iam/security-credentials/"`
2. `SectorIdentifierUriService.isPrivateOrUnresolvableHost` resolves the host
3. `isPrivateAddress` checks the resolved IPv6 address -- all checks fail
4. `fetchSectorIdentifierContent` makes HTTP GET to the NAT64 address
5. Response contains cloud metadata (IAM credentials if AWS)

## Impact

An attacker capable of OpenID Connect Dynamic Client Registration can bypass the SSRF protection to:

- Read cloud instance metadata including IAM credentials from the auth server's network
- Access internal services behind the auth server
- Probe internal network topology via DNS resolution + connection

The `sector_identifier_uri` is fetched with a 30-second read timeout, giving a large window for internal service interaction. The response content is parsed as JSON, so JSON-returning endpoints (like cloud metadata) will have their content processed.

Severity: HIGH (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N = 8.6 -- note: Dynamic Client Registration may be unauthenticated)

## Proof of concept (code-level verification)

Java trace:
```
InetAddress addr = InetAddress.getByName("64:ff9b::a9fe:a9fe");
// Inet6Address, bytes = [0x00,0x64,0xff,0x9b, 0,0,0,0, 0,0,0,0, 0xa9,0xfe,0xa9,0xfe]

addr.isLoopbackAddress()   -> false
addr.isSiteLocalAddress()  -> false (checks fec0::/10)
addr.isLinkLocalAddress()  -> false (checks fe80::/10)
addr.isAnyLocalAddress()   -> false
addr.isMulticastAddress()  -> false
// ULA: (0x00 & 0xFE) = 0x00 != 0xFC -> false
// isPrivateAddress returns false -> BYPASS
```

Negative control:
```
InetAddress addr = InetAddress.getByName("10.0.0.1");
addr.isSiteLocalAddress() -> true -> BLOCKED

InetAddress addr6 = InetAddress.getByName("fc00::1");
// ULA: (0xFC & 0xFE) = 0xFC -> true -> BLOCKED
```

## Remediation / fix

Add NAT64/6to4/Teredo extraction and re-check:

```java
boolean isPrivateAddress(InetAddress address) {
    if (address.isLoopbackAddress() || address.isSiteLocalAddress()
        || address.isLinkLocalAddress() || address.isAnyLocalAddress()
        || address.isMulticastAddress()) {
        return true;
    }
    byte[] bytes = address.getAddress();
    if (bytes.length == 16) {
        if ((bytes[0] & 0xFE) == 0xFC) return true; // ULA
        // Extract embedded IPv4 from transition addresses
        try {
            InetAddress embedded = extractTransitionIpv4(bytes);
            if (embedded != null) return isPrivateAddress(embedded);
        } catch (Exception e) { return true; }
    }
    return false;
}
```

Both `SectorIdentifierUriService` and `ClientIdMetadataService` should share a common implementation. The `ClientIdMetadataService` version also needs multicast and ULA checks added.

## Credit

Reported by tonghuaroot (tonghuaroot@gmail.com).

## References

- https://github.com/JanssenProject/jans/security/advisories/GHSA-r4cv-3m8p-43j8

Page: https://cve.now/GHSA-R4CV-3M8P-43J8

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
