The vulnerability lies in the serve_cache_file function, located in backend/open_webui/main.py. The core of the issue is an improper path validation check. The code uses file_path.startswith(os.path.abspath(CACHE_DIR)) to ensure that file access is restricted to the designated cache directory. However, this check is flawed because it doesn't enforce a trailing path separator.
This oversight allows for a path traversal attack. An attacker can craft a path that navigates to a sibling directory of the cache directory, as long as the sibling directory's name starts with "cache". For example, if the cache directory is /data/cache, an attacker could use a path like ../cache_evil/some_file to access files in the /data/cache_evil directory. The os.path.abspath resolves this to /data/cache_evil/some_file, and the startswith("/data/cache") check incorrectly passes because "cache_evil" starts with "cache".
The patch addresses this by adding a trailing separator to the check: file_path.startswith(os.path.abspath(CACHE_DIR) + os.sep). This ensures that only paths within the intended cache directory are allowed, effectively closing the traversal vulnerability. The vulnerable function serve_cache_file is the primary runtime indicator for this CVE.