# SSRF validated at creation not fetch

URL allowlisted once at save time, then fetched later without re-resolving or re-checking the IP

_Area: Web infrastructure and server-side requests. Seen in 2 disclosed reports; latest 2026-08-18. Updated 2026-11-14._

## How it works
A URL is checked once, when it is stored or when a config object is created, and trusted forever after. The fetch happens later against whatever the hostname resolves to then, or against URLs the remote server itself supplies. The broken assumption is that "validated once" equals "safe to fetch": DNS can change between check and use (rebinding), a config value can be rewritten through a second write path, and a protocol client can be told by the far end where to connect next. The check and the fetch are not the same event, so the check proves nothing about the fetch.

## Where it shows up
- A fetcher (headless browser, HTTP client, import job) that takes user URLs and never re-resolves or pins the IP at connect time [E1](https://bugbountylibrary.com/r/h1%3A530974.md).
- Allowlist validation called only in a create handler; update/PUT paths store the same field verbatim [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xpmj-wjcp-6pww.md).
- Clients that follow server-supplied URLs by design (ACME directory/order/finalize per RFC 8555) [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xpmj-wjcp-6pww.md).
- Path handling that calls `realpath`/`abspath` before a containment check, on Windows, where UNC paths are absolute [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-wqp7-x3pw-xc5r.md).
- Any pre-validation filesystem or network call on attacker-influenced input.

## How to review
Find every write path that can set the URL or config, not just creation, and confirm each re-validates [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xpmj-wjcp-6pww.md). At fetch time, confirm the resolved IP is checked against a deny list (link-local 169.254.169.254, private ranges) and pinned for the actual connection, so a second resolution cannot differ [E1](https://bugbountylibrary.com/r/h1%3A530974.md). For protocol clients, confirm outbound hosts are pinned to the configured value rather than followed from server responses [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xpmj-wjcp-6pww.md). For path code, confirm containment is checked on the raw input before any `realpath`/`abspath` call, and that UNC/absolute paths are rejected up front [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-wqp7-x3pw-xc5r.md). The invariant: the thing validated is the thing fetched, at the moment of fetch.

## How finders spotted it
- Noticed a creative import feature fetched remote images, hypothesized a server-side browser, and reasoned DNS rebinding could redirect it to metadata endpoints [E1](https://bugbountylibrary.com/r/h1%3A530974.md).
- Code review: saw `_validate_acme_url` called only in `create_authority`, whose docstring admitted existing authorities are not re-validated; traced the update path storing options verbatim into the client's URL-following logic [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xpmj-wjcp-6pww.md).
- Read `lookup_path()` and saw `os.path.realpath` ran before the `commonpath` check; reasoned a Windows UNC path bypasses the join base and triggers SMB I/O before validation [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-wqp7-x3pw-xc5r.md).

## Variants seen
- Rebinding against a headless-browser fetcher to reach cloud metadata [E1](https://bugbountylibrary.com/r/h1%3A530974.md).
- Config mutation via an update endpoint, then a protocol client following attacker URLs [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xpmj-wjcp-6pww.md).
- Path resolution performing network I/O before a containment check [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-wqp7-x3pw-xc5r.md).

## Impact and severity
E1 leaked GCP metadata, SSH keys and service-account tokens, escalating SSRF to cloud credential compromise [E1](https://bugbountylibrary.com/r/h1%3A530974.md). E2 gave a non-admin authority-role member SSRF with signed requests, a resident account key and cloud DNS credentials, raising impact beyond blind GET [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xpmj-wjcp-6pww.md). E3 leaked the service account's NTLMv2 hash, crackable offline or relayable for lateral movement, with timing enabling host discovery [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-wqp7-x3pw-xc5r.md). Severity rises with credential exposure and reach into internal networks.

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **lemur (pip)** <= 1.9.2, fixed in 1.9.3: Lemur: Server-Side Request Forgery via the ACME client following server-controlled URLs (CVE-2026-70666). Report: https://bugbountylibrary.com/r/ghsa%3AGHSA-xpmj-wjcp-6pww.md. Fix: https://github.com/Netflix/lemur/commit/6dcb19b6d6004e97796d6a0344b130b2ba57f050

## Evidence
- E1: https://bugbountylibrary.com/r/h1%3A530974.md
- E2: https://bugbountylibrary.com/r/ghsa%3AGHSA-xpmj-wjcp-6pww.md
- E3: https://bugbountylibrary.com/r/ghsa%3AGHSA-wqp7-x3pw-xc5r.md
