CVE-2026-59217: Open WebUI: Upload `metadata.knowledge_id` bypasses the knowledge-base write-access check (read-only users can add files to KB)
Open WebUI before 0.10.0 lets a read-only knowledge-base user add files to that knowledge base by setting metadata.knowledge_id on a file upload. The upload path links the file before any write check. The planted file then shows up for owners and readers. Fixed in 0.10.0.
Published Jul 24, 2026 · Analysis Nov 23, 2026
What an attacker can do
process_uploaded_file in backend/open_webui/routers/files.py reads knowledge_id from the upload metadata and calls Knowledges.add_file_to_knowledge_by_id, which commits a KnowledgeFile row. The normal /api/v1/knowledge/{id}/file/add endpoint requires owner, admin or write access. The upload path did not. A later write check in process_file (retrieval.py) does fail for the reader, but the row is already committed, and the upload code only logs a warning.
The attacker needs a verified account, read access to the target knowledge base, and its id. They upload a file with metadata={"knowledge_id": ...}. The file then appears in /api/v1/knowledge/{id}/files, and owners and readers can fetch it, because has_access_to_file derives access from knowledge-base membership. The change is limited to file membership, which is why the rating is medium. The advisory adds a follow-on risk: if an owner or admin later reprocesses or reindexes the knowledge base, the unauthorized file can enter the collection, which poisons RAG answers with attacker content.
Who is affected
pip package open-webui before 0.10.0. The report tested source at version 0.9.6. Deployments with shared knowledge bases where some users have read-only access are exposed. Check the version:
pip show open-webuiopen-webui
- Ecosystem
- PyPI
- Affected
- < 0.10.0
- Fixed in
- 0.10.0
- Check
pip show open-webui
How to fix it
Upgrade to open-webui 0.10.0:
pip install --upgrade open-webui==0.10.0The fix (pull request 26001) gates the upload auto-link on the same owner, admin or write-grant check as POST /knowledge/{id}/file/add, and runs it before the membership row is inserted. If the user fails the check, the link is skipped and logged. The file still uploads as the user's own file but is not attached. The advisory documents no workaround. After upgrading, review knowledge bases for files added by read-only users before you reindex.
How to tell if you were hit
Look in server logs for upload requests to /api/v1/files/ carrying a metadata field with a knowledge_id, from users who lack write access to that knowledge base. Compare the file list of each shared knowledge base with its owners' expectations, and check who uploaded each file. Look for write-access failures in vector processing, logged as warnings after uploads. Do this before any reindex. The sources report no exploitation in the wild.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Open WebUI upload metadata can add files to knowledge bases without write permission
Summary
Open WebUI's file upload background processing trusts the client-supplied metadata.knowledge_id value and inserts a knowledge_file association before validating that the uploading user has write access to the target knowledge base.
A verified user with only read access to a knowledge base can upload an arbitrary file and set metadata={"knowledge_id":"<target knowledge id>"}. The normal /api/v1/knowledge/{id}/file/add endpoint correctly requires knowledge-base write access, but the upload auto-link path bypasses that authorization check.
The immediate result is unauthorized modification of the target knowledge base's file membership. The attached attacker-controlled file becomes visible through /api/v1/knowledge/{id}/files, and readers/owners of that knowledge base can retrieve the file through the normal file endpoints because file access is derived from KnowledgeFile membership.
Affected Version
- Repository:
open-webui/open-webui - Tested source commit:
02dc3e689ceac915a870b373318b99c029ddf603 - Package version observed in
package.json:0.9.6 - Package name:
open-webui
Impact
A read-only knowledge-base collaborator can perform a write operation against that knowledge base by attaching arbitrary uploaded files.
Security impact:
- Unauthorized knowledge-base membership modification.
- Integrity impact on shared knowledge-base file listings.
- Attacker-controlled files become readable to other users who can read the target knowledge base.
- If an owner/admin later reprocesses or globally reindexes the knowledge base, the unauthorized file can be indexed into the knowledge collection, turning the membership bypass into RAG/content poisoning.
This is not an unauthenticated issue. It requires a verified Open WebUI account and a valid target knowledge-base ID. The clearest exploit path is a user who legitimately has read access to a knowledge base but not write access.
Source Evidence
The normal single-file knowledge add endpoint checks write permission before processing or inserting the relationship:
backend/open_webui/routers/knowledge.pyadd_file_to_knowledge_by_id- Lines 714-728 reject callers who are not owner, admin, or granted
writeaccess. - Lines 750-766 then process and insert the file only after that authorization gate.
The upload auto-link path does not perform the same check:
backend/open_webui/routers/files.pyprocess_uploaded_file- Lines 178-186 read
knowledge_idfrom upload metadata and immediately callKnowledges.add_file_to_knowledge_by_id(...). - Lines 187-192 call
process_file(... collection_name=knowledge_id ...)after the insert.
The model method inserts the relationship without validating the caller's write access to the knowledge base:
backend/open_webui/models/knowledge.pyadd_file_to_knowledge_by_id- Lines 646-677 create and commit a
KnowledgeFilerow for the suppliedknowledge_id,file_id, anduser_id.
The later vector write check exists, but it runs too late:
backend/open_webui/routers/retrieval.pyprocess_file- Lines 1587-1592 call
_validate_collection_access(..., access_type='write')when a collection is supplied.
Because the unauthorized KnowledgeFile row is already committed before that check runs, the failed vector processing does not undo the knowledge-base file association. The upload code catches the exception at backend/open_webui/routers/files.py lines 194-195 and logs a warning while leaving the row in place.
The unauthorized relationship affects file access decisions:
backend/open_webui/utils/access_control/files.pyhas_access_to_file- Lines 41-53 grant file access when a file is associated with a knowledge base the user can access.
So once the attacker's file is inserted into the target KnowledgeFile table, target knowledge-base readers/owners can see and fetch that file through normal knowledge/file routes.
Reproduction Steps
Use a local Open WebUI instance with two verified users:
- As user
owner, create a knowledge base. - Grant user
readerread access to the knowledge base, but do not grant write access. - As
reader, confirm the normal add-file endpoint is blocked:
POST /api/v1/knowledge/<knowledge_id>/file/add
Authorization: Bearer <reader token>
Content-Type: application/json
{"file_id":"<reader-owned-file-id>"}Expected and observed behavior for the normal route: it rejects the request because reader lacks knowledge-base write access.
- As
reader, upload a new file with the same target knowledge ID embedded in upload metadata:
POST /api/v1/files/?process=true&process_in_background=false
Authorization: Bearer <reader token>
Content-Type: multipart/form-data
[email protected]
metadata={"knowledge_id":"<knowledge_id>"}- Observe that the upload request succeeds and returns the uploaded file record.
- As
owner, request the knowledge-base files:
GET /api/v1/knowledge/<knowledge_id>/files
Authorization: Bearer <owner token>- Observe that
attacker-note.txtappears in the target knowledge base even thoughreaderdid not have write access. - As
owner, request the file content:
GET /api/v1/files/<attacker_file_id>/content
Authorization: Bearer <owner token>- Observe that the file is retrievable because
has_access_to_filederives access from the unauthorized knowledge-base membership.
Expected Behavior
The upload auto-link path should enforce the same authorization contract as /api/v1/knowledge/{id}/file/add:
- The target knowledge base must exist.
- The caller must be the knowledge owner, an admin, or have
writeaccess. - The supplied
directory_id, if present, must belong to the target knowledge base. - The
KnowledgeFileassociation should only be inserted after authorization and processing succeed.
Actual Behavior
metadata.knowledge_id causes Knowledges.add_file_to_knowledge_by_id(...) to insert a KnowledgeFile row before write authorization is checked. The later collection write validation can fail, but the unauthorized membership row remains committed.
Suggested Fix
Move knowledge-base authorization before the insert in the upload auto-link path. The upload path should share the same write-access and directory validation logic used by the dedicated knowledge endpoints.
One safe pattern:
- Load the target knowledge base.
- Require owner/admin/write access before calling
Knowledges.add_file_to_knowledge_by_id. - Validate that
directory_id, if supplied, belongs to the same knowledge base. - Run vector processing before inserting the membership row, or wrap processing plus insertion in a transaction/compensating cleanup so a denied or failed process cannot leave a stale unauthorized row.
Credited to jagstack, Classic298.
Questions
- Can an unauthenticated user exploit CVE-2026-59217?
No. It needs a verified Open WebUI account and a valid knowledge base id. The clearest case is a user with read access to a knowledge base but no write access.
- Can the planted file poison RAG results?
Possibly. If an owner or admin later reprocesses or reindexes the knowledge base, the unauthorized file can enter the collection, according to the advisory. Review membership before reindexing.
- Does the upload itself still work after the fix?
Yes. After 0.10.0 the file uploads as the user's own file, but it is not attached to the knowledge base unless they pass the owner, admin or write check.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Open WebUI vulnerabilities
All Open WebUI entriesCVE-2026-87011
Open WebUI: Unauthenticated requests can stall the server via uncached OIDC fetches in back-channel logout
high7.5Sep 10, 2026CVE-2026-87012
Open WebUI: Any authenticated user can suppress calendar alerts instance-wide via a non-numeric alert value
medium4.3Sep 10, 2026CVE-2026-87013
Open WebUI: Any authenticated user can start a non-terminating request via a folder parent cycle
medium4.3Sep 10, 2026CVE-2026-87014
Open WebUI: Admin demoted through SSO role sync keeps read and write access to all users' notes
medium6.5Sep 10, 2026CVE-2026-87015
Open WebUI: A user's session cookies are sent to tool servers configured for bearer authentication
medium6.8Sep 10, 2026CVE-2026-87016
Open WebUI: Sign-in as another user via wildcard characters in the OAuth subject claim on SQLite
high8.1Sep 10, 2026
