Repository navigation
Description
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
identity-brokering
Describe the bug
Identity providers (both SAML and OIDC) persist configurations where signature validation settings are absent, and the broker implementations treat an absent setting as disabled. The resulting provider accepts unsigned or arbitrarily-signed assertions/tokens, yielding an authenticated session for any existing linked account.
SAML (SAMLIdentityProviderConfig): isValidateSignature() and isWantAssertionsSigned() evaluate Boolean.valueOf(null) → false. SAMLIdentityProviderFactory.create() adds no defaults. Unsigned, dummy-signed, or arbitrarily-signed assertions are accepted.
OIDC (OIDCIdentityProviderConfig): isValidateSignature() evaluates Boolean.parseBoolean(null) → false. When disabled, OIDCIdentityProvider.verify() returns true without verifying the ID token signature, and validateJwt() falls back to the userinfo endpoint. OIDCIdentityProviderFactory.parseOIDCConfig() only enables validation when the discovery document contains a jwks_uri.
Affected provisioning paths:
- Realm import (
--import-realm, partial import,RealmRepresentation.identityProviders) - Admin REST API (
POST /admin/realms/{realm}/identity-provider/instances) - Admin CLI (
kcadm.sh create identity-provider/instances) - Admin Console for OIDC providers: the
config.validateSignatureswitch inDiscoverySettings.tsxhas nodefaultValue(the SAML equivalent was fixed by SAML Identity Provider settings in the Admin UI are not asking for signatures by default #48717 / fix(admin-ui): default SAML IdP signature switches to enabled #49813, Admin Console only)
Additionally, for SAML, when wantAssertionsSigned=true but validateSignature=false (or absent), SAMLEndpoint.handleLoginResponse() only checks that a <ds:Signature> element is present on the assertion, not that it is valid:
boolean signed = AssertionUtil.isSignedElement(assertionElement);
final boolean assertionSignatureNotExistsWhenRequired = config.isWantAssertionsSigned() && !signed;
final boolean signatureNotValid = signed && config.isValidateSignature() && !AssertionUtil.isSignatureValid(assertionElement, getIDPKeyLocator());
final boolean hasNoSignatureWhenRequired = !signed && config.isValidateSignature() && !isMessageFullySigned(holder);signatureNotValid is gated on isValidateSignature(), so a placeholder signature satisfies wantAssertionsSigned. An administrator who enables only "Want Assertions signed" receives no protection against forged assertions.
What exists so far is spread across separate issues and none of them tracks the server-side defaults: #48717 fixed the SAML Admin Console defaults only (PR #49813: "No server-side or backend defaults are modified"); #48719 is scoped to idpEntityId and explicitly excludes other fields; #48232 is an umbrella framed around Admin UI defaults for SAML; #44473 only couples validateSignature with JWT authorization grant / client assertions for OIDC.
Acknowledgement
This was originally reported by Ilyas to the Keycloak security team. It was later classified as a security hardening. The same defaults were previously discussed in the context of #48717.
Version
26.8.0 (also reproduced on 26.7.4)
Regression
- The issue is a regression
Expected behavior
Keycloak should be secure by default regardless of the protocol or the provisioning path. When signature validation settings are absent from an identity provider configuration, the server should either:
- default them to
true(SAML:validateSignature,wantAssertionsSigned; OIDC:validateSignature), in the provider config / factory so that all provisioning paths are covered, or - reject / warn on configurations that leave signature validation disabled, consistent with the Admin Console defaults introduced by SAML Identity Provider settings in the Admin UI are not asking for signatures by default #48717.
Disabling signature validation, if still supported, should be an explicit opt-out rather than the implicit default. The OIDC Admin Console should default the Validate signatures switch to enabled, as done for SAML.
For SAML, when wantAssertionsSigned=true, the assertion signature should be cryptographically verified against the IdP signing keys regardless of validateSignature, or the two settings should be coupled so that wantAssertionsSigned=true cannot be persisted with validateSignature=false.
Actual behavior
A SAML or OIDC identity provider created via realm import, Admin REST API, or admin CLI (and, for OIDC, the Admin Console) without explicitly enabling signature validation accepts forged assertions / ID tokens.
For SAML, with wantAssertionsSigned=true and validateSignature=false, an assertion carrying an arbitrary <ds:Signature> element (dummy digest and signature value) is also accepted.
How to Reproduce?
SAML:
- Create a SAML IdP via REST without the signature settings:
POST /admin/realms/{realm}/identity-provider/instances {"alias":"saml","providerId":"saml","enabled":true, "config":{"singleSignOnServiceUrl":"https://idp.example/sso","nameIDPolicyFormat":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}} - Link an existing user to the IdP (federated identity).
- Start a broker login and POST a forged, unsigned (or signed with an arbitrary key) SAML Response containing an assertion for the linked user's NameID to the broker endpoint.
- Observe the login succeeds and tokens are issued.
- Repeat with
config.wantAssertionsSigned=trueandvalidateSignatureunset, sending an assertion with a placeholder<ds:Signature>element: the login still succeeds.
OIDC:
- Create an OIDC IdP via REST (or the Admin Console) without
config.validateSignature:POST /admin/realms/{realm}/identity-provider/instances {"alias":"oidc","providerId":"oidc","enabled":true, "config":{"issuer":"https://op.example","authorizationUrl":"https://op.example/auth","tokenUrl":"https://op.example/token","clientId":"kc","clientSecret":"secret"}} - Observe the persisted configuration has no
validateSignatureandOIDCIdentityProviderConfig.isValidateSignature()returnsfalse. - Any ID token returned by the (attacker-controlled or compromised) token endpoint, including one with
alg=noneor signed by an arbitrary key, is accepted without signature verification.
Controls: setting validateSignature=true rejects a mismatched signer and the placeholder signature; an unlinked identity falls to first-broker-login.
Anything else?
- CVE-2026-16443 (CVE-2026-16443 SAML broker metadata import disables response signature validation #51471): SAML broker metadata import disabled response signature validation — same outcome (forged response → account takeover) for the metadata import path.
- CVE-2026-18569 ([CVE-2026-18569] OIDC broker backchannel logout accepts unsigned forged logout tokens when signature validation is disabled #51381): OIDC broker backchannel logout accepted unsigned forged logout tokens when
validateSignature=false— the insecure default amplifies the impact of such issues. - Related hardening: SAML Identity Provider settings in the Admin UI are not asking for signatures by default #48717 (SAML Admin UI defaults, resolved), Keycloak accepts SAML IDP configurations without providing an Identity provider entity ID #48719 (SAML
idpEntityId), Best practices for SAML IdP configurations #48232 (SAML IdP best practices umbrella), Make sure that signature validation possible to configure for OIDC identity provider when JWT authz grant or clientAssertions authentication enabled #44473 (OIDCvalidateSignaturecoupling with JWT authz grant).
Related settings to review
While the signature validation defaults are the critical part, the same "absent means insecure" pattern applies to other identity provider settings. These are listed here so they can be considered together when deciding on a server-side defaults/validation mechanism (see also #48232 and the kcwarden IdP auditors):
Higher impact (authenticity / integrity)
| Setting | Current default when absent | Notes |
|---|---|---|
OIDC pkceEnabled / pkceMethod |
false / unset (OAuth2IdentityProviderConfig) |
RFC 9700 (OAuth 2.0 Security BCP) requires PKCE for the authorization code flow. Default to true + S256. |
SAML idpEntityId |
null → issuer validation skipped (SAMLEndpoint) |
Tracked in #48719. |
SAML wantAuthnRequestsSigned |
false |
Unsigned AuthnRequests are treated as anonymous by the IdP; increases exposure to IdP confusion / login CSRF. |
SAML postBindingResponse |
false (HTTP-Redirect) |
Redirect binding places the response in the URL (logs, Referer, length limits) and was the surface for #53354. POST should be the default. |
Defence in depth
| Setting | Current default when absent | Notes |
|---|---|---|
SAML wantAssertionsEncrypted |
false |
Mitigates XSW and PII exposure; likely a warning rather than a default since many IdPs do not encrypt. |
OIDC clientAuthMethod |
client_secret_post |
OIDC Core defaults to client_secret_basic and RFC 6749 §2.3.1 does not recommend credentials in the body; the actual security improvement is asymmetric authentication (private_key_jwt / mTLS) per the OAuth Security BCP. client_secret_basic_unencoded should be considered for deprecation. |
syncMode |
LEGACY / IMPORT |
Upstream changes (e.g. group removal) never propagate; authorization drift. |
OIDC disableNonce, disableTypeClaimCheck |
false (secure) |
Already secure; consider deprecating the opt-outs. |
Rather than adjusting each *IdentityProviderConfig getter individually, a server-side normalisation/validation step applied on create and import (covering REST, CLI, realm import and the Admin Console uniformly) that fills in secure defaults for absent keys and warns or rejects on explicitly insecure values would address this class of issue.
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Fields
Projects
- StatusShow more project fieldsOpen
Activity
[-]SAML Identity Provider created via realm import, Admin REST API or admin CLI does not validate signatures by default[/-][+]SAML Identity Provider does not validate assertion signatures by default when created via realm import, Admin REST API or admin CLI[/+][-]SAML Identity Provider does not validate assertion signatures by default when created via realm import, Admin REST API or admin CLI[/-][+]Identity providers (SAML and OIDC) do not validate signatures by default when the setting is absent from the configuration[/+]Updating SAML and OIDC getters to default to true when absent in the …
Updating SAML and OIDC getters to default to true when absent in the …
74 remaining items
Updating OIDC defualt signature validation securely when settings are…
Updating OIDC defualt signature validation securely when settings are…
Updating OIDC defualt signature validation securely when settings are…
Updating SAML defualt signature validation securely when settings are…
Updating OIDC defualt signature validation securely when settings are…
Updating SAML defualt signature validation securely when settings are…
Updating OIDC defualt signature validation securely when settings are…
Updating OIDC defualt signature validation securely when settings are…
Updating SAML defualt signature validation securely when settings are…
Updating OIDC defualt signature validation securely when settings are…
Updating OIDC defualt signature validation securely when settings are…
Updating SAML defualt signature validation securely when settings are…
Updating OIDC defualt signature validation securely when settings are…
Updating OIDC defualt signature validation securely when settings are…