Directory-side password change should end Cairn browser sessions (AD pwdLastSet, Keycloak) #848

Closed
opened 2026-10-06 16:55:48 +00:00 by Cordy · 3 comments
Owner

Follow-up from #838/#839 (final review).

Today: when an admin resets a user's password in AD/LDAP or Keycloak, WebDAV/app credentials pick it up within ldapCacheTTL. Browser sessions do not end: the periodic re-check (directoryRecheck) only looks at whether the account exists, whether it's enabled, and its groups. In the Mokapi run on 2026-10-06, the old browser session kept working after a password change until its 12h expiry. That behaviour is documented in deployment.md "What each mode does".

Why it matters: an AD-side reset is the usual response to a compromised account.

Options to research when this is worked on:

  • LDAP/AD: read pwdLastSet (AD) / pwdChangedTime (OpenLDAP, ppolicy) in Recheck, and reject sessions issued before it.
  • Keycloak: back-channel logout already fires if the admin also signs the user out. Check whether Keycloak can be configured to log out all of a user's sessions on a credential reset, and the admin events / credentials timestamps on the user representation.
  • CAEP credential-change events (#845, parked).

Open decisions are asked when this is worked on.

Follow-up from #838/#839 (final review). **Today:** when an admin resets a user's password in AD/LDAP or Keycloak, WebDAV/app credentials pick it up within `ldapCacheTTL`. Browser sessions do not end: the periodic re-check (`directoryRecheck`) only looks at whether the account exists, whether it's enabled, and its groups. In the Mokapi run on 2026-10-06, the old browser session kept working after a password change until its 12h expiry. That behaviour is documented in deployment.md "What each mode does". **Why it matters:** an AD-side reset is the usual response to a compromised account. **Options to research when this is worked on:** - LDAP/AD: read `pwdLastSet` (AD) / `pwdChangedTime` (OpenLDAP, ppolicy) in `Recheck`, and reject sessions issued before it. - Keycloak: back-channel logout already fires if the admin also signs the user out. Check whether Keycloak can be configured to log out all of a user's sessions on a credential reset, and the admin events / `credentials` timestamps on the user representation. - CAEP `credential-change` events (#845, parked). Open decisions are asked when this is worked on.
Author
Owner

check for existing standards. how do other competitors and similar products handle this? their pitfalls and challenges regarding this. what do users and admins/operators say? any existing ISO Norms regarding this? document research here as well.

check for existing standards. how do other competitors and similar products handle this? their pitfalls and challenges regarding this. what do users and admins/operators say? any existing ISO Norms regarding this? document research here as well.
Author
Owner

Research (2026-10-08)

Standards

  • OWASP Session Management Cheat Sheet: session IDs must be renewed after any privilege change, with password changes named as a common case. The section "Reauthentication After Risk Events" lists "attempted or completed password changes" as an event that requires reauthentication. https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html
  • NIST SP 800-63B-4: AAL2 sets an overall reauthentication limit of 24 hours (SHOULD) and an inactivity limit of 1 hour (SHOULD). Lifecycle guidance: on suspected compromise, suspend or rotate the authenticator; on confirmed compromise, revoke it. NIST has no explicit rule saying "end all sessions on a password change". https://pages.nist.gov/800-63-4/sp800-63b.html
  • ISO/IEC 27002:2022:
    • 5.17 (Authentication information) covers changing credentials on compromise and keeping records of authentication-information events.
    • 8.5 (Secure authentication) covers session handling.
    • Neither prescribes a mechanism. The ISO-relevant points are that the change takes effect and that it is recorded, which in Cairn means the audit log.
  • OpenID CAEP 1.0 (Final): defines a credential-change event (create, change, revoke or delete), the push-based standard way to signal this. That is #845 (parked); few self-hosted IdPs emit it today. https://openid.net/wg/sharedsignals/specifications/

How others behave

Where the change is visible to Cairn

  • AD: pwdLastSet, a FILETIME in 100 ns units since 1601. The special value 0 means "must change at next logon", which is how admins usually mark a reset.
  • OpenLDAP (ppolicy): pwdChangedTime, an operational attribute that must be requested by name. It is absent when ppolicy is off; fall back to doing nothing, not to createTimestamp.
  • Keycloak: GET /admin/realms/{realm}/users/{id}/credentials returns createdDate (ms) for the password credential. The existing admin client (view-users) can read it, at one extra call per re-check.

Fit in Cairn

  • Recheck and UserStatus* already run every directoryRecheck (default 5 minutes).
  • Adding a pwdChanged time.Time return and ending a session when pwdChanged > session.issued reuses the existing revoke path (Revoker.RevokeUser), the audit and the outage handling: an outage keeps the last state and never signs anyone out.
  • The worst-case delay is directoryRecheck, comparable to Entra's roughly 15 minutes.
  • Pitfalls to handle:
    • AD replication lag between DCs. Compare the stored value, not wall clock, so a lagging DC can't read as a change.
    • Clock skew between the directory and Cairn. Use a small tolerance, for example 2 minutes, plus a strict "greater than session issued" check.
    • The user's own Cairn sign-in straight after the change must not be ended. Sessions issued after the change are kept.

Open decisions are asked in chat and recorded here once answered.

## Research (2026-10-08) ### Standards - **OWASP Session Management Cheat Sheet:** session IDs must be renewed after any privilege change, with password changes named as a common case. The section "Reauthentication After Risk Events" lists "attempted or completed password changes" as an event that requires reauthentication. https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html - **NIST SP 800-63B-4:** AAL2 sets an overall reauthentication limit of 24 hours (SHOULD) and an inactivity limit of 1 hour (SHOULD). Lifecycle guidance: on suspected compromise, suspend or rotate the authenticator; on confirmed compromise, revoke it. NIST has no explicit rule saying "end all sessions on a password change". https://pages.nist.gov/800-63-4/sp800-63b.html - **ISO/IEC 27002:2022:** - 5.17 (Authentication information) covers changing credentials on compromise and keeping records of authentication-information events. - 8.5 (Secure authentication) covers session handling. - Neither prescribes a mechanism. The ISO-relevant points are that the change takes effect and that it is recorded, which in Cairn means the audit log. - **OpenID CAEP 1.0 (Final):** defines a `credential-change` event (create, change, revoke or delete), the push-based standard way to signal this. That is #845 (parked); few self-hosted IdPs emit it today. https://openid.net/wg/sharedsignals/specifications/ ### How others behave - **Microsoft Entra:** a password change or reset is a CAE "critical event". Sessions are revoked in near real time, with up to about 15 minutes of propagation delay, but only for CAE-aware services (Exchange, Teams, SharePoint). Elsewhere, already-issued tokens stay valid until they expire. https://learn.microsoft.com/en-us/defender-office-365/zero-trust-continuous-access-evaluation-microsoft-365 - **Google Workspace:** - An admin password reset alone does not sign the user out; Google tells admins to also "reset sign-in cookies". https://knowledge.workspace.google.com/admin/users/reset-a-users-password - A password change does revoke OAuth tokens and app passwords. https://support.google.com/a/answer/6328616, https://support.google.com/accounts/answer/185833 - **Keycloak:** - A change made in the account console offers "sign out other devices". - The forgot-password reset does **not** end sessions, and the maintainers say this is intended. https://github.com/keycloak/keycloak/discussions/8988 - An admin reset does not end sessions either; the admin has to click "Sign out" separately. Since #839, Cairn honours that through back-channel logout. - Forum reports show that ending the Keycloak session does not end the application's own session unless the app does back-channel logout or polls. https://forum.keycloak.org/t/logout-all-session-when-password-change/12797 - **Nextcloud (LDAP):** - The password is checked against the DC only at sign-in. A browser session keeps working until it expires, and app passwords survive an AD change. https://help.nextcloud.com/t/does-nextcloud-ldap-plugin-checks-current-ldap-password/231018 - Operators report clients looping on the old password and tripping brute-force protection. https://community.nethserver.org/t/activedirectory-user-password-expired-problems-with-the-nextcloud-android-app/17701 - **Auth0:** has the same complaint thread, "sessions not logged out after password reset". https://community.auth0.com/t/active-sessions-are-not-automatically-logged-out-after-a-user-resets-password/106965 - **Bug-bounty pattern:** "session not invalidated after password change" is one of the most reported web findings (Odoo, OpenProject, Nuxeo and others), so pentesters will look for it. ### Where the change is visible to Cairn - **AD:** `pwdLastSet`, a FILETIME in 100 ns units since 1601. The special value `0` means "must change at next logon", which is how admins usually mark a reset. - **OpenLDAP (ppolicy):** `pwdChangedTime`, an operational attribute that must be requested by name. It is absent when ppolicy is off; fall back to doing nothing, not to `createTimestamp`. - **Keycloak:** `GET /admin/realms/{realm}/users/{id}/credentials` returns `createdDate` (ms) for the password credential. The existing admin client (view-users) can read it, at one extra call per re-check. ### Fit in Cairn - `Recheck` and `UserStatus*` already run every `directoryRecheck` (default 5 minutes). - Adding a `pwdChanged time.Time` return and ending a session when `pwdChanged > session.issued` reuses the existing revoke path (`Revoker.RevokeUser`), the audit and the outage handling: an outage keeps the last state and never signs anyone out. - The worst-case delay is `directoryRecheck`, comparable to Entra's roughly 15 minutes. - Pitfalls to handle: - AD replication lag between DCs. Compare the stored value, not wall clock, so a lagging DC can't read as a change. - Clock skew between the directory and Cairn. Use a small tolerance, for example 2 minutes, plus a strict "greater than session issued" check. - The user's own Cairn sign-in straight after the change must not be ended. Sessions issued after the change are kept. Open decisions are asked in chat and recorded here once answered.
Author
Owner

Decisions (Nikola, 2026-10-08)

  1. Scope: browser sessions only. A directory password change detected at re-check ends every Cairn browser session issued before it, and the end is audited. App passwords keep working, consistent with D1. Ending them is the admin's explicit action in #851.
  2. AD pwdLastSet = 0 ("must change at next logon"): a move from a real timestamp to 0 counts as a change and ends the sessions.

Sources: AD pwdLastSet, OpenLDAP pwdChangedTime (requested by name, absent means no signal), Keycloak password credential createdDate. An outage never signs anyone out. No UI change, so no mockup is needed, though the docs must be updated (deployment.md "What each mode does").

## Decisions (Nikola, 2026-10-08) 1. **Scope: browser sessions only.** A directory password change detected at re-check ends every Cairn browser session issued before it, and the end is audited. App passwords keep working, consistent with D1. Ending them is the admin's explicit action in #851. 2. **AD `pwdLastSet` = 0** ("must change at next logon"): a move from a real timestamp to 0 counts as a change and ends the sessions. Sources: AD `pwdLastSet`, OpenLDAP `pwdChangedTime` (requested by name, absent means no signal), Keycloak password credential `createdDate`. An outage never signs anyone out. No UI change, so no mockup is needed, though the docs must be updated (deployment.md "What each mode does").
Cordy closed this issue 2026-10-09 06:56:51 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#848
No description provided.