Summary
A session-binding flaw in djust's Server-Sent Events (SSE) transport allows a client-chosen session identifier to be used without confirming the authenticated owner. If an attacker obtains a valid session_id, they may dispatch event handlers under the victim's identity and access the victim's associated application state.
Affected context
The issue occurs in djust deployments that use the SSE transport before the session-binding protections introduced in version 1.0.7. Risk is present when session identifiers can be learned, exposed, or reused and the SSE message endpoint does not verify that the requesting principal owns the referenced session.
Exploit preconditions
- Attack surface: The djust SSE session message endpoint
- Required access: A valid session_id and the ability to make requests to the SSE endpoint
- Trigger point: Dispatch of an event or message against the identified SSE session
- Why exploitation is possible: Session identity is based on a client-supplied identifier without binding it to the authenticated user
Why this happens
The underlying bug is missing session-to-principal binding in the SSE transport. A client-controlled identifier is treated as sufficient to locate and operate on a session, while the authenticated identity is not compared with the session's owner. This maps primarily to CWE-384, Session Fixation, and is also related to CWE-639, Authorization Bypass Through User-Controlled Key, and CWE-862, Missing Authorization.
Potential impact
- An attacker may invoke event handlers using the victim's identity
- Unauthorized changes to application or user state could occur
- Sensitive session-associated data may be exposed
- Repeated or automated session use could increase resource consumption
- Application workflows or business actions could be performed without the victim's intent
General mitigation guidance
Mitigation generally focuses on making session ownership an enforced server-side
security property rather than relying on a client-provided identifier.
Common defensive patterns include:
- Bind every SSE session to the authenticated principal when the session is created
- Verify ownership and authorization on every message or event dispatch
- Reject cross-principal access even when the session identifier is valid
- Use high-entropy, non-predictable session identifiers and avoid exposing them unnecessarily
- Limit the number of active SSE sessions per principal
- Apply least privilege to event handlers and the state they can modify
- Disable the SSE transport where secure session binding cannot be guaranteed
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis and code review checks for session lookups driven solely by request parameters
- Review signals showing that session identifiers are accepted without an owner or principal comparison
- Tests that attempt to use one authenticated user's session identifier from another account
- Authorization policy checks covering SSE connection, message, and event-dispatch paths
- Runtime monitoring for cross-user session access attempts and unusual event activity
- Automated security tests that verify session ownership across all supported transports

