-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The validator inspects what the user wrote. The fetcher reaches what the network said next.\n\n`validate_url()` is one function. It has been the entire Open WebUI SSRF gate since the function was written. The version that shipped in 0.9.4 looks like this, abridged to the part that does the work:\n\n```python\ndef validate_url(url: Union[str, Sequence[str]]):\n if isinstance(url, str):\n if isinstance(validators.url(url), validators.ValidationError):\n raise ValueError(ERROR_MESSAGES.INVALID_URL)\n\n parsed_url = urllib.parse.urlparse(url)\n\n if parsed_url.scheme not in ['http', 'https']:\n raise ValueError(ERROR_MESSAGES.INVALID_URL)\n\n if not ENABLE_RAG_LOCAL_WEB_FETCH:\n ipv4_addresses, ipv6_addresses = resolve_hostname(parsed_url.hostname)\n # Check if any of the resolved addresses are private\n # This is technically still vulnerable to DNS rebinding attacks,\n # as we don't control WebBaseLoader\n for ip in ipv4_addresses + ipv6_addresses:\n addr = ipaddress.ip_address(ip)\n if not addr.is_global:\n raise ValueError(ERROR_MESSAGES.INVALID_URL)\n return True\n```\n\nThe function does what its docstring would say if it had one. It rejects `http://127.0.0.1/`. It rejects `http://169.254.169.254/`. It rejects `http://10.0.0.1/`. It does this by resolving the hostname the caller wrote and walking the address list. The comment two lines into the resolve block says, in the codebase's own words, that this approach is technically still vulnerable, because the function has no authority over what the HTTP library does next.\n\nHere is what the function next. `get_content_from_url()` in `backend/open_webui/retrieval/utils.py`, reached via the `/api/v1/retrieval/process/web` endpoint, looked like this on the same release:\n\n```python\ndef get_content_from_url(request, url: str) -> str:\n validate_url(url)\n\n # Streamed GET to check Content-Type without downloading the body.\n try:\n response = requests.get(url, stream=True, timeout=30)\n```\n\n`requests.get` defaults to `allow_redirects=True`. The validator inspects the URL the caller sent. The fetcher fetches whatever `Location:` header the public host returns. The two operate on the same `url` string in adjacent statements, and the string changes meaning between them.\n\nThe PoC fits in one line:\n\n```bash\ncurl -X POST https://target/api/v1/retrieval/process/web \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://httpbin.org/redirect-to?url=http%3A%2F%2F169.254.169.254%2Flatest%2Fmeta-data%2F&status_code=302\"}'\n```\n\n`httpbin.org` is global. `validate_url('https://httpbin.org/...')` returns True. `requests.get` follows the 302. The response body that lands in the response payload is whatever IMDSv1 served. Any authenticated user. Default configuration. No admin role.\n\n## Five call sites. The same one-line oversight in each.\n\nThe advisory enumerates five fetchers in the same codebase. Each independently calls an HTTP client with the redirect-follow default; each independently bypassed `validate_url()` once it received its 302.\n\n1. `SafeWebBaseLoader._scrape` in `backend/open_webui/retrieval/web/utils.py`, inheriting from langchain's `WebBaseLoader._scrape`, which invokes `self.session.get(url, **self.requests_kwargs)`. The subclass's `requests_kwargs` only set `timeout`.\n2. `_fetch` in the same file, using aiohttp. (Fixed first; listed in the advisory for completeness.)\n3. `get_content_from_url` in `backend/open_webui/retrieval/utils.py`, the sync `requests.get` shown above. Reached via `/api/v1/retrieval/process/web`.\n4. `load_url_image` in `backend/open_webui/routers/images.py`, the image-edits endpoint. `session.get(data, ssl=AIOHTTP_CLIENT_SESSION_SSL)` with no `allow_redirects` argument.\n5. `get_image_base64_from_url` in `backend/open_webui/utils/files.py`, invoked from `convert_url_images_to_base64` in `backend/open_webui/utils/middleware.py` on every `/api/chat/completions` request whose message content includes an `image_url` part.\n\nEach was a separate GHSA report. The advisory lists them with reporter names: `tenbbughunters` for `SafeWebBaseLoader`, `tempcollab` for the already-fixed `_fetch`, `sneaXOR` for `get_content_from_url`, `YLChen-007` for `load_url_image`, `nayakchinmohan` for the chat-completion image path. The remediation developer credit goes to `Classic298`, the maintainer who wrote the four fix PRs.\n\nThe four fix PRs landed across two days. PR #24491 (commit `88545415`, May 9) closed three call sites in one diff. PR #24524 (commit `d11e06f1`, May 10) closed the chat-completion path the prior PR missed. PR #24518 (commit `2d9939ed`, May 10) added `validate_url()` to a sixth fetcher, `get_image_data`, that was technically only reachable via admin-side configuration but lived in the same file as a patched sibling. PR #24534 (commit `e7ba8978`, May 10) closed a parser-level bypass in `validate_url()` itself, the `http://127.0.0.1\\@1.1.1.1` shape where `urllib.parse.urlparse` and `requests` disagree on which host the URL names.\n\nThe patches look identical because the bug is identical. The chat-completion image fix is the clearest:\n\n```diff\n async def get_image_base64_from_url(url: str) -> Optional[str]:\n try:\n if url.startswith('http'):\n- # Validate URL to prevent SSRF attacks against local/private networks\n+ # Validate URL to prevent SSRF attacks against local/private networks.\n+ # allow_redirects=False prevents redirect-based SSRF: validate_url() is\n+ # called only on the originally-submitted URL; following 3xx redirects\n+ # without re-validation would let an attacker reach private IPs via a\n+ # public host that redirects internally (e.g. cloud-metadata exfil).\n validate_url(url)\n session = await get_session()\n- async with session.get(url, ssl=AIOHTTP_CLIENT_SESSION_SSL) as response:\n+ async with session.get(\n+ url, ssl=AIOHTTP_CLIENT_SESSION_SSL,\n+ allow_redirects=AIOHTTP_CLIENT_ALLOW_REDIRECTS\n+ ) as response:\n```\n\nThe diff is the keyword argument. Every fix in this cluster is the keyword argument.\n\n## The most reachable path was patched fourth.\n\n`get_image_base64_from_url` runs on every `/api/chat/completions` request whose message content includes an `image_url` part. The middleware function `convert_url_images_to_base64` walks the message list, sees a content item of type `image_url`, hands the URL to `get_image_base64_from_url`, and the function fetches the bytes and inlines them as base64. The handler has no special-endpoint requirement, no admin permission, no feature flag. The default chat UI sends `image_url` content parts on every multimodal turn that references an image by URL instead of base64.\n\nThe first redirect-SSRF PR closed the three call sites the first reporters identified. It did not close this one. PR #24524's commit message names what happened in the author's own words:\n\n> Cohort follow-up to PR #24491. That PR patched three call sites\n> (SafeWebBaseLoader._scrape, get_content_from_url, load_url_image) to\n> pass allow_redirects=False on the underlying HTTP client; this fourth\n> call site in utils/files.py was missed.\n\nThe reporter for this sub-path, `nayakchinmohan`, filed it as a separate GHSA on May 10, the day after PR #24491 merged. The codebase carried the same one-line oversight on five functions; the fix author closed four in two days because four reporters were paid in credit. The fifth had been already closed; the sixth (`get_image_data`) got hardened in the same window as cohort consistency.\n\n## The vendor wrote a consolidation policy because the codebase produces consolidatable bugs.\n\nOpen WebUI's `docs/SECURITY.md` contains a clause not common to most projects' security policies. It is the one that produced the credit list above (paraphrased to remove inline dashes):\n\n> When multiple independent reporters describe the same vulnerability class but each demonstrates a **distinct and separate exploitation vector** (for example, the same missing authorization check reached through different endpoints), we will consolidate them into the earliest filing and credit every reporter who demonstrated a distinct path. Only one CVE will be issued for the consolidated advisory.\n\nThe policy is explicit. Each distinct sub-path of one class earns a credit. The class itself earns one CVE. The text reads as a procedural clarification; it is also an admission. The clause exists because the codebase produces reports of the shape the clause describes. Five reporters did not arrive at the same gate-on-input bug by independent inspection of the same one function. Five reporters arrived at five different fetchers that all skipped the same gate because the codebase has five different fetchers. The consolidation rule routes the disclosure economics around the absence of a central abstraction.\n\nThe policy also says, two clauses below the consolidation rule:\n\n> Credit-for-duplicates incentivizes flooding. If similar-but-later filings earn credit, the rational play is to skim open advisories and file variations. We already see this pressure. The first-filer rule is what limits it.\n\nThat sentence is about duplicates of one finding. The consolidation rule, in the same document, is about distinct findings of one class. The two rules together describe the local optimum the project has reached. Filers race to find a sub-path no earlier filing covered; the vendor consolidates; one CVE issues with N credits attached. The race is what produced this CVE's five-reporter credit list, and it is what surfaced the chat-completion image path that PR #24491's author had not seen. The dynamic is working as designed. It is working on a codebase whose design is what makes the dynamic necessary.\n\n## CVE-2025-65958 closed some of them. CVE-2026-45401 closed more.\n\nThe GHSA title is the receipt. `(not addressed by CVE-2025-65958)`. The 2025 CVE was the first consolidated SSRF in this codebase's history. Some of the call sites that had `validate_url()` and not `allow_redirects=False` got patched then. Six months later, five more reporters arrived with five more call sites that had `validate_url()` and not `allow_redirects=False`. The previous CVE addressed the symptom on its visible surface. The next call site was wherever the codebase had added one between then and now.\n\nThis is the `parallel-implementation-gap` pattern. The Astro Cloudflare-adapter exhibit shows the gate failing to copy across packages, MLflow's exhibit shows it failing to copy across runtimes, Axios's shows it across branches of one function, JeecgBoot's across sibling methods on one controller class. CVE-2026-45401 shows the gate failing to copy across five sibling fetchers in one Python package, with the second consolidated CVE in the same package's history confirming the shape. It is also a `design-debt-driver`: the class recurs because the design carries the primitive. Each new fetcher in the package is one more place the gate could fail to copy.\n\n## The validator's own comment admits the gate-on-input model is broken.\n\nThe code admits the problem. The DNS-rebinding comment inside `validate_url()` has been in the codebase from the first version of the function. The author wrote it because the author understood that resolving the hostname once at gate time gives no guarantee about what the HTTP library resolves it to at fetch time. DNS rebinding and 3xx redirects are two members of the same class. The function inspects one URL; the network can produce a different one between inspection and fetch.\n\nThe parser-confusion patch (PR #24534) makes the class concrete a third way. `urllib.parse.urlparse` and the `requests` library disagree on how to split URLs containing backslash, tab, CR, or LF in the netloc. `http://127.0.0.1\\@1.1.1.1` resolves to `1.1.1.1` under `urlparse` (which passes the global-IP filter) and to `127.0.0.1` under `requests` (which is what actually connects). The validator and the fetcher were not even looking at the same URL. The fix adds a character blocklist to `validate_url()` so that the two libraries' disagreement can no longer be exploited by writing a URL the two libraries split differently.\n\nEach of these three observations is the same observation. The gate's authority ends at the string. The HTTP library decides what host it actually contacts. The validator does not know what the library will do. The library does not consult the validator. The pattern of fix in CVE-2026-45401 is to teach each individual library call site to refuse the library's default behavior. The pattern of fix is not to write a function that does the validation and the fetch in one place.\n\n## The patches add `allow_redirects=False` five times. They did not add `fetch_url`.\n\nRead the patch series as a body of work. The fix authors knew the bug class. PR #24524's commit message contains a phrase that names it precisely:\n\n> Apply the same one-line fix as the other three call sites.\n\nThe same one-line fix. Applied independently at the fifth call site, after the fourth. The patches did add one new thing, an environment variable: `AIOHTTP_CLIENT_ALLOW_REDIRECTS`, defined in `backend/open_webui/env.py` with a default of `False` and a docstring that says exactly why it exists. Each patched call site imports the variable and passes it. The codebase now has one centralized policy value and five places that import it.\n\nWhat the patches did not add is a function. There is no `fetch_url(url)` in `backend/open_webui` that performs `validate_url`, executes `requests.get` or `aiohttp.ClientSession.get` with `allow_redirects=False`, and returns the response. There is no `safe_fetch` wrapper. The five fetchers remain five fetchers. Each remembers, in its own body, to call `validate_url(url)` and to pass `allow_redirects=AIOHTTP_CLIENT_ALLOW_REDIRECTS`. The sixth fetcher, whenever it is written, has to remember both. The `safe_validate_urls` helper in `retrieval/web/utils.py` already maps a list of URLs through `validate_url`; the package has the shape for `safe_fetch`, and it has not used it.\n\nPoC: [advisories/GHSA-rh5x-h6pp-cjj6](https://github.com/advisories/GHSA-rh5x-h6pp-cjj6)","closing_line":"The patches add `allow_redirects=False` five times. They did not add a function called `fetch_url`. The codebase has one validator and five fetchers before CVE-2026-45401, and one validator and five fetchers after it. The next fetcher is somebody's pull request.","hook_md":"CVE-2026-45401 is filed against `validate_url()` in `backend/open_webui/retrieval/web/utils.py`. `validate_url()` works as advertised. It resolves the submitted hostname, walks every returned IPv4 and IPv6 address through `ipaddress.is_global`, and rejects private ranges, loopback, and `169.254.169.254`. The hostname it inspects is the one the caller submitted. Open WebUI 0.9.4 then turns around and calls `requests.get`, `aiohttp.ClientSession.get`, or `langchain_community.document_loaders.WebBaseLoader._scrape` on the same string, and the HTTP libraries default to following 3xx redirects. Five separate functions in the codebase do this. Five GitHub reporters each found one of them. The advisory's title is \"SSRF Bypass via HTTP Redirect Following in Web-Fetch and Image-Load Endpoints (not addressed by CVE-2025-65958).\"","post_id":446,"slug":"open-webui-cve-2026-45401-one-validator-five-fetchers","title":"CVE-2026-45401: Open WebUI Has One URL Validator and Five URL Fetchers","type":"initial","unreadable_sentence":"The patches add `allow_redirects=False` five times. They did not add a function called `fetch_url`. The codebase has one validator and five fetchers before CVE-2026-45401, and one validator and five fetchers after it."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCam5DtwAKCRDeZjl4jgkQ JiXAAP4ya34CXoQCwGRGsE4qVrrwQ295gD7UV4KR6KsFEmQ8jAEA0JScT4mOuNAs cUF0rIqG5VcRPL2zB6NN1HwACFHXPA8= =GnQJ -----END PGP SIGNATURE-----