Severity:

HIGH RISK

(7.3)

Session Management Vulnerability in SourceCodester Prison

CVE-2026-2177

Analyzed

Vulnerability type

Category:

Session Management Vulnerability

CWE:

CWE-384

Impact:

Account Takeover / Session Hijacking

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

SourceCodester Prison Management System 1.0 contains a session fixation vulnerability in its login component, where user sessions are not properly regenerated during authentication.

An attacker who can cause a victim to use a session identifier chosen or known by the attacker may be able to hijack the victim's authenticated session remotely once the victim logs in.

Affected context

The issue arises in the web-based login flow of SourceCodester Prison Management System 1.0.

It is relevant in deployments where:

  • User authentication is performed via HTTP sessions or similar session identifiers
  • Session IDs are not renewed upon successful login
  • Users access the application via links, embedded frames, or pre-established session contexts that could be influenced by an attacker

Under these conditions, a session identifier may be fixed before authentication and then reused after login without being changed by the server.

Exploit preconditions

  • Attack surface: Public-facing web interface of the Prison Management System.
  • Required access: Ability to interact with the application as an unauthenticated user and to communicate with victims (e.g., via links, emails, or injected content).
  • Trigger point: Victim authenticates using a session ID that has been predetermined or observed by the attacker.
  • Why exploitation is possible: The application does not regenerate or invalidate the session identifier upon successful login, allowing a previously fixed or known session ID to become an authenticated session.

Why this happens

The root cause aligns with CWE-384: Session Fixation.

The login functionality fails to create a new, unpredictable session identifier when a user transitions from an unauthenticated to an authenticated state.

Instead, it continues to rely on an existing session ID that might have been set under attacker influence or observed earlier.

This insecure pattern allows attackers to pre-assign or capture a session ID and later reuse it to impersonate the victim once that ID becomes associated with a logged-in account.

Potential impact

  • Attacker may hijack authenticated user sessions after the victim logs in.
  • Attacker could access or modify sensitive prisoner records and administrative data.
  • Unauthorized changes to system configuration, user accounts, or operational workflows.
  • Potential disclosure of personal information and operational details within the prison management system.
  • Abuse of privileged roles if an administrative user's session is compromised.

General mitigation guidance

Effective mitigation focuses on robust session lifecycle management and reducing trust in pre-authentication session state:

  • Regenerate session identifiers upon successful login and on privilege elevation events.
  • Invalidate any existing session data tied to a pre-authentication session ID when creating an authenticated session.
  • Configure the session mechanism to use secure, unpredictable, and non-reusable identifiers.
  • Apply secure cookie attributes (Secure, HttpOnly, SameSite) and avoid exposing session IDs in URLs.
  • Limit session lifetime and enforce idle timeouts to reduce the window for hijacking.
  • Treat any session state established before authentication as untrusted and avoid carrying it forward without revalidation.

How teams detect issues like this

To detect session fixation issues, teams can:

  • Review authentication and session management code paths to verify that session IDs are regenerated on login and role changes.
  • Use static analysis or linters to flag authentication flows that do not invoke session renewal APIs.
  • Perform dynamic application testing, checking whether the session identifier remains identical before and after a successful login.
  • Implement security testing policies and automated tests in CI that verify proper session lifecycle management for new and modified authentication features.

Sources

SourceLink
github.comgithub.com/hater-us/CVE/issues/10
vuldb.comvuldb.com/?ctiid.344880
vuldb.comvuldb.com/?id.344880
vuldb.comvuldb.com/?submit.749485
sourcecodester.comsourcecodester.com/

Frequently asked

questions

Yes. An attacker can exploit this remotely by causing victims to use attacker-controlled or known session IDs and then waiting for them to log in, after which the attacker reuses the same session.

The attacker typically does not need the victim's credentials. The attacker needs to control or know the victim's session ID and then rely on the victim to authenticate, turning that session into an authenticated one.

The most robust fix is to regenerate the session identifier on every successful login (and on privilege elevation), invalidating the previous session and ensuring that any pre-authentication session ID cannot become an authenticated session.

Adopt a standard session management pattern that mandates session regeneration on authentication, enforce code review checks around login flows, and incorporate automated tests and security scans that validate correct session lifecycle behavior.

Find out what's already
exploitable in your codebase.