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

GHSA-PP5W-W9C3-QFV2

SSRF via unchecked caller-supplied base_url in llm.agent (inline model config)

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-PP5W-W9C3-QFV2 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 the caller-supplied `base_url` parameter of the `llm.agent` module. When the model is configured inline (no `ai.model` sub-node connected), `base_url` goes into a raw HTTP POST to `{base_url}/chat/completions` with no SSRF validation and no port restriction. Any workflow executor / MCP client can make the runner send an attacker-bodied POST to any internal host:port (cloud metadata, k8s API, internal proxies) and read back the response up to the full content when the target answers in OpenAI-compatible format.

Details

Vulnerable path. `src/core/modules/atomic/llm/agent.py`, `_resolve_chat_model()` (~L879-923): inline params `provider` / `model` / `api_key` / `base_url` are used when no `ai.model` sub-node is connected. The only guard on this path is:

assert_env_credential_endpoint_allowed(caller_base_url, key_from_env)   # only guard on this path

When the caller supplies their own `api_key`, `key_from_env=False` and the function returns without checking anything (`src/core/utils.py`, ~L1075-1076). Its docstring states it explicitly: *"A caller-supplied key going anywhere is fine (it is the caller's own secret, not the operator's)."* That guard was added for GHSA-qq9q (exfiltration of the env-derived LLM key to an attacker endpoint) its scope is anti-key-exfil, not SSRF.

Sink. `src/core/modules/atomic/llm/_chat_models.py`:
- ~L135: `self._base_url = (base_url or "https://api.openai.com/v1").rstrip("/")` stored as-is;
- ~L154: `url = f"{self._base_url}/chat/completions"` attacker controls host, port and path prefix;
- ~L97-115 (`_http_post`): raw `httpx.AsyncClient().post(url, ...)` (aiohttp fallback), no guard, no custom resolver/transport.

Readback: HTTP >= 500 → first 200 bytes of the body in the error message; JSON without `choices` → up to 300 bytes (`json.dumps(result)[:300]`); valid OpenAI-shaped response → full content returned as the agent's final answer in `data.result` (`agent.py` ~L543-550).

No port restriction. Unlike its siblings, this path accepts any port (22, 5432, 6379, ...), enabling internal host/port discovery.

Inconsistency with siblings the same param is guarded in the same family:
- `llm.chat` (`src/core/modules/atomic/llm/chat.py`, ~L155-164): `# SECURITY: Validate custom base URL for SSRF` → `validate_url_with_env_config(base_url)`.
- `ai.model` (`src/core/modules/atomic/ai/model.py`, ~L140-149): same guard, with the comment *"(was previously unchecked here)"* proof this exact bug was already fixed elsewhere in the family.

`validate_url_ssrf()` blocks cloud metadata endpoints, enforces a port allowlist {80, 443, 8080, 8443}, resolves DNS and blocks private IPs on all resolved addresses (fail-closed). None of that applies to the `llm.agent` inline path.

PoC

Differential E2E test through the real MCP dispatch (`core.mcp_handler.execute_module`). Fake OpenAI-compatible server listening on an RFC1918 internal IP (:54331); env `FLYTO_GRANTED_PERMISSIONS=shell.execute` (the permission `llm.agent` itself declares, so any deployment using it already granted it).

Test A (vulnerable):

execute_module('llm.agent', {
  "task": "Say hello",
  "provider": "openai",
  "model": "gpt-4o",
  "api_key": "sk-caller-own-key",
  "base_url": "http://<internal-ip>:54331/v1"
})

→ POST received on the internal endpoint with `Authorization: Bearer sk-caller-own-key` and an attacker-controlled body; the fake server's answer comes back intact in `data.result`.

Test B (control): same `base_url` via `llm.chat` → blocked before any request:
`"Port 54331 not allowed. Allowed ports: [80, 443, 8080, 8443]"` (`error_code: SSRF_BLOCKED`).

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

Impact
  • SSRF POST to arbitrary host:port from the runner's network position (cloud metadata `169.254.169.254`, k8s API, internal proxies/admin panels) no port restriction.
  • Readback of responses: 200-300 bytes via error messages, or full content for OpenAI-shaped answers.
  • POST body (messages/model/temperature) is attacker-controlled → usable as a payload against services that parse their body.

Suggested fix: call `validate_url_with_env_config(base_url)` in the inline path of `_resolve_chat_model()` before `create_chat_model`, exactly like `llm.chat` (~L156-164) and `ai.model` (~L141-149), with the same `error_code='SSRF_BLOCKED'`.

CVSS 3.1: `AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N` (7.7, High ased on the full response readback demonstrated in PoC;)

Credit for the CVE

Arthur Gurunlian

---

Maintainer note

Fixed in `2.29.0`, exactly as suggested: `_resolve_chat_model` now calls `validate_url_with_env_config` on the caller-supplied `base_url` before `create_chat_model`, with `error_code: 'SSRF_BLOCKED'` matching `llm.chat` and `ai.model`. The port allowlist the report's control test demonstrated (`Port 54331 not allowed`) now applies on this path too. The backward-compatible sub-node config dict reaches the same builder and gets the same check.

The analysis that `assert_env_credential_endpoint_allowed` is an anti-key-exfil control rather than an SSRF one was also the reason the project's registry-wide outbound coverage gate reported `llm.agent` as guarded: that symbol was in the gate's list of accepted guards, and has now been removed from it.

`GHSA-f9q4-fp8j-r5h7` is an independent report of this same parameter; both are credited and both are fixed by this change.

Regression tests: `tests/core/test_reported_advisories_2026_08_19.py` — `test_llm_agent_inline_base_url_is_ssrf_guarded`, `test_llm_agent_sub_node_config_base_url_is_ssrf_guarded`, `test_llm_agent_reports_ssrf_blocked`.

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-pp5w-w9c3-qfv2

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