# SSRF via potential filter bypass with too lax local domain checking

Nextcloud's SSRF filter missed cloud metadata endpoints metadata.google.internal and 100.100.100.200, letting attackers reach GCP/Alibaba metadata from a hosted instance.

- Payout: $250
- Severity: low
- Program: Nextcloud
- Found by: tomorrowisnew_
- Disclosed: 2022-09-16
- CVE: CVE-2022-39211
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1608039
- Library page: https://bugbountylibrary.com/r/h1%3A1608039
- Tags: area:web domain:web impact:internal-access kind:bounty platform:hackerone sev:low tech:php technique:incomplete-fix technique:source-review vuln:ssrf

**Target:** Nextcloud server SSRF URL filter (preventLocalAddress/ThrowIfLocalAddress)
**Root cause:** The local-address blocklist only checked localhost/.local suffixes, hostname-only strings, and PHP's NO_PRIV_RANGE/NO_RES_RANGE IP flags, omitting cloud metadata hostnames and IPs like metadata.google.internal and 100.100.100.200.
**Steps:**
1. Read `ThrowIfLocalAddress()` in the SSRF filter code.
2. Note checks: `localhost`/`.local`/`.localhost` suffix, hostname-only rejection, and `FILTER_FLAG_NO_PRIV_RANGE`/`FILTER_FLAG_NO_RES_RANGE` on IPs.
3. Identify `http://metadata.google.internal` passes all checks (not localhost, has dots, not an IP).
4. Identify `100.100.100.200` (Alibaba metadata) is not in priv/res ranges.
5. Submit a URL pointing to these endpoints through any Nextcloud feature that fetches remote URLs to trigger SSRF.
**How found:** Code review of the SSRF filter: enumerating each check and reasoning about which hosts/IPs slip through, then comparing against known cloud metadata endpoints (AWS/DO covered by NO_RES_RANGE, GCP/Alibaba not).
**Exploitation:** On a Nextcloud instance hosted in GCP or Alibaba Cloud, an attacker supplies a URL such as `http://metadata.google.internal/...` or `http://100.100.100.200/...` to a server-side fetch feature, bypassing the filter and reaching the cloud metadata service.
**Insight:** When auditing SSRF blocklists, enumerate cloud metadata endpoints per provider (metadata.google.internal, 100.100.100.200, fd00:ec2::254) and test each against the filter's exact predicates rather than assuming IP-range flags cover them.

