Sanaan Fayaz Wani

open-webui/open-webui

CVE-2026-45675

Open WebUI: LDAP and OAuth First-User Race Condition Allows Multiple Admin Accounts

CVE-2026-45675

8.1

High

CVSS 3.1 base

  1. 2026-04-07Reported privately
  2. 34 days later2026-05-11Published by the maintainer

What to do

If you run open-webui 0.8.12 and earlier, upgrade to 0.9.0 or later.

Anyone who can reach it over the network, with no account and no user interaction, given conditions outside the attacker's control, can read and change sensitive data and make it unavailable.Read from the CVSS 3.1 vector

CVSS 3.1 metrics

To exploit it

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None

What it gets

Confidentiality
High
Integrity
High
Availability
High
Scope
Unchanged

Open this vector in the FIRST calculator ↗

Weakness
CWE-269, CWE-362 Improper Privilege Management · Concurrent Execution using Shared Resource with Improper Synchronization
CVE
CVE-2026-45675
Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Also in open-webui
CVE-2026-59714 7.1 · CVE-2026-59715 3.1
2026-04-07Reported privately
34 days
2026-05-11Published by the maintainer

My analysis of this finding: root cause, the vulnerable code, the impact and the fix, in the site’s format. The official advisory of record is linked above.

Affected versions

Package Ecosystem Vulnerable Fixed in
open-webui pip <= 0.8.12 0.9.0

Summary

Open WebUI assigns the very first account to register on a fresh instance the admin role. Two of the three registration paths, LDAP and OAuth, decide that role with a check-then-create pattern that is not atomic. On a brand new deployment, several users who log in at the same moment can each observe an empty user table and each be created as an administrator. The regular signup endpoint was explicitly hardened against this, but the LDAP and OAuth paths were left on the old racy logic.

Where it lives

The race is a textbook TOCTOU. The role is decided from a count of existing users, and only later is the user inserted, with nothing holding the two steps together.

LDAP path, backend/open_webui/routers/auths.py:

# CHECK: is the user table empty?role = 'admin' if not Users.has_users(db=db) else request.app.state.config.DEFAULT_USER_ROLE # USE: create the user with the role decided aboveuser = Auths.insert_new_auth(    email=email,    password=str(uuid.uuid4()),    name=cn,    role=role,   # role was determined BEFORE the insert    db=db,)

The bugrole is decided from a user count before the insert

OAuth path, backend/open_webui/utils/oauth.py, where get_user_role() reads the count up front:

def get_user_role(self, user, user_data):    user_count = Users.get_num_users()   # CHECK    if not user and user_count == 0:        return 'admin'                   # decided before any insert

The bugreads the user count before any row existsThe buggrants admin to every request that saw an empty table

The returned role is then handed straight to Auths.insert_new_auth(... role=self.get_user_role(None, user_data) ...). The same file’s regular signup_handler already carries the fix and even documents it: “Insert with default role first to avoid TOCTOU race.” That lesson was never carried over to these two flows. Because DATABASE_ENABLE_SESSION_SHARING defaults to False, each request runs on its own database session, which widens the window rather than narrowing it.

Impact

On a fresh instance with LDAP or OAuth enabled, any user who times a login to land concurrently with the legitimate first administrator can win admin for themselves. The exploit is simply firing several authentication requests at once before the first real admin finishes bootstrapping. Every winner lands in the database as a full administrator.

Admin in Open WebUI is total control: all users’ chats and files, system configuration, stored API keys, and every connected LLM backend. What should be a single trusted owner becomes several, one or more of them an attacker, with no way for the legitimate owner to tell which admins were meant to exist.

Fix

Make role assignment atomic by inverting the order, exactly as signup_handler already does: insert every new user with DEFAULT_USER_ROLE first, then check whether this account is the only one (get_num_users() == 1) and promote to admin only when that is true. The count is read after the row exists, so two concurrent registrations can never both see themselves as the sole user. For OAuth, that means dropping the count check out of get_user_role() entirely and doing the promotion post-insert in the callback.

References

The record

Weakness
CWE-269 Improper Privilege Management
CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization
Affected
open-webui 0.8.12 and earlier
Fixed in
0.9.0
Disclosure
2026-04-07 Reported privately
34 days later2026-05-11 Published
Advisory
GHSA-h3ww-q6xx-w7x3
CVE-2026-45675
Also in open-webui
CVE-2026-59714 7.1
CVE-2026-59715 3.1

About this writeup

Sanaan Fayaz Wani (GitHub sfwani) reported this vulnerability to the open-webui maintainers under coordinated disclosure and is credited as a reporter in GHSA-h3ww-q6xx-w7x3, published 2026-05-11.

All published findings: advisory index.