/

CVE-2026-39322

Severity:

HIGH RISK

(8.8)

Improper Authentication in PolarLearn Sign-In Endpoint

CVE-2026-39322

Analyzed

Vulnerability type

Category:

Improper Authentication

CWE:

CWE-287

Impact:

Bypass of Account Ban and Unauthorized Access to Protected Resources

Severity:

HIGH RISK

(8.8)

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 versions 0-PRERELEASE-15 and earlier contain an authentication logic flaw where the POST /api/v1/auth/sign-in endpoint creates a valid session for banned accounts before verifying the supplied password.

Because this prematurely issued session is trusted across authenticated /api routes, a banned account holder can regain access to their account data and perform authenticated actions despite the ban.

Affected context

This vulnerability affects PolarLearn deployments that expose the /api/v1/auth/sign-in endpoint and rely on it to enforce bans and authenticate users.

The issue occurs when the application creates a server-side session object for a banned account prior to fully validating credentials and ban status, and when downstream authenticated /api routes trust the existence of that session token as proof of legitimate, allowed access.

Exploit preconditions

  • Attack surface: Public HTTP API, specifically POST /api/v1/auth/sign-in.
  • Required access: Knowledge of a banned account identifier (e.g., email/username) and ability to send HTTP requests to the PolarLearn API.
  • Trigger point: Initiating a sign-in attempt for a banned account, relying on the flawed order of operations that creates a session before verifying the password or enforcing the ban.
  • Why exploitation is possible: The authentication flow incorrectly establishes a valid session for banned users early in the process, and downstream /api routes rely solely on the presence and validity of this session, not on re-checking ban status or credential verification state.

Why this happens

The root cause is an improper authentication sequence that violates the principle of "authenticate then authorize."

Within the sign-in handler, the application appears to:

  1. Look up the user record (including banned accounts),
  2. Create a session tied to that account,
  3. Only then verify the password and/or ban status.

Because the session is created before all checks pass, and because subsequent authenticated endpoints treat the session as fully trusted, a banned user can obtain and use a valid session token.

This maps to CWE-287: Improper Authentication, where authentication decisions are made incorrectly due to flawed logic or ordering, allowing unauthorized access despite intended restrictions such as account bans.

Potential impact

  • Banned users may regain access to their accounts and associated personal data.
  • Banned users could perform authenticated actions that the ban was supposed to prohibit (e.g., posting, submitting content, or modifying learning data).
  • Application-level policy enforcement (such as moderation decisions) can be undermined.
  • Audit trails and moderation workflows may be skewed by activity from accounts that should be inactive.

General mitigation guidance

Effective mitigation focuses on correcting the authentication flow and tightening session handling:

  • Ensure that no session is created until all authentication checks have passed, including password validation and account status (banned, disabled, or locked).
  • Centralize authentication and authorization logic so that ban and status checks are applied consistently before issuing tokens or sessions.
  • Treat account bans and similar restrictions as hard authorization gates on every privileged action or at least on every authenticated request, not just at login.
  • Normalize user state transitions (active, banned, locked) and enforce them in a single, well-reviewed component rather than ad-hoc checks scattered across handlers.
  • Apply the principle of least privilege to sessions: encode only necessary claims and ensure that claims reflecting account status are validated server-side on each request.

How teams detect issues like this

Organizations can detect and prevent similar issues with:

  • Code review practices that inspect authentication handlers for correct ordering: user lookup → credential verification → status checks → session/token issuance.
  • Static analysis rules that flag session or token creation prior to password verification or status validation in authentication flows.
  • Security-focused tests (unit, integration, and API tests) that explicitly cover edge cases: banned, disabled, expired, or locked accounts attempting to sign in.
  • Runtime monitoring and logs that highlight anomalous activity from banned accounts, such as successful authenticated requests following failed login attempts.
  • Use of automated security review tools that model authentication flows and detect inconsistent enforcement of account status checks across endpoints.

Sources

SourceLink
github.comgithub.com/polarnl/PolarLearn/security/advisories/GHSA-9vx4-7ww7-4cf5

Frequently asked

questions

Yes. Any remote user who can reach the PolarLearn API and knows a banned account identifier can attempt to exploit the flawed sign-in logic.

The attacker must control or know credentials for a banned account, or at least know the account identifier well enough to trigger the flawed session creation process. No prior authenticated access is needed beyond reaching the public sign-in endpoint.

Re-architect the sign-in flow so that sessions or tokens are issued only after all authentication checks succeed: verify the password, confirm that the account is not banned or disabled, and then create the session. Additionally, ensure that all authenticated routes confirm that the associated account is still in a valid state.

Implement a centralized authentication and authorization layer with clear invariants (e.g., "banned users can never obtain valid sessions"), enforce these invariants in automated tests, and incorporate security reviews for any changes touching login, session issuance, or account status handling.

Find out what's already
exploitable in your codebase.