
Python PoC for CVE-2026-11800: forges HS256 JWT assertions signed with a Keycloak IdP public key to bypass authentication and impersonate federated users.
Unauthenticated authentication bypass in Keycloak, fixed in 26.6.4 (GHSA-j97h-3f8r-mrjr, CWE-347).
A Keycloak realm with an OIDC identity provider configured with a hardcoded public key (useJwksUrl=false) and the JWT authorization grant enabled accepted symmetric HS256 client assertions whose HMAC secret is the IdP's public key bytes (raw base64 DER — exactly the publicKeySignatureVerifier value). Since the "secret" is public material, an attacker holding only a valid confidential client's credentials can forge an assertion for any federated user identity and receive a valid access token — no user credentials, no private key, no IdP access.
Two code factors, both fixed in 26.6.4:
validateSignatureAlgorithm() did not reject symmetric algorithms when the signature verifier was a hardcoded public key;HardcodedPublicKeyLoader contained an HMAC branch (Base64Url.decode(publicKeySignatureVerifier) used directly as the shared secret).exploit.py — pure Python 3 stdlib, zero dependencies:
GET /realms/<realm>/.well-known/openid-configurationiss = IdP issuer, sub = federated user id) signed with the public key bytes as HMAC secretPOST token_endpoint with grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer → HTTP 200, access token for the impersonated userinvalid_grant / Invalid signature (proves the server verifies the HMAC against the public key bytes)userinfo called with the forged token → HTTP 200, body of the impersonated userVerified end-to-end against quay.io/keycloak/keycloak:26.6.3.
publicKeySignatureVerifier set, useJwksUrl=false, jwtAuthorizationGrantEnabled=true, jwtAuthorizationGrantAssertionSignatureAlg not pinnedoauth2.jwt.authorization.grant.enabled=true and the IdP allow-listed (client_id/client_secret are attacker inputs)sub of a federated userInsert the target host/port (and deployment values) into the CONFIG block of exploit.py, then:
python3 exploit.py http://target:8080
Supply the IdP public key via one of:
IDP_PUBKEY_B64 — raw base64 DER (the exact publicKeySignatureVerifier value) or a PEM blockIDP_PUBKEY_FILE — path to a PEM fileKC_ADMIN_USER / KC_ADMIN_PASS env vars — key fetched from the Keycloak Admin REST API (lab mode)Invalid signature algorithm)jwtAuthorizationGrantAssertionSignatureAlg to an asymmetric algorithmuseJwksUrl=true) over hardcoded keysFor authorized security testing only.