GHSA-XX4J-W367-7247

Vulnerability from github – Published: 2026-08-25 16:06 – Updated: 2026-08-25 16:06
VLAI
Summary
djust authentication bypass: a login_required / on_mount LiveView mount redirect does not close the WebSocket, allowing an unauthenticated client to dispatch event-handler calls
Details

Impact

djust's LiveViewConsumer mounts a LiveView over a WebSocket. When a view is gated (login_required / permission_required, or an on_mount 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.view_instance. 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 handle_event did not re-check authentication/authorization after mount, that client could then send {"type":"event", ...} frames and invoke any @event_handler 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 login_required / permission_required / a redirecting on_mount 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 on_mount-hook-redirect branches of handle_mount now send the navigate frame and then close(code=4403) and clear self.view_instance, mirroring the existing PermissionDenied branch. Public / authorized mounts are unchanged. The same path is reachable via handle_live_redirect_mount (which delegates to handle_mount) and is covered by the same fix.

1.0.4 also adds an opt-in defense-in-depth control, LIVEVIEW_CONFIG['reauth_on_event'] = 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 @event_handler on a gated LiveView independently verifies the request user is authenticated and authorized (e.g. check request.user.is_authenticated / 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 handle_mount to await self.close(code=4403) after emitting an auth redirect.

Proof of concept

Using Channels' WebsocketCommunicator against LiveViewConsumer.as_asgi() with an anonymous scope, mount a login_required view: the server emits a navigate frame but the socket stays open. Sending a subsequent {"type":"event", "handler":"<mutating_handler>", ...} 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/test_ws_auth_close_socket.py.)

Credits

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

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "djust"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.0.4"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-55571"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-285",
      "CWE-306"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-08-25T16:06:31Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "### Impact\n\ndjust\u0027s `LiveViewConsumer` mounts a `LiveView` over a WebSocket. When a view is gated (`login_required` / `permission_required`, or an `on_mount` 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 `return`ed \u2014 **without closing the socket and without clearing `self.view_instance`**. Only the `PermissionDenied` branch closed the connection (`close(4403)`).\n\nA 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 `handle_event` did not re-check authentication/authorization after mount, that client could then send `{\"type\":\"event\", ...}` frames and invoke any `@event_handler` method on the gated view **with no authenticated session** \u2014 an authentication bypass on the live mutation path.\n\n**Who is affected:** apps that expose `LiveView`s gated by `login_required` / `permission_required` / a redirecting `on_mount` hook, where the gated view\u0027s 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.\n\n### Patches\n\nFixed in **djust 1.0.4** (commit `1ae8aa9`, PR #1780). Both the auth-redirect and `on_mount`-hook-redirect branches of `handle_mount` now send the navigate frame **and then `close(code=4403)` and clear `self.view_instance`**, mirroring the existing `PermissionDenied` branch. Public / authorized mounts are unchanged. The same path is reachable via `handle_live_redirect_mount` (which delegates to `handle_mount`) and is covered by the same fix.\n\n1.0.4 also adds an opt-in defense-in-depth control, `LIVEVIEW_CONFIG[\u0027reauth_on_event\u0027] = True` (default OFF), which re-resolves the user from the session and re-runs the view\u0027s auth check on **every** event for gated views.\n\n### Workarounds\n\nUpgrade to 1.0.4. If you cannot upgrade immediately, on affected versions ensure that **every `@event_handler` on a gated `LiveView` independently verifies the request user is authenticated and authorized** (e.g. check `request.user.is_authenticated` / permissions at the top of each handler), since the framework does not re-check after mount on `\u003c 1.0.4`. Alternatively, override the consumer\u0027s `handle_mount` to `await self.close(code=4403)` after emitting an auth redirect.\n\n### Proof of concept\n\nUsing Channels\u0027 `WebsocketCommunicator` against `LiveViewConsumer.as_asgi()` with an **anonymous** scope, mount a `login_required` view: the server emits a `navigate` frame but the socket stays open. Sending a subsequent `{\"type\":\"event\", \"handler\":\"\u003cmutating_handler\u003e\", ...}` 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/test_ws_auth_close_socket.py`.)\n\n### Credits\n\nDiscovered internally during the djust v1.1.0 WebSocket-auth security review.",
  "id": "GHSA-xx4j-w367-7247",
  "modified": "2026-08-25T16:06:32Z",
  "published": "2026-08-25T16:06:31Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/djust-org/djust/security/advisories/GHSA-xx4j-w367-7247"
    },
    {
      "type": "WEB",
      "url": "https://github.com/djust-org/djust/pull/1780"
    },
    {
      "type": "WEB",
      "url": "https://github.com/djust-org/djust/commit/1ae8aa9246b80477de7ddc4d90319a3b267bef04"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/djust-org/djust"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "djust authentication bypass: a login_required / on_mount LiveView mount redirect does not close the WebSocket, allowing an unauthenticated client to dispatch event-handler calls"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…

Loading…