CVE-2024-54151: Directus allows unauthenticated access to WebSocket events and operations
Summary When setting WEBSOCKETSGRAPHQLAUTH or WEBSOCKETSRESTAUTH to "public", an unauthenticated user is able to do any of the supported operations (CRUD, subscriptions) with full admin privileges.
Details Accountability for unauthenticated WebSocket requests is set to null, which used to be "public permissions" until the Permissions Policy update which now defaults that to system/admin level access. So instead of null we need to make use of createDefaultAccountability() to ensure public permissions are used for unauthenticated users.
PoC 1. Start directus with bash WEBSOCKETSENABLED=true WEBSOCKETSGRAPHQLAUTH=public WEBSOCKETSRESTAUTH=public
2. Subscribe using GQL or REST or do any CRUD operation on a user created collection (system tables are not reachable with crud) gql subscription { directususersmutated { key event data { id email firstname lastname password } } } or json { "type": "items", "action": "read", "collection": "yourcollectionname" } 3a. Open up the data studio as any user. Observe how the subscriber gets notified on each page navigation (because the users lastpage gets updated, the password fields is properly redacted here)
3b. Observe receiving all available items from the yourcollectionname collection.
Impact
This impacts any Directus instance that has either WEBSOCKETSGRAPHQLAUTH or WEBSOCKETSRESTAUTH set to public allowing unauthenticated users to subscribe for changes on any collection or do REST CRUD operations on user defined collections ignoring permissions.
Other sources
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 WEBSOCKETSGRAPHQLAUTH or WEBSOCKETSRESTAUTH 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 WEBSOCKETSGRAPHQLAUTH or WEBSOCKETSRESTAUTH 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.
— NVD
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-54151?
CVE-2024-54151 has a significant severity level, as it allows unauthenticated users to perform CRUD operations with full admin privileges.
What software versions are affected by CVE-2024-54151?
CVE-2024-54151 affects @directus/api versions from 22.2.0 to 23.2.0 and directus versions from 11.0.0 to 11.3.0.
How do I fix CVE-2024-54151?
To mitigate CVE-2024-54151, upgrade @directus/api to version 23.2.0 or directus to version 11.3.0.
Can CVE-2024-54151 be exploited remotely?
Yes, CVE-2024-54151 can be exploited remotely by an unauthenticated user if the WebSocket authentication settings are misconfigured.
What are the risks of leaving CVE-2024-54151 unpatched?
Leaving CVE-2024-54151 unpatched exposes your application to unauthorized access and potential data manipulation by unauthenticated users.