Summary
A transport-specific authorization bypass in djust allows WebSocket clients to mount Django views without receiving the authorization checks applied during the initial HTTP request. An anonymous or under-privileged client may therefore access protected live views and invoke handlers, including administrative operations, when HTTP-only authorization patterns are used.
Affected context
The issue occurs in djust applications that expose Django views through the live WebSocket transport while relying on authorization enforced only by Django's HTTP dispatch() chain or an HTTP wrapper. This can include authentication and permission mixins, dispatch decorators, custom dispatch guards, and admin staff checks that are not replayed during WebSocket mounting. The risk depends on whether protected views are reachable through the live transport and whether the client lacks the required identity or privileges.
Exploit preconditions
- Attack surface: djust live WebSocket transport
- Required access: Network access to the application's WebSocket endpoint; authentication may not be required when the protected view permits anonymous HTTP access only through an authorization mismatch
- Trigger point: WebSocket mount followed by event or handler dispatch
- Why exploitation is possible: The WebSocket path uses
check_view_authrather than the complete DjangoView.dispatch()authorization chain, allowing HTTP-only access controls to be bypassed
Why this happens
The underlying bug is an inconsistent authorization model across transport paths. Authorization checks attached to Django's HTTP dispatch chain or an HTTP-only wrapper were enforced for the initial request but were not reproduced when the same view was mounted over WebSocket. This maps primarily to CWE-862: Missing Authorization, with CWE-306: Missing Authentication for Critical Function also relevant where anonymous clients can reach protected functionality. The insecure pattern is trusting a transport-specific authorization check that does not account for all controls defined on the view.
Potential impact
- Unauthorized clients may access protected live views
- Under-privileged users could perform actions reserved for higher-privileged users
- Administrative list, create, change, or delete handlers could be invoked without the intended staff or permission gate
- Sensitive application state could be exposed through WebSocket events
- Application data could be modified or deleted without proper authorization
General mitigation guidance
Mitigation generally focuses on enforcing authorization at the live transport boundary rather than relying on HTTP-only controls.
Common defensive patterns include:
- Use djust authorization attributes such as
login_required,permission_required, andcheck_permissionswhen they are honored consistently across transports - Apply authentication and permission checks before mounting a live view and before dispatching its events
- Treat WebSocket connections as an independent authorization surface rather than inheriting trust from the initial HTTP request
- Define administrative views with an explicit active-staff and permission gate
- Fail closed when authorization patterns cannot be safely replayed across transports
- Run authorization-focused tests for anonymous, authenticated, under-privileged, and administrative users over every supported transport
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis that identifies protected Django views exposed through WebSocket routes without transport-aware authorization attributes
- Code review checks for
LoginRequiredMixin,PermissionRequiredMixin,UserPassesTestMixin, dispatch decorators, or customdispatch()guards used without equivalent live-transport enforcement - Integration tests that attempt WebSocket mounts and privileged events as anonymous and under-privileged users
- Policy checks requiring explicit authentication and authorization declarations for live views
- Runtime logging and alerting for failed or unexpected WebSocket authorization attempts
Automated review tools can help identify inconsistent authorization paths, but transport-level tests are important for validating actual enforcement.

