# Flyto2 Core: SSRF guard bypass via DNS rebinding (validate_url_ssrf resolves-then-connects without pinning)

flyto-core's validate_url_ssrf resolves the hostname then hands the URL to aiohttp, which re-resolves at connect time, so a TTL=0 DNS flip reaches internal/metadata IPs.

- Payout: Research
- Severity: high
- Program: Flyto2 Core
- Found by: Pig-Tail
- Disclosed: 2026-11-20
- CVE: CVE-2026-77316
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-6pm8-6f34-9v3g
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-6pm8-6f34-9v3g
- Tags: area:oss domain:oss impact:data-leak impact:internal-access kind:research platform:ghsa sev:high tech:python technique:race-window technique:source-review vuln:race-condition vuln:ssrf

**Target:** Python SSRF URL guard (validate_url_ssrf) and aiohttp outbound request path
**Root cause:** validate_url_ssrf resolves the hostname via socket.getaddrinfo, rejects private IPs, then returns the URL string with hostname intact; aiohttp performs an independent second resolution at connect time, so the validated IP is never pinned.
**Steps:**
1. Attacker controls authoritative DNS for `rebind.attacker.test` with TTL 0, answering public first then private.
2. Drive a guarded module with `url=http://rebind.attacker.test/` (e.g. http.get, graphql.query, monitor.http_check).
3. Guard's `getaddrinfo` returns public IP, `is_private_ip` false, URL allowed.
4. aiohttp re-resolves at connect, gets `127.0.0.1`/`169.254.169.254`, connects to internal target.
5. PoC: monkeypatch `socket.getaddrinfo` to return public on call #1 and loopback later; `validate_url_ssrf` ALLOWED, `socket.create_connection` reaches local sentinel.
**How found:** Noticed the guard returns the URL string rather than a pinned IP, and that aiohttp uses its own resolver distinct from the guard's socket.getaddrinfo — two genuinely separate lookups, so one flip suffices. Prior fixes (GHSA-pgwh, GHSA-c9hr, GHSA-794r) added coverage/redirect revalidation/IPv6 checks but never pinned the address.
**Exploitation:** Attacker with controlled DNS and a way to supply a URL to any guarded HTTP module flips the resolution between the guard's lookup and aiohttp's connect-time lookup, reaching loopback or cloud metadata (169.254.169.254) to read credentials. Redirect revalidation does not help since the first hop already rebinds.
**Escalation:** Reaching cloud metadata service (169.254.169.254) yields credentials for further cloud access; affects all consumers of the guard (http, graphql, monitor, notification, ai.vision_analyze, browser.proxy_rotate).
**Insight:** When auditing SSRF guards, check whether the validated resolution is the same one used for the socket: if the guard returns a hostname and the HTTP client re-resolves, a TTL=0 rebind defeats it. Multi-A-record static tricks fail if the guard loops all results, but a time-of-use flip does not.

