Summary
Relay Server versions 0.9.0 through 0.9.6 contain an authentication bypass in multi-document WebSocket endpoints used for Obsidian real-time collaboration.
When authentication was enabled, WebSocket connections missing the token query parameter were mistakenly granted full server permissions, allowing any network attacker who knew or guessed a document ID to connect to the sync channel and read or modify document contents without a valid token.
Affected context
This vulnerability affects Relay Server deployments that:
- Use versions 0.9.0 through 0.9.6
- Have authentication configured for multi-document collaboration
- Expose the document sync WebSocket endpoints to a network where untrusted clients may exist
The issue specifically occurs on multi-document WebSocket endpoints where the presence of a token query parameter is expected but not enforced, causing some unauthenticated connections to be treated as fully authorized for document operations.
Exploit preconditions
- Attack surface: Network-accessible WebSocket endpoints for document synchronization.
- Required access: Ability to open a WebSocket connection to the Relay Server (e.g., same LAN, VPN, or internet exposure).
- Authentication state: Authentication is configured, but the server does not correctly enforce token presence on certain endpoints.
- Knowledge required: Knowledge or guessing of a valid document ID or identifier used by the sync endpoint.
- Trigger point: Initiating a WebSocket connection to the multi-document sync endpoint without a token query parameter.
- Why exploitation is possible: The server's authorization logic incorrectly treats missing token parameters as fully authorized, effectively bypassing the intended access control checks for those connections.
Why this happens
The underlying issue is a flawed authorization check in the multi-document WebSocket handling logic.
Instead of strictly requiring and validating a token query parameter for every connection, the code path handling these WebSocket requests incorrectly defaulted missing tokens to a state equivalent to full permissions.
This maps to CWE-639: Insecure Direct Object Reference (IDOR) and CWE-863: Incorrect Authorization, where access to protected resources (documents) is granted based solely on knowledge of an identifier and a misconfigured authorization gate, rather than on properly validated credentials and scoped token checks.
Conceptually, the bug reflects an insecure assumption that if a token parameter is not supplied, the connection should be treated as trusted, bypassing the checks that should link a user's identity to specific document permissions.
Potential impact
- Unauthorized reading of document contents by any network attacker who can reach the Relay Server and knows or guesses document IDs.
- Unauthorized modification or deletion of document content via the sync channel.
- Integrity compromise of shared notes, leading to misinformation, data corruption, or silent content tampering.
- Potential exposure of sensitive information stored in collaborative documents, including credentials, personal data, or internal project details.
- Disruption of real-time collaboration sessions and potential denial-of-service against specific documents through malicious edits.
General mitigation guidance
Effective mitigation focuses on enforcing strict, explicit authorization for every WebSocket connection and removing any "fail-open" behavior.
Recommended defensive patterns include:
- Mandatory token enforcement: Require a valid, non-empty token parameter on all document sync WebSocket endpoints, and treat missing or malformed tokens as an immediate failure with no default privileges.
- Least-privilege token design: Use tokens that encode scoped permissions (e.g., read-only vs. read/write) and validate that the token grants access to the specific document or workspace being synced.
- Strong identifier handling: Avoid treating knowledge of a document ID as sufficient for access; all document operations should be gated through centralized authorization checks independent of user-controlled identifiers.
- Secure defaults: Design authorization logic to fail closed (deny by default) when any ambiguity exists in authentication or token parsing.
- Network hardening: Where feasible, restrict Relay Server exposure with network controls (VPN, firewall rules, reverse proxies with auth) to reduce unauthenticated attack surface for collaboration endpoints.
How teams detect issues like this
Detection can focus on both code-level patterns and runtime behavior:
- Static analysis and code review:
- Flag WebSocket handlers or routing paths that access protected resources without explicit, centralized authorization checks.
- Review for conditional logic that "falls back" to full access when a token or credential field is missing or null.
- Enforce patterns where all document access passes through a common authorization function or middleware.
- Configuration and policy enforcement:
- Define architectural rules that prohibit direct use of document IDs or other resource identifiers without an accompanying authorization check.
- Use automated review tools to scan for endpoints that accept identifiers but do not verify user or token context.
- Runtime monitoring and logging:
- Log WebSocket connection attempts, including presence/absence of tokens and requested document IDs.
- Alert on connections that successfully perform read/write operations without associated authentication or with anomalous token fields.
- Security testing:
- Incorporate WebSocket-focused access control tests into CI/CD (e.g., attempting to connect and operate on document channels without tokens or with invalid tokens).

