GHSA-96f7-78q5-j345: Unauthenticated WebSocket connection flooding on /notifications/anonymous-hub (resource-exhaustion DoS)
- Published:
- Fetched:
- Updated:
- Affects:
- dani-garcia vaultwarden
https://github.com/dani-garcia/vaultwarden/security/advisories/GHSA-96f7-78q5-j345 ↗
Unauthenticated WebSocket connection flooding on /notifications/anonymous-hub (resource-exhaustion DoS) # Unauthenticated WebSocket connection flooding on `/notifications/anonymous-hub` (resource-exhaustion DoS) ## Summary The anonymous notifications WebSocket endpoint `GET /notifications/anonymous-hub?token=<...>` accepts and upgrades WebSocket connections **without any authentication and without any connection/rate limit**. Each accepted connection allocates a long-lived async task, an mpsc channel, a global-map entry, a periodic timer and a socket/file descriptor, and stays open indefinitely. A single unauthenticated client can therefore open an unbounded number of persistent connections and exhaust server resources (tasks, memory, file descriptors), degrading or denying the notifications/live-sync service — including the passwordless-login notification channel — for all users. A secondary issue: the global subscription map is keyed by the **client-supplied `token`** and uses last-writer-wins `insert`, allowing a client to overwrite (evict) another subscriber that used the same token. ## Affected version - **Vaultwarden 1.36.0 and earlier** (confirmed on 1.36.0, git `f21a3ada`); the endpoint dates back to login-with-device support. - Fixed in **1.37.0**. ## Details Source: `src/api/notifications.rs` (1.36.0) ```rust #[get("/anonymous-hub?")] // line 190 — NO auth guard fn anonymous_websockets_hub<'r>(ws: WebSocket, token: String, ip: ClientIp) -> Result { ... let (tx, rx) = tokio::sync::mpsc::channel::(100); // per-conn channel (buffer 100) subscriptions.map.insert(token.clone(), tx); // global DashMap, attacker-chosen key ... // rocket_ws::Stream! { ... interval(Duration::from_secs(15)) ... } // per-conn task + 15s keep-alive timer } ``` Contrast with the **authenticated** hub `websockets_hub` (line 107), which validates the token via `crate::auth::decode_login(&token)` before accepting. `anonymous_websockets_hub` performs no such validation — `token` is an arbitrary attacker-controlled string that is never checked and is used directly as the subscription-map key. Per accepted connection the server allocates: - one Tokio task running the stream loop, - one `tokio::sync::mpsc` channel (capacity 100 `Message`s), - one entry in the process-global `WS_ANONYMOUS_SUBSCRIPTIONS` `DashMap`, - one 15-second `tokio::time::interval` timer (keep-alive ping → no idle timeout closes the socket), - one TCP/TLS socket + file descriptor. There is **no authentication, no per-IP connection cap, and no global cap** on these connections. ## Proof of Concept Tested against a stock `vaultwarden/server:1.36.0` container (default config), no credentials used. **1. A single unauthenticated connection is upgraded (arbitrary token, no `Authorization`):** ```bash curl -sk -i --http1.1 \ -H "Connection: Upgrade" -H "Upgrade: websocket" \ -H "Sec-WebSocket-Version: 13" -H "S Affected packages: rust:vaultwarden Patched: vaultwarden 1.37.0