-Infinity
0

Vendor Risk Score

See how djust compares to other vendors in security performance

View Risk Score →
Severity
7.7
AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N

Impact djust.tenants isolation was enforced only on the HTTP path. The current tenant was stored in threading.local() and set exclusively by the HTTP-only TenantMiddleware, so on the live (WebSocket/SSE) path getcurrenttenant() was always None during mount and every event handler — and the tenant-aware QuerySet manager failed OPEN (returned the unfiltered queryset, ignoring STRICTMODE), disclosing every tenant's rows to whoever held the socket. threading.local was additionally shared across connections on the synctoasync executor thread.

Patches Fixed in djust 1.0.7. Tenant storage moved to a contextvars.ContextVar (per async task); the resolved tenant is bound around WS/SSE mount and every dispatch; both managers scope the base queryset once and fail CLOSED (.none() under the default STRICTMODE); and system check S006 warns when STRICTMODE=False.

Workarounds No workaround on the live path short of upgrading.

1 / 2
Source: GitHub
First published (updated )

Impact djust.mixins.modelbinding.ModelBindingMixin provides a default updatemodel event handler and is part of the LiveView base MRO, so every LiveView exposes it. It setattrs a view attribute whose name is client-supplied (field), gated only by: reject -prefixed names; reject a 14-entry denylist of framework internals (FORBIDDENMODELFIELDS); optional allowedmodelfields which defaults to None = allow all; and hasattr existence.

Result: a client can set any public, existing view attribute — not just the fields actually bound with dj-model= in the rendered template. The denylist covers framework plumbing but nothing about developer business/authz state, and the allowlist is opt-in (off by default). A developer who binds one dj-model="search" input and also keeps self.accountid / self.isadmin / self.totalprice as view state does not realize a client can set ALL of them via {type:event, event:"updatemodel", params:{field, value}} over the WebSocket. Type coercion matches the target attribute's type (so "true" -> bool True), aiding the attacker.

Severity High for apps that hold authorization/ownership/business state in public view attributes (the normal djust pattern) -> state tampering / IDOR / authz-flag manipulation; Low otherwise. Default-on across every LiveView. For a public (no-login) view an anonymous client can mass-assign; for an authenticated view a logged-in user can tamper their own session's view state (the IDOR/authz vector when downstream handlers act on it without re-authorizing).

Reproduced: a view with accountid/isadmin/totalprice (none bound with dj-model) had all three set via updatemodel calls.

Patches Restrict the default handler to fields actually exposed via dj-model=: have the template renderer record the bound-field set per render and reject any field outside it (preferred, secure + zero-config); or make allowedmodelfields fail-closed (required). Keep FORBIDDENMODELFIELDS only as defense-in-depth. Add a regression that a non-dj-model public attribute (e.g. isadmin) is rejected while a bound field still updates.

Workarounds Set allowedmodelfields explicitly on every view using dj-model (or subclassing LiveView) to the minimal list of bindable fields; do not keep authorization/ownership state in public view attributes that share the view with dj-model bindings.

References Reproducer + finding writeup retained privately by the maintainer.

1 / 2
Source: GitHub
First published (updated )
Severity
8.2
AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N

Impact

djust's LiveViewConsumer mounts a LiveView over a WebSocket. When a view is gated (loginrequired / permissionrequired, or an onmount hook that returns a redirect) and the connecting user is not authorized, the consumer sent the client a {"type":"navigate","to":...} redirect frame and then returned — without closing the socket and without clearing self.viewinstance. Only the PermissionDenied branch closed the connection (close(4403)).

A real browser obeys the navigate frame and leaves, hiding the problem. A raw WebSocket client that ignores the redirect keeps an open, mounted socket. Because handleevent did not re-check authentication/authorization after mount, that client could then send {"type":"event", ...} frames and invoke any @eventhandler method on the gated view with no authenticated session — an authentication bypass on the live mutation path.

Who is affected: apps that expose LiveViews gated by loginrequired / permissionrequired / a redirecting onmount hook, where the gated view's event handlers perform sensitive reads or mutations and do not independently re-verify the user. Exploitation requires a non-browser WebSocket client and knowledge (or enumeration) of the view path and event names.

Patches

Fixed in djust 1.0.4 (commit 1ae8aa9, PR #1780). Both the auth-redirect and onmount-hook-redirect branches of handlemount now send the navigate frame and then close(code=4403) and clear self.viewinstance, mirroring the existing PermissionDenied branch. Public / authorized mounts are unchanged. The same path is reachable via handleliveredirectmount (which delegates to handlemount) and is covered by the same fix.

1.0.4 also adds an opt-in defense-in-depth control, LIVEVIEWCONFIG['reauthonevent'] = True (default OFF), which re-resolves the user from the session and re-runs the view's auth check on every event for gated views.

Workarounds

Upgrade to 1.0.4. If you cannot upgrade immediately, on affected versions ensure that every @eventhandler on a gated LiveView independently verifies the request user is authenticated and authorized (e.g. check request.user.isauthenticated / permissions at the top of each handler), since the framework does not re-check after mount on < 1.0.4. Alternatively, override the consumer's handlemount to await self.close(code=4403) after emitting an auth redirect.

Proof of concept

Using Channels' WebsocketCommunicator against LiveViewConsumer.asasgi() with an anonymous scope, mount a loginrequired view: the server emits a navigate frame but the socket stays open. Sending a subsequent {"type":"event", "handler":"<mutatinghandler>", ...} frame reaches the handler and executes it without an authenticated session. On 1.0.4 the socket is closed with code 4403 immediately after the redirect and the event frame is rejected. (Regression test: tests/testwsauthclosesocket.py.)

Credits

Discovered internally during the djust v1.1.0 WebSocket-auth security review.

1 / 2
Source: GitHub
First published (updated )

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203