Summary
CI4MS, a CodeIgniter 4-based CMS skeleton, contains a logic flaw where user account state changes (such as deletion) are not enforced for already-active sessions.
As a result, deleted accounts can continue to access protected resources indefinitely until they manually log out, violating the intended access control policy and enabling persistent unauthorized access.
Affected context
This weakness appears in CI4MS deployments that rely on its built-in authentication, RBAC authorization, and session handling.
The application only validates account state during login and does not re-check user status or revoke sessions when an account is deleted or disabled.
There is no configured session or account expiration mechanism, so long-lived sessions remain valid even after administrative account deletion.
This typically affects scenarios where administrators revoke user access (e.g., termination, role changes, incident response) and expect immediate loss of access.
Exploit preconditions
- Attack surface: Web application session layer exposed through the CI4MS authentication system.
- Required access: A valid user account and an already-established authenticated session (e.g., browser session, remembered login).
- Trigger point: An administrator deletes or deactivates the user account, expecting that access is revoked.
- Why exploitation is possible: Session validity is not tied to dynamic account state checks; the application trusts existing sessions for their entire lifetime and does not implement explicit session expiration, revocation, or revalidation on critical requests.
Why this happens
The core issue is a broken access control and session lifecycle design, aligning with:
- CWE-613: Insufficient Session Expiration, where sessions are allowed to persist beyond changes in authorization.
- CWE-284: Improper Access Control, since access rights are not re-evaluated after account deletion.
- CWE-1254: Improper Access Control for Impersonation or Confused Deputy patterns, in that the system continues to honor stale credentials as though they reflected current policy.
Architecturally, the application couples authorization decisions to the moment of authentication, assuming that once a user is logged in, their session token remains trustworthy without further state verification.
There is no mechanism to invalidate or rotate sessions based on account changes, nor to enforce time-based expiration, producing a long-lived, over-privileged session model.
Potential impact
- Deleted user accounts may continue accessing protected areas of the CMS indefinitely.
- Users whose access should be revoked (e.g., former employees, banned community members) could retain the same permissions they had before deletion.
- Administrative or elevated accounts, if not properly revoked at the session layer, could continue performing privileged actions despite removal in the backend.
- Incident response and access revocation procedures may be ineffective, undermining organizational security policies and compliance requirements.
- Lateral movement and data exfiltration can be facilitated if stale sessions are reused from multiple devices or browsers.
General mitigation guidance
Mitigation focuses on decoupling trust from static sessions and enforcing continuous authorization:
- Design the session model so that session validity is checked against the current user state (e.g., active/disabled/deleted) on each privileged request or at regular intervals.
- Introduce robust session expiration policies, including reasonable session lifetimes and absolute timeouts, to limit the duration of any granted access.
- Implement server-side session revocation: when an account is deleted or disabled, invalidate associated sessions stored in the server-side session store or database.
- Use versioned or state-bound tokens (e.g., a user record with a
token_versionorsession_saltfield) so that updating this value on account changes automatically invalidates all existing sessions. - Apply least-privilege principles by separating high-privilege actions behind additional checks (such as re-authentication or fresh token claims) to reduce the risk of stale sessions performing sensitive operations.
- Incorporate access control checks into middleware or filters that run on every request to critical endpoints, not just at login time.
How teams detect issues like this
Detecting this class of issue generally involves a combination of design review, code inspection, and runtime monitoring:
- Code review patterns:
- Verify whether authorization checks are centralized (e.g., middleware) and performed on each request, rather than only during login.
- Inspect session handling and authentication logic to see if account state (active/deleted/locked) is consulted at request time.
- Look for missing or overly long session timeout settings and absence of server-side session invalidation on account changes.
- Static analysis & policy checks:
- Use static analysis or custom linters to flag authentication flows that do not reference current user status when authorizing actions.
- Implement architectural review rules that require a clear session revocation mechanism tied to user lifecycle events (deletion, role change, password reset).
- Runtime and log-based indicators:
- Monitor logs for activity by user identifiers after they have been deleted or deactivated.
- Analyze session tables or tokens for unusually long-lived sessions that do not expire or rotate.
- Automated test strategies:
- Add regression tests that simulate deleting a user while an active session exists and verify that subsequent requests using that session are rejected.
- Integrate these tests into CI to ensure that future changes do not reintroduce persistent session issues.

