Summary
Leantime's OIDC login flow contains a CSRF vulnerability where the verifyState() method unconditionally returns true without validating the state parameter.
An attacker can abuse this flaw by crafting malicious callback URLs with attacker-controlled authorization codes, potentially forcing users into a session fixation scenario and logging victims in as the attacker.
Affected context
This vulnerability occurs within Leantime's OpenID Connect (OIDC) authentication integration when the application relies on the verifyState() method to confirm the integrity of the OIDC login response.
It becomes relevant in deployments where:
- OIDC is enabled for user authentication
- The application processes authorization code callbacks from an identity provider
- The state parameter is expected to provide CSRF protection during the login handshake
Exploit preconditions
- Attack surface: The OIDC callback endpoint that processes authorization codes and state parameters.
- Required access: Ability to induce a victim's browser to follow a crafted OIDC callback URL (e.g., via a link, iframe, redirect, or injected content).
- Trigger point: The victim's browser sends the attacker-crafted callback request to the Leantime OIDC endpoint, invoking verifyState().
- Why exploitation is possible: The verifyState() method returns true without validating the state parameter, neutralizing the CSRF protection that should bind an OIDC login response to a specific user-initiated request.
Why this happens
The root cause is the omission of state parameter validation in the OIDC login CSRF protection logic.
Instead of verifying that the returned state matches a server-side, user-specific value created during the initial login request, verifyState() always returns true.
This aligns with CWE-352: Cross-Site Request Forgery, as the application accepts a sensitive authentication action triggered through a forged request lacking proper anti-CSRF checks.
Potential impact
- Attackers may fix victim sessions to authenticated states tied to attacker-controlled accounts.
- Victims could be silently logged in as the attacker, enabling account impersonation.
- Application audit trails and activity logs can become misleading due to session confusion.
- Follow-on attacks may include data exposure, configuration tampering, or misuse of project resources under the victim's identity.
General mitigation guidance
Effective mitigation focuses on restoring robust CSRF protections within the OIDC login flow:
- Implement strict state validation by generating cryptographically strong, per-request state values and storing them server-side or in a secure client-bound context.
- Ensure the verifyState() method compares the returned state to the expected value and rejects mismatches or missing states.
- Couple the state parameter to the user's session and intended action, preventing reuse or sharing across users or requests.
- Prefer secure-by-default OIDC/OAuth client libraries that handle CSRF and state validation automatically, reducing the chance of custom logic errors.
- Minimize session fixation risk by regenerating session identifiers on successful login and avoiding reuse of pre-authentication sessions.
How teams detect issues like this
Detection commonly centers on reviewing authentication flows and CSRF defenses:
- Static analysis rules that flag authentication or OIDC code paths where state parameters are not validated or are ignored.
- Code reviews focused on login and callback handlers, checking that state and other anti-CSRF tokens are compared against server-side expectations.
- Security policies requiring use of vetted OIDC/OAuth client libraries and prohibiting custom token/state handling without peer review.
- Automated tests or security checks that simulate forged OIDC callbacks and verify that the application correctly rejects unauthenticated or mismatched responses.

