llamaCVEVulnerability Intelligence
/
Advisory · GitHub · crates.io · surrealdb

GHSA-C9WC-JCR5-8974

IPv6 transition address bypass of SSRF guard in FilteringResolver

Texto original en inglés · Ver en español

Parche disponible
Descargar PNG JSON
CVSS
—
high
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -25 d de la divulgación
Exposición33 dDesde la divulgación, 19 oct 2026, 3:51 a. m.
Detección32 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de la severidad declarada por GHSA (alta) y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Ni alarma ni olvido: seguimiento.Seguimiento de cerca: yo sé de mirar de cerca.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 3.3.0
Monitoreo
Detectada +1
24 sept 26
19 oct 26
20 nov 26
21 nov 26
24 sept 26
9 oct 26
23 oct 26
7 nov 26
21 nov 26
FechaFaseEventoDetalle
Remediación Parche 3.3.0 surrealdb · -25 d desde divulgación
Divulgación Publicada GHSA-C9WC-JCR5-8974 divulgada
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

IPv6 transition address bypass of SSRF guard in FilteringResolver

Summary

The `is_private_ip` function in `surrealdb/core/src/net/mod.rs` classifies IP addresses for the `FilteringResolver` network capability enforcement. It uses `to_canonical()` to unwrap IPv4-mapped IPv6 addresses before checking standard private/special-use ranges. However, `to_canonical()` only handles `::ffff:x.x.x.x` (IPv4-mapped), not NAT64, 6to4, or Teredo transition addresses that also embed IPv4 destinations.

On hosts with NAT64, 6to4, or Teredo connectivity, these transition addresses route to the embedded IPv4 target, bypassing the SSRF guard.

Affected code

`surrealdb/core/src/net/mod.rs`:

fn is_private_ip(ip: IpAddr) -> bool {
    match ip.to_canonical() {
        IpAddr::V4(v4) => {
            v4.is_loopback()
                || v4.is_private()
                || v4.is_link_local()
                || v4.is_broadcast()
                || v4.is_unspecified()
                || (u32::from(v4) & 0xFFC0_0000) == 0x6440_0000 // CGNAT 100.64.0.0/10
        }
        IpAddr::V6(v6) => {
            v6.is_loopback()
                || v6.is_unspecified()
                || (v6.segments()[0] & 0xFE00) == 0xFC00 // ULA
                || (v6.segments()[0] & 0xFFC0) == 0xFE80 // link-local
        }
    }
}

`to_canonical()` converts `::ffff:x.x.x.x` to `x.x.x.x` (IPv4), so IPv4-mapped addresses are correctly checked. But it does NOT unwrap:

| Mechanism | Prefix | RFC | Embedding |
|-----------|--------|-----|-----------|
| NAT64 well-known prefix | `64:ff9b::/96` | RFC 6052 | Last 32 bits = IPv4 |
| 6to4 | `2002::/16` | RFC 3056 | Bits 16-47 = IPv4 |
| Teredo | `2001:0000::/32` | RFC 4380 | Last 32 bits = IPv4 XOR `0xffffffff` |

These remain as IPv6 addresses after `to_canonical()`, and the IPv6 branch only checks loopback, unspecified, ULA, and link-local, none of which match.

Bypass vectors

NAT64 -- targeting localhost 127.0.0.1
64:ff9b::7f00:1

`to_canonical()` returns the address unchanged (not IPv4-mapped). The IPv6 branch checks: not loopback, not unspecified, not ULA, not link-local. Returns `false`. On a NAT64-enabled host, this routes to `127.0.0.1`.

6to4 -- targeting cloud metadata 169.254.169.254
2002:a9fe:a9fe::

Embeds `169.254.169.254` in bits 16-47. Not caught by any IPv6 check.

Teredo -- targeting 10.0.0.1
2001:0000:4136:e378:8000:63bf:f5ff:fffe

Last 32 bits XOR `0xffffffff` = `10.0.0.1`. Not caught.

Attack surface

The `FilteringResolver` is used by SurrealDB's `reqwest`-based HTTP client to enforce network capabilities. Any outbound HTTP request (e.g., from SurrealQL `http::get`/`http::post` functions, webhook deliveries, or OIDC metadata fetches) checks resolved IPs against `is_private_ip`.

Impact

An authenticated user who can trigger outbound HTTP requests (via SurrealQL functions or configuration) can bypass the network capability filter by using transition addresses to reach private/internal IPv4 targets:

  • Cloud instance metadata (AWS/GCP/Azure IMDS at 169.254.169.254)
  • Internal services on private networks
  • Localhost services

Suggested fix

Extract the embedded IPv4 from transition addresses and re-check:

fn is_private_ip(ip: IpAddr) -> bool {
    match ip.to_canonical() {
        IpAddr::V4(v4) => is_private_ipv4(v4),
        IpAddr::V6(v6) => {
            v6.is_loopback()
                || v6.is_unspecified()
                || (v6.segments()[0] & 0xFE00) == 0xFC00
                || (v6.segments()[0] & 0xFFC0) == 0xFE80
                || is_private_transition_ipv6(&v6)
        }
    }
}

fn is_private_transition_ipv6(v6: &Ipv6Addr) -> bool {
    let s = v6.segments();
    // NAT64 64:ff9b::/96
    if s[0] == 0x0064 && s[1] == 0xff9b && s[2] == 0 && s[3] == 0 && s[4] == 0 && s[5] == 0 {
        return is_private_ipv4(Ipv4Addr::new((s[6]>>8) as u8, s[6] as u8, (s[7]>>8) as u8, s[7] as u8));
    }
    // 6to4 2002::/16
    if s[0] == 0x2002 {
        return is_private_ipv4(Ipv4Addr::new((s[1]>>8) as u8, s[1] as u8, (s[2]>>8) as u8, s[2] as u8));
    }
    // Teredo 2001:0000::/32
    if s[0] == 0x2001 && s[1] == 0x0000 {
        return is_private_ipv4(Ipv4Addr::new(((s[6]^0xffff)>>8) as u8, (s[6]^0xffff) as u8, ((s[7]^0xffff)>>8) as u8, (s[7]^0xffff) as u8));
    }
    false
}

Credit

tonghuaroot (https://github.com/tonghuaroot)

Versiones

Rangos afectados

Afectada Corregida Última
surrealdb≥ 3.2.0 < 3.3.0
3.2.0
3.3.0
4.0.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
crates.iosurrealdb
Corregida 3.3.0 -25 d 4.0.1 no afectada
Versiones corregidas3.3.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/surrealdb/surrealdb/security/advisories/GHSA-c9wc-jcr5-8974

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.