Summary
Siyuan versions before v3.7.4 expose the session cookie signing key through an unauthenticated configuration endpoint when running in publish mode. An attacker who obtains this key may forge valid session cookies to impersonate users or gain administrative access.
Affected context
The vulnerability occurs in Siyuan deployments operating in publish mode when the
/api/system/getConf endpoint is accessible without authentication and includes the
CookieKey value in its response. Deployments that expose this endpoint to untrusted
users or the public internet may be at greater risk because the signing key can be
recovered without an existing session.
Exploit preconditions
- Attack surface: The
/api/system/getConfHTTP endpoint - Required access: Network access to the endpoint; authentication may not be required
- Trigger point: Retrieval of configuration data while Siyuan is running in publish mode
- Why exploitation is possible: The response discloses the secret used to sign session cookies, allowing attackers to create cookies that the application may accept as valid
Why this happens
The underlying issue is exposure of a session-signing secret through an endpoint intended
to provide configuration information. This represents CWE-522: Insufficiently Protected Credentials, because a credential-like secret is disclosed to unauthenticated clients.
Once the signing key is exposed, the application's trust in signed session cookies can be
bypassed through forged authentication tokens.
Potential impact
- Attackers may impersonate authenticated users
- Attackers could obtain administrative access
- Active sessions may be forged or hijacked
- Unauthorized users may modify application data or configuration
- Compromise could enable further access to connected systems or stored information
General mitigation guidance
Mitigation generally focuses on preventing secret material from being returned through
public configuration endpoints and reducing the trust placed in exposed credentials.
Common defensive patterns include:
- Returning only explicitly public configuration fields to unauthenticated clients
- Keeping session-signing keys and other secrets outside client-visible responses
- Requiring authentication and authorization for sensitive configuration endpoints
- Rotating session-signing secrets after suspected disclosure
- Invalidating sessions issued under a potentially exposed signing key
- Applying least-privilege access controls and limiting publish-mode exposure
- Using centralized secret management with restricted read permissions
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis and code review rules that flag secret fields in API responses
- Tests verifying that unauthenticated configuration endpoints contain only allowlisted data
- API inventory reviews focused on publish-mode and public deployment surfaces
- Runtime monitoring for unusual access to configuration endpoints
- Detection of anomalous session creation, administrative activity, or authentication from unexpected locations
- Policy enforcement preventing credentials, signing keys, and tokens from entering client-facing responses

