The vulnerability is an Insecure Direct Object Reference (IDOR) affecting three prompt history operations in Open WebUI. An authenticated attacker can read or delete prompt history entries belonging to other users.
The root cause is a failure to verify object ownership. The API endpoints (/api/v1/prompts/id/{prompt_id}/...) correctly authorize the user's access to the prompt_id specified in the URL. However, the backend functions that perform the history operations (compute_diff, delete_history_entry, update_prompt_version) subsequently use a history_id or version_id provided by the user in the request parameters or body, without checking if that history object actually belongs to the authorized prompt_id.
This allows an attacker to:
- Read history: By calling the
diff endpoint with their own prompt_id but the victim's history_id, they can retrieve snapshots of the victim's private prompts.
- Read history (via restore): By calling the
update/version endpoint with their own prompt_id but the victim's version_id, they can restore the victim's prompt content into their own prompt, making it readable.
- Delete history: By calling the
delete endpoint with their own prompt_id but the victim's history_id, they can delete the victim's prompt history entries.
The fix, implemented in commit 9a3eea64489df6dd2f48d4734a700de08dee0f13, addresses this by passing the authorized prompt_id down to the model-layer functions and adding it to the database queries. This ensures that all operations on history entries are scoped to the prompt the user is authorized to access, effectively closing the IDOR vulnerability.
The vulnerable functions are the API route handlers in routers/prompts.py that receive the malicious input, and the underlying data model methods in models/prompt_history.py and models/prompts.py that perform the database operations without proper authorization checks.