An analysis of the security advisory reveals a critical authorization bypass vulnerability in Open WebUI. The POST /api/chat/completions endpoint processes an image_url.url field. When this field contains a value that is not a standard URL (i.e., does not start with http://, https://, or data:image/), the backend interprets it as a file ID.
The core of the vulnerability lies in the get_image_base64_from_url function located in backend/open_webui/utils/files.py. This function is called by the convert_url_images_to_base64 middleware. When handling a file ID, get_image_base64_from_url calls Files.get_file_by_id to retrieve the file from the database. Crucially, this lookup does not perform any ownership or access control checks. As a result, any authenticated user can supply a file ID belonging to another user and gain unauthorized access to that file's contents.
The exploit scenario is as follows:
- An attacker, authenticated as User B, obtains a file ID for a file uploaded by User A.
- The attacker sends a request to the
/api/chat/completions endpoint, including the victim's file ID in the image_url.url field.
- The
convert_url_images_to_base64 middleware processes this request and calls get_image_base64_from_url.
get_image_base64_from_url retrieves User A's file from storage, bypassing all authorization checks.
- The file's content is then base64-encoded and can be exfiltrated, for instance, by prompting a vision-enabled LLM to describe the content of the "image."
This vulnerability allows any authenticated user to read files belonging to any other user on the platform, leading to a significant breach of data confidentiality. The fix requires passing the user context down to the file retrieval functions and implementing proper authorization checks to ensure that a user can only access files they own or have explicit permission to view.