/

CVE-2026-25221

Severity:

HIGH RISK

(8.1)

CSRF in PolarLearn GitHub/Google Authentication

CVE-2026-25221

Analyzed

Vulnerability type

Category:

Cross-Site Request Forgery (CSRF)

CWE:

CWE-352

Impact:

Account Confusion / Session Fixation via OAuth Login CSRF

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PolarLearn's OAuth 2.0 login integration for GitHub and Google is vulnerable to a login Cross-Site Request Forgery (CSRF) because it fails to implement and verify the state parameter during the authorization flow.

An attacker can pre-authenticate with their own account and then trick a victim into completing the OAuth flow, causing the victim to be logged into the attacker's account and unintentionally store their data and progress there.

Affected context

The vulnerability occurs in PolarLearn's OAuth 2.0 login flow for external identity providers (GitHub and Google).

It appears when the application initiates and completes the OAuth authorization code flow without using a per-request, unguessable state value that is bound to the user's session and verified on callback.

Any deployment using these OAuth logins without additional compensating controls (such as out-of-band confirmation or strict session binding) is potentially affected.

Exploit preconditions

  • Attack surface: Public-facing OAuth login endpoints for GitHub and Google.
  • Required access: Ability to cause the victim's browser to navigate to attacker-controlled URLs or embedded links (e.g., via phishing, malicious website, or injected content).
  • Victim state: Victim not already strongly bound to the intended account context and willing to click or follow a login link.
  • Trigger point: The victim completes the OAuth login flow that was originally initiated and pre-authenticated by the attacker.
  • Why exploitation is possible: The application does not generate, store, and verify a state parameter to confirm that the OAuth callback corresponds to a login flow initiated by the same user, allowing an attacker-initiated flow to be completed by an unsuspecting victim.

Why this happens

This vulnerability stems from an incomplete implementation of the OAuth 2.0 authorization code flow, specifically the omission of the state parameter used as a CSRF token.

In a secure design, the client application generates an unguessable state value tied to the user's session, sends it to the identity provider, and validates the same value on the callback before exchanging the authorization code.

By failing to enforce this pattern, PolarLearn allows cross-site requests to reuse or complete an OAuth flow that was not initiated by the current user.

This aligns with CWE-352: Cross-Site Request Forgery (CSRF) where a web application does not adequately verify that a request is intentionally made by the user, here in the context of a third-party login.

Potential impact

  • Victims can be silently logged into the attacker's PolarLearn account (account confusion).
  • Any academic progress, submissions, or configuration changes made by the victim may be stored on the attacker's account, leading to effective data loss for the victim.
  • The attacker can later access the victim's activity data, including course selections, progress, and potentially personal information entered into the platform.
  • Confusion in audit logs and user tracking, complicating incident investigation and user support.
  • In multi-tenant or classroom scenarios, misattribution of work or grades to the wrong account.

General mitigation guidance

Mitigation centers on enforcing strong request integrity for the OAuth 2.0 login flow and reducing implicit trust in cross-site requests:

  • Generate a cryptographically strong, per-login state value that is bound to the user's browser context (for example, stored in the session or a secure cookie).
  • Send the state parameter with each OAuth authorization request and strictly verify that the same value is returned on the callback before processing the authorization code.
  • Reject OAuth callbacks that lack a state value, contain malformed values, or do not match the stored token.
  • Consider using PKCE and other modern OAuth best practices to strengthen the flow, ensuring parameters are tied to the specific client interaction.
  • Minimize the amount of sensitive state that is inferred solely from login side effects; where appropriate, add in-app confirmation when a new identity is attached to a session.
  • Apply a general CSRF defense strategy (anti-CSRF tokens, SameSite cookies, and clear separation between GET-based navigation and state-changing operations) across the authentication surface.

How teams detect issues like this

Detection relies on a combination of design review, code inspection, and runtime behavior analysis:

  • Code review: Examine the OAuth 2.0 implementation to confirm that:
  • A state parameter is generated for each OAuth login attempt.
  • The value is stored in a user-bound context (session, secure cookie, or equivalent).
  • The callback handler verifies the state value before exchanging the authorization code or creating a session.
  • Static analysis: Configure rules to flag OAuth flows that:
  • Invoke authorization URLs without including a state parameter.
  • Handle OAuth callbacks without validating state against a stored server-side value.
  • Configuration and policy checks: Enforce security guidelines for third-party login integrations, such as requiring state and PKCE for all OAuth providers.
  • Runtime monitoring: Log OAuth login attempts, including presence/absence of state and mismatches, and alert on suspicious patterns (e.g., many logins from different IPs mapping to the same account with missing state).
  • Automated security testing tools or manual penetration testing can simulate login CSRF scenarios to verify that the application rejects flows without proper state validation.

Sources

SourceLink
github.comgithub.com/polarnl/PolarLearn/commit/44669bbb5b647c7625f22dd82f3121c7d7bfbe19
github.comgithub.com/polarnl/PolarLearn/security/advisories/GHSA-fhhm-574m-7rpw

Frequently asked

questions

Yes. An attacker can exploit this issue remotely by hosting a malicious link or page that causes the victim's browser to complete an OAuth login flow that the attacker initiated, without requiring access to the victim's device or network.

The attacker typically needs a valid PolarLearn account to which they want to bind the victim's session, but they do not need access to the victim's account.

The victim does not need to be pre-authenticated; they only need to follow the attacker's crafted login link or be redirected during the OAuth flow.

Implement the OAuth 2.0 state parameter correctly: generate a strong, per-request state token, tie it to the user's session, send it with the authorization request, and strictly validate it on the callback before creating or attaching a session.

Reject any callback where state is missing, invalid, or does not match the stored value.

Adopt a standard, well-reviewed OAuth client library that includes built-in CSRF protection and adhere closely to the OAuth 2.0 and OpenID Connect best practices.

Combine this with a consistent CSRF defense strategy across the application, periodic security reviews of authentication flows, and automated checks that enforce the use of state and other integrity mechanisms for all external login providers.

Find out what's already
exploitable in your codebase.