With OAuth Client ID Metadata Documents (CIMD), the client_id in an authorization request is a URL. The authorization server has never seen the client before, so it fetches that URL to learn the client's name and redirect URIs. MCP's 2026-07-28 authorization spec makes this the default way for a client to show up at a server it has no prior relationship with.

So anyone who can open a browser can make the AS send a GET to a URL of their choosing. draft-ietf-oauth-client-id-metadata-document-03 §10.7:

Authorization servers MUST NOT fetch a Client ID Metadata Document URL or any URLs contained within a Client ID Metadata Document that resolve to special-use IP addresses as defined in [RFC6890].

mustbreak has four cases for this part of CIMD: MB-05 (a client_id URL on a private address), MB-06 (a URL that answers 302), MB-07 (a document whose client_id is not its URL) and MB-08 (a 64 KB document). Until this week they only ran against fixtures. The AS in CI was dex, which has no CIMD, so all four reported skip.

Keycloak has CIMD since 26.6, behind --features=cimd. So I added it to CI.

What MB-05 needs before it can say anything

MB-05 asks the AS to authorize a client whose client_id is http://<private address>:9443/mb-05/client.json, where that address belongs to mustbreak's own listener. If the listener sees a connection, the AS fetched it, and the case fails.

A listener that sees nothing does not mean much on its own. The AS might not reach the listener at all, or it might refuse every client_id for an unrelated reason. So before the attack, MB-05 sends the same request with a document on a public address and requires the AS to fetch that one. Only an AS that fetched the control and left the private URL alone passes.

That means the test bed needs two networks: one the AS treats as the internet, and one it should treat as private. Both have to reach mustbreak.

 mustbreak-public 11.250.0.0/24 Keycloak 11.250.0.2 mustbreak 11.250.0.3 mustbreak-private 10.250.0.0/24 Keycloak 10.250.0.2 mustbreak 10.250.0.3 

11.250.0.0/24 is not in any RFC 6890 registry, so a compliant AS fetches from it. It is only routed inside the docker network. 10.250.0.0/24 is private-use.

Keycloak's CIMD is configured with a client policy. The realm I import:

"clientProfiles": { "profiles": [{ "name": "cimd", "executors": [{ "executor": "client-id-metadata-document", "configuration": { "cimd-allow-http-scheme": "true", "cimd-allow-permitted-domains": ["11.250.0.3", "10.250.0.3"] } }] }] }, "clientPolicies": { "policies": [{ "name": "cimd", "enabled": true, "conditions": [{ "condition": "client-id-uri", "configuration": { "client-id-uri-scheme": ["http"], "client-id-uri-allow-permitted-domains": ["11.250.0.3", "10.250.0.3"] } }], "profiles": ["cimd"] }] } 

Both of mustbreak's addresses are in the trusted domains on purpose. If the private one were missing, Keycloak would reject it at the allow list and MB-05 would pass without the address check ever running. cimd-allow-http-scheme saves setting up TLS. It has nothing to do with the address check.

The realm also needs "sslRequired": "none". Keycloak's default, external, demands HTTPS from any client that is not on a private address. It treats 11.250.0.3 as external, so every request, discovery included, got {"error":"invalid_request","error_description":"HTTPS required"}.

The false pass

My first run had MB-05 passing on 26.8.2. The evidence said the AS ended on HTTP 400 and the listener saw no connection.

The reason was in my own script. I started the mustbreak container on the public network only. Keycloak did try to fetch http://10.250.0.3:9443/mb-05/client.json, but nothing had that address, so the connection went nowhere, the fetch failed, and Keycloak returned 400 because it could not get the document.

The script now creates the mustbreak container, connects it to both networks, and only then starts it:

docker create --name mustbreak-run --network mustbreak-public --ip 11.250.0.3 \ -v "$work:/w" -w /w "$runner" ./mustbreak as --profile profile.yaml \ --case MB-05,MB-06,MB-07,MB-08 --json >/dev/null docker network connect --ip 10.250.0.3 mustbreak-private mustbreak-run docker start -a mustbreak-run >"$work/as.json" 

docker run would start the process before the second network is attached, and the first cases would race it.

26.8.2

With mustbreak on both networks, -v instead of --json so the evidence shows:

$ ./mustbreak as --profile profile.yaml --case MB-05,MB-06,MB-07,MB-08 -v mustbreak dev: as http://11.250.0.2:8080/realms/mb FAIL MB-05 MUST NOT client_id URL on a special-use address the AS connected to http://10.250.0.3:9443, a special-use address - control, valid document at http://11.250.0.3:9443/mb-05/control/control.json: ended on HTTP 200 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth - client_id=http://10.250.0.3:9443/mb-05/client.json: ended on HTTP 200 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth - the listener saw 1 connection(s) and 1 request(s) for /mb-05/client.json PASS MB-06 MUST NOT client_id URL that redirects to an internal host the AS fetched the document URL, did not follow its redirect and did not redirect to the client - control, valid document at http://11.250.0.3:9443/mb-06/control/control.json: ended on HTTP 200 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth - client_id=http://11.250.0.3:9443/mb-06/client.json (302 to http://11.250.0.3:9443/mb-06/internal.json): ended on HTTP 400 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth PASS MB-07 MUST Metadata document whose client_id is not its URL the AS fetched the document and refused the client - control, valid document at http://11.250.0.3:9443/mb-07/control/control.json: ended on HTTP 200 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth - client_id=http://11.250.0.3:9443/mb-07/client.json, document says client_id=http://11.250.0.3:9443/mb-07/other.json: ended on HTTP 400 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth PASS MB-08 SHOULD Metadata document larger than 5 KB the AS refused the 64 KB document it accepted when small - control, valid document at http://11.250.0.3:9443/mb-08/control/control.json: ended on HTTP 200 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth - client_id=http://11.250.0.3:9443/mb-08/client.json, document of 64 KB: ended on HTTP 400 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth 4 cases: 3 pass, 1 fail, 0 skip, 0 error 

The MB-05 attack ends on HTTP 200: Keycloak fetched the document from 10.250.0.3, accepted the client and showed its login page. MB-06 to MB-08 pass. Keycloak does not follow the 302, rejects the mismatched client_id, and stops reading at 5000 bytes.

Keycloak's log, trimmed to the CIMD executor:

WARN [...ClientIdMetadataDocumentExecutor] fetching client metadata for the first time failed: clientId = http://11.250.0.3:9443/mb-06/client.json WARN [...ClientIdMetadataDocumentExecutor] client_id property in client metadata does not exactly match client_id parameter in authorization request. property = http://11.250.0.3:9443/mb-07/other.json, ... WARN [...ClientIdMetadataDocumentExecutor] HTTP connection failure: java.io.IOException: Response is at least 8044 bytes in size, with max bytes to be consumed being 5000 

There is no line for MB-05. From Keycloak's side that fetch worked, so there was nothing to warn about. The only record of it is the request on mustbreak's listener.

Why

In 26.8.2, verifyClientId ends like this (source):

// Trusted domains and SSRF attack countermeasure: // It checks if a host part is under one of trusted domains. // It checks if an address resolved from a property whose value is URI is loopback address. // It checks if an address resolved from a property whose value is URI is private address. List<String> trustedDomains = convertContentFilledList(getConfiguration().getTrustedDomains()); verifyUri(clientId, trustedDomains, (error, logMessageTemplate) -> { getLogger().warnv(logMessageTemplate, "client_id", clientId); throw invalidClientIdMetadata(error); }); 

The comment lists three checks. verifyUri does the first one: it matches the host string against the trusted domains and returns. Nothing resolves the host. In 26.8.2 the trusted-domain list is the whole SSRF defense, so a trusted name that resolves to 10.x or 127.0.0.1 gets fetched.

This is keycloak/keycloak#53812, already public and closed. The fix is f50550430 ("ssfr check for cimd", 2026-10-13), labelled for 27.0.0. It resolves the host and rejects loopback, any-local, link-local, site-local, multicast, fc00::/7 and 100.64.0.0/10, with a new executor option cimd-allow-private-use-addresses that defaults to off. It also applies the check to jwks_uri, sector_identifier_uri and request_uris from the fetched document, which Keycloak requests later on its own.

The fix is on main, not in a 26.8.x release, so the nightly image is where it shows up:

$ ./mustbreak as --profile profile.yaml --case MB-05,MB-06,MB-07,MB-08 -v mustbreak dev: as http://11.250.0.2:8080/realms/mb PASS MB-05 MUST NOT client_id URL on a special-use address the AS fetched a document from the public URL but not from http://10.250.0.3:9443, and did not redirect to the client - control, valid document at http://11.250.0.3:9443/mb-05/control/control.json: ended on HTTP 200 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth - client_id=http://10.250.0.3:9443/mb-05/client.json: ended on HTTP 400 at http://11.250.0.2:8080/realms/mb/protocol/openid-connect/auth - the listener saw no connection PASS MB-06 MUST NOT client_id URL that redirects to an internal host PASS MB-07 MUST Metadata document whose client_id is not its URL PASS MB-08 SHOULD Metadata document larger than 5 KB 4 cases: 4 pass, 0 fail, 0 skip, 0 error 

I trimmed the evidence for MB-06 to MB-08, which matches 26.8.2. This time Keycloak logs the refusal:

WARN [...ClientIdMetadataDocumentExecutor] Address not allowed: client_id = http://10.250.0.3:9443/mb-05/client.json 

The guide on main also notes that the address is checked when Keycloak fetches the document, not again when it later calls one of those URLs. A trusted name whose DNS changes afterwards is not caught, so the trusted-domain list still matters after 27.0.0.

In CI

Both images are pinned by digest, and each has an expected file:

$ cat e2e/expect/keycloak-26.8.2.txt MB-05 fail MB-06 pass MB-07 pass MB-08 pass $ cat e2e/expect/keycloak-nightly.txt MB-05 pass MB-06 pass MB-07 pass MB-08 pass 

The fail on 26.8.2 is pinned the same way dex v2.46.1 pins MB-17 (UserInfo sub mismatch, fixed in dexidp/dex#4828). When 27.0.0 ships, I add it as a third image, and if anything moves, the diff in CI says so. The job takes under a minute on a GitHub runner:

e2e (Keycloak 26.8.2) pass 49s e2e (Keycloak nightly) pass 53s 

To run it yourself:

git clone https://github.com/dyokto/mustbreak && cd mustbreak KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:26.8.2 \ EXPECT=e2e/expect/keycloak-26.8.2.txt e2e/keycloak.sh 

On Docker Desktop, clone it somewhere Docker shares with its VM. My first local attempt ran from a directory under /private/tmp, the realm file mounted as an empty directory, Keycloak imported nothing, and every case reported error on a 404 discovery URL.

On 26.x with --features=cimd, the trusted-domain list is the only thing between a client_id and your internal network until 27.0.0, so keep it to names you control that do not resolve to anything internal.