Directus allows unauthenticated access to WebSocket events and operations
Description
Directus is a real-time API and App dashboard for managing SQL database content. Starting in version 11.0.0 and prior to version 11.3.0, when setting WEBSOCKETS_GRAPHQL_AUTH or WEBSOCKETS_REST_AUTH to "public", an unauthenticated user is able to do any of the supported operations (CRUD, subscriptions) with full admin privileges. This impacts any Directus instance that has either WEBSOCKETS_GRAPHQL_AUTH or WEBSOCKETS_REST_AUTH set to public allowing unauthenticated users to subscribe for changes on any collection or do REST CRUD operations on user defined collections ignoring permissions. Version 11.3.0 fixes the issue.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
directusnpm | >= 11.0.0, < 11.3.0 | 11.3.0 |
@directus/apinpm | >= 22.2.0, < 23.2.0 | 23.2.0 |
Affected products
1Patches
1ce0397d16cf7Merge commit from fork (#24108)
3 files changed · +9 −2
api/src/websocket/controllers/base.ts+2 −1 modified@@ -21,6 +21,7 @@ import type { AuthenticationState, UpgradeContext, WebSocketAuthentication, WebS import { getExpiresAtForToken } from '../utils/get-expires-at-for-token.js'; import { getMessageType } from '../utils/message.js'; import { waitForAnyMessage, waitForMessageType } from '../utils/wait-for-message.js'; +import { createDefaultAccountability } from '../../permissions/utils/create-default-accountability.js'; const TOKEN_CHECK_INTERVAL = 15 * 60 * 1000; // 15 minutes @@ -149,7 +150,7 @@ export default abstract class SocketController { this.server.handleUpgrade(request, socket, head, async (ws) => { this.catchInvalidMessages(ws); - const state = { accountability: null, expires_at: null } as AuthenticationState; + const state = { accountability: createDefaultAccountability(), expires_at: null } as AuthenticationState; this.server.emit('connection', ws, state); }); }
api/src/websocket/controllers/graphql.ts+2 −1 modified@@ -14,6 +14,7 @@ import type { AuthenticationState, GraphQLSocket, UpgradeContext, WebSocketClien import { getMessageType } from '../utils/message.js'; import SocketController from './base.js'; import { registerWebSocketEvents } from './hooks.js'; +import { createDefaultAccountability } from '../../permissions/utils/create-default-accountability.js'; const logger = useLogger(); @@ -117,7 +118,7 @@ export class GraphQLSubscriptionController extends SocketController { protected override async handleHandshakeUpgrade({ request, socket, head }: UpgradeContext) { this.server.handleUpgrade(request, socket, head, async (ws) => { - this.server.emit('connection', ws, { accountability: null, expires_at: null }); + this.server.emit('connection', ws, { accountability: createDefaultAccountability(), expires_at: null }); // actual enforcement is handled by the setTokenExpireTimer function }); }
.changeset/healthy-crews-cover.md+5 −0 added@@ -0,0 +1,5 @@ +--- +'@directus/api': patch +--- + +Fixed unauthenticated data access on a public websocket
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
4- github.com/advisories/GHSA-849r-qrwj-8rv4ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2024-54151ghsaADVISORY
- github.com/directus/directus/commit/ce0397d16cf767b5293cd57f626c5349b5732a21ghsax_refsource_MISCWEB
- github.com/directus/directus/security/advisories/GHSA-849r-qrwj-8rv4ghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.