Summary
A broken access control vulnerability in djust allows a LiveView WebSocket connection to remain mounted after authentication or authorization denies the initial mount. A client that ignores the redirect may then invoke event handlers without a valid authenticated session, potentially accessing sensitive data or performing unauthorized mutations.
Affected context
The issue occurs in djust deployments using LiveView WebSocket connections where a mount is denied by login-required checks, permission-required checks, or a redirecting on_mount hook. The risk is present when the server sends a navigation frame but does not close the WebSocket, clear the associated view instance, or repeat authorization checks before processing later event frames.
Exploit preconditions
- Attack surface: LiveView WebSocket event handling
- Required access: Ability to establish or retain a WebSocket connection and send protocol messages
- Trigger point: A denied LiveView mount followed by event processing on the still-mounted connection
- Why exploitation is possible: The connection remains usable after a failed authorization decision, and event handlers do not independently recheck authentication or authorization
Why this happens
The vulnerability results from treating a redirect response as sufficient enforcement of an authorization decision. After a mount is denied, the server sends a navigation frame but retains connection and view state, while subsequent event handling trusts that state without revalidating the user's authentication or permissions. This maps primarily to CWE-285: Improper Authorization; the missing authentication enforcement also relates to CWE-306: Missing Authentication for Critical Function.
Potential impact
- Unauthorized users may read sensitive application data
- Attackers could invoke protected event-handler operations
- Unauthorized mutations may alter application state
- Sensitive workflows could be triggered without the intended session controls
- Affected applications may experience confidentiality or integrity loss
General mitigation guidance
Mitigation generally focuses on making authorization state terminal and enforcing it at every sensitive operation.
Common defensive patterns include:
- Close or invalidate WebSocket connections when a mount is rejected
- Clear view and session state associated with failed mounts
- Recheck authentication and authorization before dispatching every protected event
- Apply server-side authorization inside event handlers rather than relying on client redirects
- Use deny-by-default policies and least-privilege permissions for LiveView actions
- Treat client navigation frames as user-interface behavior, not as an access-control boundary
How teams detect issues like this
Organizations can look for:
- Static analysis patterns where denied authentication or authorization paths return without terminating a session or connection
- Event dispatch code that invokes handlers without an authentication or permission check
- Code review signals showing reliance on client-side redirects to enforce server-side access control
- Integration tests that send events after denied mounts and verify connection invalidation and authorization enforcement
- Policy checks requiring authorization at sensitive handler boundaries
Automated security review tools may help identify missing checks, state-clearing gaps, and inconsistent enforcement across WebSocket message types.

