llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · flyto-core

GHSA-9X26-9VHM-2QHW

Server-Side Request Forgery (SSRF) in flyto-core

Parche disponible
Descargar PNG JSON
CVSS 3.1
7.7
Alta
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición88 dDesde la divulgación, 23 ago 2026, 9:23 a. m.
Detección87 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 2.29.0
Monitoreo
Detectada +1
23 ago 26
18 nov 26
20 nov 26
23 ago 26
14 sept 26
6 oct 26
29 oct 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-9X26-9VHM-2QHW divulgada · CVSS 7.7 (GitHub)
Remediación Parche 2.29.0 flyto-core · 0 d desde divulgación
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

Server-Side Request Forgery (SSRF) via caller-supplied `connection_string` in the `db.postgresql.query`, `db.mongodb.find` and `db.mongodb.insert` modules. Any workflow executor / MCP client can make the runner open a TCP connection to an arbitrary Postgres/MongoDB server reachable from its network including internal instances (RDS, other VPC/k8s services) and read back the results of arbitrary queries. The three modules are allowed by default and carry no SSRF guard, while their siblings do.

Details

Sink. `src/core/modules/third_party/database/connectors/postgresql.py` (~L96-104):

conn_string = params.get('connection_string') or os.getenv('POSTGRESQL_URL')
...
conn = await asyncpg.connect(conn_string)          # TCP to caller-chosen host, no validation
rows = await conn.fetch(params['query'], *query_params)   # caller-chosen SQL, rows returned in output

Same pattern in `mongodb_find.py` (~L102-107): `AsyncIOMotorClient(conn_string)` with caller-chosen database/collection/filter; and `mongodb_insert.py`: `insert_one/insert_many` (write to internal collections). The caller controls both the target and the query, and results come back in the module output.

No guard anywhere in the chain:
- Default denylist (`src/core/module_policy.py`, `_DEFAULT_DENYLIST`) contains `"database.*"` with the comment `# client-supplied connection_string + raw SQL = SSRF-to-DB` but not `"db.*"`, so these three modules are allowed by default.
- `required_permissions=['database.query']` is not in `_DANGEROUS_PERMISSIONS` → no grant required at dispatch (`mcp_handler.py`).
- The `'ssrf_protected'` tag carried by the three modules is decorative at runtime: it only triggers a static-validator warning (SEC001, `validator.py`), no network check.

Inconsistency with siblings this exact bug was already fixed elsewhere:
- `db.mysql.query` (`mysql.py`, ~L108-112) calls `enforce_outbound_host(host, purpose='MySQL')` with a SECURITY comment describing a caller-supplied host as "SSRF without a URL".
- Atomic modules `database.query/insert/update` call `guard_client_dsn(params)` (`atomic/database/_dsn_guard.py`) and are denylisted by default.

Why the registry-wide coverage test missed it: `tests/core/test_outbound_guard_coverage.py` only tracks params whose *name* matches `OUTBOUND_PARAM_RE` (url|host|endpoint|...). The param is named `connection_string`, so it is invisible to that test (it would have caught `db.mysql.query` via its `host` param).

PoC

Differential E2E test through the real MCP dispatch (`core.mcp_handler.execute_module`). Target: an RFC1918 internal IP with a raw TCP listener on :54329.

Test A (vulnerable):

execute_module('db.postgresql.query', {
  "connection_string": "postgresql://u:p@<internal-ip>:54329/x",
  "query": "SELECT usename, passwd FROM pg_shadow"
})

→ the runner establishes TCP connections to the internal IP; the PostgreSQL startup packet is received by the listener; no `SSRFError` (the final error comes from the listener closing the connection, not a guard).

Test B (control): same internal IP as `host` in `db.mysql.query` → rejected before any TCP:
`"SSRF blocked: MySQL host '<ip>' resolves to the private/link-local address <ip>. Set FLYTO_ALLOWED_HOSTS or FLYTO_ALLOW_PRIVATE_NETWORK=true to permit it."`

Mongo variant: `execute_module('db.mongodb.find', {"connection_string": "mongodb://<internal-ip>:27017", "database": "prod", "collection": "sessions", "filter": {}})`.

Reproduction script available on request (`poc_dsn_ssrf.py`).

Impact
  • TCP from the runner to any reachable Postgres/MongoDB: internal RDS, instances of other services in the VPC/k8s.
  • Arbitrary SQL / Mongo filter on the target with full readback of results (`pg_shadow`, business tables) → data exfiltration by an unprivileged caller.
  • `db.mongodb.insert`: writing attacker-chosen documents into internal collections (integrity).
  • Internal port scan / reachability oracle via distinct error messages and timeouts, with no credentials required exactly what the docstring of `enforce_outbound_host` warns about ("turns any such module into an internal port scanner").

Suggested fix: apply `guard_client_dsn(params)` (or at least parse host/port and call `enforce_outbound_host(...)`) at the top of the three handlers, as done in `db.mysql.query` / `database.*`, and add `"db.*"` to `_DEFAULT_DENYLIST` if parity with `"database.*"` is intended.

CVSS 3.1: `AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N` (7.7, High).

Credit for the CVE

Arthur Gurunlian

---

Maintainer note

Fixed in `2.29.0`. The three handlers now pull every host out of the connection string and run `enforce_outbound_host` on each, matching what `db.mysql.query` does with its `host` parameter. Two details beyond the suggestion:

  • The guard runs before the driver import. Previously the module raised `ImportError` first on a host without `asyncpg`/`motor` installed, which made such a deployment look safe by accident rather than being protected.
  • Every host in a replica-set URI is checked, not just the first. `urlsplit().hostname` reports only one host of `mongodb://public:27017,internal:27017/db`, so a URI whose first host is innocuous would otherwise have carried an internal second host past the check.

`guard_client_dsn` was not used here, and `"db.*"` was not added to `_DEFAULT_DENYLIST`: both would refuse caller-supplied connection targets outright, which is a different policy from the one the `db.*` family already implements in `db.mysql.query`. Parity with the guarded sibling in the same family was chosen over parity with `database.*`.

The report's explanation of why the registry-wide coverage test missed this is exactly right, and that gate has been widened: `connection_string`, `connection_uri` and `dsn` now count as outbound parameter names, on the grounds that a DSN is a whole network target packed into one string that looks nothing like a host. `domain` was added for the same reason.

Regression tests: `tests/core/test_reported_advisories_2026_08_19.py` — `test_client_dsn_cannot_reach_a_private_target`, `test_mongodb_multi_host_dsn_checks_every_host`, `test_loopback_dsn_stays_allowed`.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:C
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
flyto-core≤ 2.28.1
2.28.1
2.41.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypiflyto-core
Corregida 2.29.0 0 d 2.41.0 no afectada
Versiones corregidas2.29.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/flytohub/flyto-core/security/advisories/GHSA-9x26-9vhm-2qhw

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