Skip to content

SAML adapter indexless logout lacks expiry check, replay protection, and tenant isolation #55270

Description

@graziang

Describe the bug

The WildFly/Elytron SAML adapter accepts a LogoutRequest without a
SessionIndex and terminates every local session matching the request's
NameID. That path has three gaps:

  • No freshness check: the adapter never reads the request's
    NotOnOrAfter attribute, so a captured logout stays effective with no time
    limit and can terminate sessions created long after it was issued.
  • No replay protection: the adapter does not record the identifiers of
    logout requests it has already processed, so the same request can be
    submitted repeatedly and each submission terminates whatever sessions then
    match.
  • No tenant scoping: in a multi-tenant deployment, where the
    keycloak.config.resolver init parameter resolves a different configuration
    per request, all tenants of the same web application share one session
    mapper, and sessions are indexed by the bare subject with no identity
    provider qualifier. A logout issued by one tenant's identity provider
    therefore terminates the sessions of any other tenant whose users have the
    same NameID.

The adapter does verify the signature, the destination and that the request's
issuer matches the configured identity provider entity ID, so a valid request
is required in every case. The impact is limited to forced termination of
sessions that the request should not have reached.

Version

Present on main and on the 26.8 and 26.6 release branches.

Expected behavior

A LogoutRequest is honoured only while it is fresh and only once: the
adapter rejects a request whose NotOnOrAfter has passed, and rejects a
request whose identifier it has already processed. In a multi-tenant
deployment, a logout terminates only the sessions belonging to the tenant
whose identity provider issued it.

Actual behavior

A captured LogoutRequest remains valid indefinitely and can be replayed any
number of times, terminating sessions established after the original logout.
In a multi-tenant deployment the session lookup ignores which tenant created a
session, so a logout from one tenant's identity provider terminates sessions
of other tenants whose users share the same NameID.

Anything else?

The affected code is in the WildFly/Elytron SAML adapter and in the adapter
session-mapper SPI. The missing tenant qualifier is the same session-mapper
limitation reported in #55263, seen from the opposite side:
there the unqualified index causes a logout to miss sessions it should
terminate, here it causes a logout to reach sessions it should not.


This issue was originally tracked in the private repository. Migrated by @graziang.

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for weakness.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions