Summary
SiYuan's login CAPTCHA flow can allow a solved challenge to be reused because the challenge state is carried in a signed client-side cookie. An attacker who can replay that cookie with different incorrect access codes may bypass the intended CAPTCHA limit and eventually obtain an administrator session.
Affected context
The issue occurs in SiYuan's loginAuth CAPTCHA and access-code authentication flow. It is relevant when the client-side cookie preserves a solved CAPTCHA challenge and the server accepts that same signed cookie across multiple access-code attempts without reliably invalidating or limiting its reuse. The supplied description identifies SiYuan versions before 3.8.9 as affected.
Exploit preconditions
- Attack surface: The SiYuan login authentication endpoint
- Required access: Ability to reach the login flow and retain or replay the signed CAPTCHA cookie
- Trigger point: Submitting access-code attempts while replaying a cookie associated with a solved CAPTCHA challenge
- Why exploitation is possible: The solved challenge can be reused, weakening the CAPTCHA's role in limiting repeated guesses
Why this happens
The authentication flow relies on signed client-side state to represent a solved CAPTCHA challenge but does not sufficiently prevent that state from being replayed across distinct access-code attempts. A valid signature protects the cookie from tampering, but does not by itself make the challenge single-use or enforce attempt limits. This is an authentication rate-limiting weakness mapped to CWE-307: Improper Restriction of Excessive Authentication Attempts.
Potential impact
- An attacker may make repeated access-code guesses despite the CAPTCHA
- Successful guessing could lead to an administrator session
- Administrative access could allow changes to content, settings, or other accessible resources
- Repeated attempts could increase the risk of account or service abuse
General mitigation guidance
Mitigation generally focuses on enforcing authentication limits on the server rather than relying on reusable client-side challenge state.
Common defensive patterns include:
- Making CAPTCHA challenges single-use and invalidating them after an attempt
- Binding challenge state to the relevant authentication attempt and enforcing expiry
- Applying server-side rate limits and progressive delays to failed access-code attempts
- Using secure-by-default authentication controls that do not depend on client-held state for attempt counting
- Limiting the permissions and exposure of administrative accounts and interfaces
How teams detect issues like this
Useful detection approaches include:
- Reviewing authentication code for reusable CAPTCHA tokens or challenge state
- Checking whether failed attempts are counted and rate-limited on the server
- Monitoring for repeated access-code failures associated with the same client or challenge
- Enforcing policies that require single-use, expiring authentication challenges and server-side throttling
Static analysis and automated code review may help identify weak attempt controls, though replay behavior may require targeted testing.

