/

CVE-2026-56104

Severity:

HIGH RISK

(8.2)

Missing AuthZ in WebSocket Session Restore for Chainlit

CVE-2026-56104

Deferred

Vulnerability type

Category:

Missing Authorization

CWE:

CWE-862

Impact:

Session Hijacking and Privilege Inheritance

Severity:

HIGH RISK

(8.2)

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

Chainlit contains a session hijacking flaw where WebSocket session restoration accepts any valid sessionId without verifying that the requester owns that session.

An unauthenticated attacker who can obtain or guess a victim's session identifier may inherit the victim's authenticated context, gaining access to restricted tools, data, and permissions during that restored session.

Affected context

This vulnerability affects Chainlit deployments that expose WebSocket-based session restoration mechanisms to clients.

It becomes relevant when the restore_existing_session path is used and session identifiers can be reused without strict ownership checks or binding to a specific client.

Environments where session IDs are long-lived, predictable, or observable in logs, URLs, or client storage are more susceptible, as attackers may more easily obtain a valid identifier.

Exploit preconditions

  • Attack surface: Public or internal Chainlit WebSocket endpoint that supports restore_existing_session.
  • Required access: Network access to the application, along with knowledge or successful guessing of a valid sessionId belonging to a victim.
  • Trigger point: Initiating a WebSocket connection and invoking the session restore flow while presenting a victim's sessionId.
  • Why exploitation is possible: The server does not enforce authorization or ownership verification for the provided sessionId, allowing a new client to attach to an existing authenticated session and inherit its roles and permissions.

Why this happens

The underlying issue stems from missing authorization checks when restoring sessions over WebSockets.

The implementation accepts a sessionId as sufficient proof of identity, failing to confirm that the caller is the legitimate owner or that the session is bound to a stable authentication context.

This maps to CWE-862: Missing Authorization, where sensitive operations—in this case, session restoration and permission inheritance—are performed without validating that the requester is authorized to assume the session's identity and privileges.

Potential impact

  • Attackers may hijack active user sessions and act as the victim.
  • Unauthorized invocation of privileged tools or actions restricted to the authenticated user.
  • Access to conversation history, outputs, and data that the victim can see but others should not.
  • Escalation of privileges if the victim holds elevated roles or administrative capabilities.
  • Abuse of integrated systems (APIs, databases, external tools) via the victim's authenticated context.

General mitigation guidance

Effective mitigation focuses on enforcing strong authorization and context binding around session restoration actions.

Common secure patterns include:

  • Treating session restore as a privileged operation that requires a fresh authentication check or a proven, bound identity (e.g., token linked to a user account).
  • Binding sessions to client-specific attributes (such as authenticated user ID, device or token fingerprint) rather than accepting bare sessionIds.
  • Designing session tokens to be opaque, unguessable, and short-lived, and never using them as the sole proof of identity during restoration flows.
  • Minimizing the scope of what a restored session can access, using least-privilege defaults and separate, more constrained contexts for tool invocations.
  • Applying defense-in-depth controls such as secondary checks before executing high-impact tools or accessing sensitive data, even from an apparently valid session.

How teams detect issues like this

Detection often relies on identifying insecure authorization patterns and anomalous session behavior.

Useful strategies include:

  • Static and manual code review focused on WebSocket handlers and session management logic, verifying that restore endpoints perform ownership checks tied to an authenticated principal.
  • Policy-based linting or automated analysis to flag flows where session identifiers are trusted without additional identity verification.
  • Runtime logging and monitoring of session restoration events, including user IDs, IP addresses, device identifiers, and timestamps, to detect unusual cross-user reuse of sessionIds.
  • Behavioral anomaly detection that looks for multiple distinct clients attaching to the same sessionId or rapid switching of user contexts within a single connection.
  • Incorporating automated security review tools in CI pipelines to highlight missing authorization checks on endpoints that modify or reattach to sessions.

Sources

SourceLink
github.comgithub.com/Chainlit/chainlit/commit/5effb664f1e0af4a4f0a42fe63ea979676039a7f
github.comgithub.com/Chainlit/chainlit/pull/2857
github.comgithub.com/Chainlit/chainlit/releases/tag/2.10.1
vulncheck.comvulncheck.com/advisories/chainlit-session-hijacking-via-websocket-session-restoration

Frequently asked

questions

Exploitability depends on how easily an attacker can obtain valid session identifiers and reach the WebSocket endpoint. In environments where sessionIds are exposed (e.g., in logs, URLs, or shared devices) or insufficiently protected, attackers can more readily hijack sessions and act as authenticated users.

An attacker needs network access to the Chainlit WebSocket interface and possession or successful guessing of a valid sessionId belonging to a target user. No prior authentication is required if the restore path accepts unauthenticated callers.

The safest pattern is to treat session restoration as a strictly authorized operation: require a verified user identity, bind sessions to that identity, and ensure only the legitimate account holder can restore or reattach to a session. Bare sessionIds should never be accepted as sufficient proof of ownership.

Future designs should adopt explicit authorization checks on all state-changing and identity-related operations, including session creation and restoration. Use robust authentication tokens, bind sessions to user accounts and contextual attributes, apply least-privilege defaults, and enforce security reviews for any endpoint that attaches a client to an existing session or permission set.

Find out what's already
exploitable in your codebase.