diff --git a/backend/open_webui/routers/terminals.py b/backend/open_webui/routers/terminals.py index 441b53598c..191fb96a1f 100644 --- a/backend/open_webui/routers/terminals.py +++ b/backend/open_webui/routers/terminals.py @@ -49,6 +49,10 @@ def _sanitize_proxy_path(path: str) -> str | None: # Fail closed: still encoded after the cap means the upstream would decode further into traversal. if unquote(decoded) != decoded: return None + # posixpath splits on '/' only, so 'a/..\..\b' survives normpath as one component. + # Upstreams that treat '\' as a separator would resolve it, so reject outright. + if '\\' in decoded: + return None had_trailing_slash = decoded.endswith('/') normalized = posixpath.normpath(decoded) # Remove any leading slashes that would reset the base