VYPR
High severityNVD Advisory· Published Dec 9, 2024· Updated Dec 10, 2024

Directus allows unauthenticated access to WebSocket events and operations

CVE-2024-54151

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.

PackageAffected versionsPatched versions
directusnpm
>= 11.0.0, < 11.3.011.3.0
@directus/apinpm
>= 22.2.0, < 23.2.023.2.0

Affected products

1

Patches

1
ce0397d16cf7

Merge commit from fork (#24108)

https://github.com/directus/directusBrainslugNov 27, 2024via ghsa
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

News mentions

0

No linked articles in our index yet.