/

CVE-2026-45675

Severity:

HIGH RISK

(8.1)

Improper Privilege Management with TOCTOU Race

CVE-2026-45675

Modified

Vulnerability type

Category:

Improper Privilege Management with TOCTOU Race

CWE:

CWE-269, CWE-362

Impact:

Privilege Escalation to Administrative Role

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

Open WebUI's LDAP and OAuth authentication flows contain a Time-of-Check-Time-of-Use (TOCTOU) race condition in the logic that assigns the first-user admin role.

Under concurrent signups, this race can allow an unintended user to gain administrative privileges when they should have received only a default role.

Affected context

This vulnerability appears in Open WebUI deployments that:

  • Use LDAP or OAuth as authentication providers
  • Rely on "first user becomes admin" semantics or similar automatic role-bootstrapping logic
  • Allow concurrent or closely timed signup/login attempts
  • Do not enforce a transactional, single-path role assignment for initial admin creation

The regular username/password signup handler was explicitly hardened against TOCTOU, but the LDAP and OAuth code paths still follow the older, race-prone pattern.

Exploit preconditions

  • Attack surface: Application authentication endpoints (LDAP and OAuth flows).
  • Required access: Ability to initiate new user signups/logins through LDAP or OAuth; no prior administrative access is required.
  • Trigger point: The moment the system checks for "first user/admin existence" and then separately assigns roles based on that check.
  • Why exploitation is possible: The check for whether an admin exists and the subsequent role assignment are not performed atomically. Concurrent authentication requests can interleave between these two steps, allowing a non-intended user to receive the admin role because multiple code paths believe they are handling the "first" user.

Why this happens

The underlying issue is a combination of CWE-269: Improper Privilege Management and CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization (Race Condition).

The system performs a check (e.g., "does an admin already exist?") and then, in a separate step, uses that result to decide which role to assign. In the LDAP and OAuth flows, this occurs without proper locking or transactional safeguards, enabling a TOCTOU race. Multiple concurrent requests may see the same "no admin yet" state and then assign elevated privileges based on stale information. The regular signup handler was refactored to insert users with a default role first, but the same pattern was not applied to the LDAP and OAuth paths, leaving them vulnerable.

Potential impact

  • An unintended user may become an administrator during initial system setup.
  • Multiple users could simultaneously obtain administrative privileges when only one was intended.
  • Administrative capabilities (user management, configuration changes, model and data access) can be misused to alter system behavior or exfiltrate sensitive information.
  • An attacker controlling an LDAP or OAuth account could leverage the race to gain full control of the Open WebUI instance.

General mitigation guidance

Effective mitigation typically focuses on atomic privilege decisions and strong synchronization around bootstrap logic:

  • Design role assignment for the first admin as a single, atomic operation that cannot be interleaved with other signups.
  • Insert new users with a non-privileged, default role first, and only then elevate a single, well-defined user after re-checking the current state.
  • Centralize and reuse the hardened signup logic across all authentication providers (local, LDAP, OAuth) to avoid divergent security behavior.
  • Ensure that privilege changes (especially admin grants) are idempotent and guarded by clear invariants, such as "at most one bootstrap admin."
  • Apply least-privilege defaults for new identities, requiring explicit, deliberate elevation paths rather than automatic admin assignment wherever possible.

How teams detect issues like this

Identifying this kind of issue generally involves code-centric and workflow-aware review:

  • During static analysis or manual review, look for patterns where:
  • The system queries "is there an admin / is this the first user?" and then, in a separate call, assigns roles.
  • Different authentication flows implement this logic separately, leading to inconsistent safeguards.
  • Flag logic that depends on the "first user" pattern without transactional safeguards, especially under concurrent request handling.
  • Use automated tests or fuzzing that simulate concurrent signups through different auth providers to reveal unexpected multiple-admin outcomes.
  • Incorporate policy checks (in CI/CD or code review templates) that require any role-assignment logic to be shared, centralized, and concurrency-safe.

Sources

SourceLink
github.comgithub.com/open-webui/open-webui/commit/96a0b3239b1aadb23fc359bf10849c9ba12fd6ec
github.comgithub.com/open-webui/open-webui/pull/23626
github.comgithub.com/open-webui/open-webui/security/advisories/GHSA-h3ww-q6xx-w7x3

Frequently asked

questions

Yes. If the Open WebUI instance exposes LDAP or OAuth-based authentication over the network, an attacker who can create or control accounts in those identity providers can attempt to exploit the race remotely by timing concurrent logins or signups.

The attacker needs the ability to authenticate as a new user through LDAP or OAuth—typically by creating or using an account in the connected directory or identity provider. No pre-existing administrative access to Open WebUI is required, but the instance must be in a state where automatic admin assignment is still possible.

The safest pattern is to perform user creation and role assignment in a single, atomic operation that always starts from a least-privilege default, and then promotes exactly one user in a concurrency-safe manner. All authentication flows (local, LDAP, OAuth) should reuse this shared, hardened logic.

To prevent comparable problems, avoid duplicating privilege- or role-assignment code across multiple auth paths, and enforce centralized, concurrency-safe privilege management. Combine this with thorough code review, concurrency-aware testing, and design principles that minimize automatic elevation and prefer explicit, auditable admin grants.

Find out what's already
exploitable in your codebase.