Summary
SiYuan versions before 3.7.4 contain an authentication bypass in a WebSocket endpoint caused by inconsistent parsing of duplicated query parameters. An unauthenticated attacker may exploit this behavior to bypass access-code validation and receive live kernel event data, including document identifiers, titles, and operation logs.
Affected context
The vulnerability occurs in SiYuan deployments that expose the affected WebSocket endpoint and rely on query parameters for access-code validation and session quarantine decisions. Risk is increased when the endpoint is reachable by untrusted clients and the application processes duplicated query parameters differently across authentication-related checks.
Exploit preconditions
- Attack surface: The SiYuan WebSocket endpoint
- Required access: Network access to the endpoint; valid authentication is not necessarily required
- Trigger point: WebSocket connection handling involving duplicated query parameters
- Why exploitation is possible: Authentication exemption and session quarantine logic interpret the same query parameters inconsistently, allowing access-code validation to be bypassed
Why this happens
The underlying defect is inconsistent normalization and interpretation of repeated query parameters across security-sensitive request checks. One component may use one occurrence of a parameter while another component uses a different occurrence, causing authentication decisions to diverge.
This behavior maps to CWE-287: Improper Authentication, because the application does not consistently establish that a client is authorized before granting access to protected WebSocket data.
Potential impact
- An unauthenticated user may receive live kernel event streams
- Document identifiers and titles could be disclosed
- Operation logs may be exposed to unauthorized parties
- Attackers could use disclosed metadata to improve targeting of the SiYuan instance
- Security monitoring and privacy expectations could be weakened
General mitigation guidance
Mitigation generally focuses on making authentication decisions consistent, deterministic, and independent of ambiguous parameter representations.
Common defensive patterns include:
- Rejecting duplicate security-sensitive query parameters rather than selecting one implicitly
- Canonicalizing request parameters once before authentication and authorization checks
- Applying the same parsed representation to access-code, session, and quarantine logic
- Requiring authentication through a secure, unambiguous mechanism for WebSocket connections
- Limiting WebSocket exposure to trusted networks or authenticated reverse-proxy paths
- Applying least-privilege access to event streams and minimizing sensitive data in operational messages
How teams detect issues like this
Detection approaches may include:
- Static analysis and code review for repeated query-parameter access in authentication or authorization paths
- Tests covering duplicate, reordered, empty, and conflicting security-related parameters
- Policy checks requiring canonical request parsing before security decisions
- Web application firewall or gateway rules that reject ambiguous duplicate parameters where compatible
- Monitoring for unauthenticated WebSocket connections and unusual subscriptions to kernel event streams
- Automated security review tools that flag inconsistent parameter handling across request-validation stages

