GHSA-CQV6-3M5F-QVW2
env.set returns any host environment variable via previous_value, exposing secrets to authenticated module-execution API clients
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CQV6-3M5F-QVW2 divulgada · CVSS 7.6 (GitHub) | |
| Remediación | Parche 2.33.0 | flyto-core · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The `env.set` module returns the prior value of any process environment variable in its `previous_value` output field. Because `env.set` is absent from the module capability denylist and declares no required permissions, an authenticated caller of the module-execution API (the HTTP MCP `tools/call` -> `execute_module` path and the REST `POST /v1/execute` route) can read any host environment variable (API keys, database credentials, cloud and OAuth tokens) under the default shipped configuration. The sibling `env.get` module is denylisted specifically to prevent this class of secret exfiltration, but `env.set` reaches the same read capability through an unguarded output field.
Root Cause
The module capability policy is deny-by-default. `core.module_policy._DEFAULT_DENYLIST` (`src/core/module_policy.py:45-67`) lists `env.get` with the inline rationale "reads ANY host env var (API keys/DSNs) = secret exfil", and also denies `env.load_dotenv`. The `env.set` module provides an equivalent read primitive that the policy does not cover: before writing, it captures `previous_value = os.environ.get(name)` for a caller-controlled `name` and returns it to the caller. `env.set` is not on the denylist and declares `required_permissions=[]`, so the transport capability gates (`_module_is_allowed`, `_module_missing_permissions` in `src/core/mcp_handler.py`) and the engine backstop (`enforce_module_policy` in `src/core/module_policy.py`) all pass it. The module response is serialized and returned verbatim on the live response path with no output redaction. The protection boundary that withholds host environment reads from a constrained client is therefore incomplete: it covers the read-oriented module (`env.get`) and `${env.*}` interpolation, but not the read side effect that `env.set` performs and discloses.
Affected function: core.modules.atomic.env.set.env_set (src/core/modules/atomic/env/set.py)
- line 110: previous_value = os.environ.get(name) # caller-controlled name
- lines 114-121: returns data.previous_value (host secret) # unredacted
Missing control surface (data constant, not a callable):
- core.module_policy._DEFAULT_DENYLIST (src/core/module_policy.py:45-67) omits "env.set"
Unredacted live response path:
- src/core/mcp_handler.py: execute_module returns result verbatim (line 459)
- src/core/mcp_handler.py:1275-1285: text = json.dumps(result, ...); structuredContent = resultImpact
An authenticated caller of the module-execution API can disclose the value of any single host environment variable per request under the default configuration. The prerequisite is a valid Execution-API bearer token: the module-execution transport is deny-by-default and fails closed (unauthenticated requests receive 401, and an uninitialized token yields 503), and the server refuses to bind to a non-loopback interface without active authentication, so this is not reachable pre-authentication. The intended trust model, stated in the policy source, contemplates constraining token-holding but untrusted or red-team clients to a safe module subset via the denylist; `env.set` grants exactly the host-secret read capability the denylist deliberately withholds from such clients, so it crosses a boundary that the bearer token alone does not already grant.
Each read additionally performs a mandatory write: `os.environ[name]` is overwritten with the caller-supplied value, corrupting the targeted variable for the running process. When the clobbered variable is a live credential or `PATH`, this degrades the affected process behavior (an integrity and availability effect that follows directly from the same single action). Plausible follow-on, not separately demonstrated here: writing a permissive glob to `FLYTO_ENV_VAR_ALLOWLIST` re-enables `${env.*}` interpolation reads process-wide, because that allowlist is consulted live at call time; this is a consequence of the write primitive and is distinct from the demonstrated read.
Proof of Concept
Setup: run the server with the default configuration (auto-minted bearer token, default denylist) and a secret in the environment, then invoke `env.set` through the MCP `execute_module` tool with the token, naming a target variable.
1. Start flyto-core with a host secret present, e.g. AWS_SECRET_ACCESS_KEY set in the process environment.
2. Read the auto-minted bearer token from its token file (or set FLYTO_API_TOKEN).
3. Send an authenticated JSON-RPC tools/call for execute_module -> env.set naming the secret.POST /mcp
Authorization: Bearer <execu...ype: application/json
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "execute_module",
"arguments": {
"module_id": "env.set",
"params": { "name": "AWS_SECRET_ACCESS_KEY", "value": "x" }
}
}
}Response content (text / structuredContent), returned unredacted:
{
"ok": true,
"data": {
"name": "AWS_SECRET_ACCESS_KEY",
"value": "x",
"previous_value": "<the real host secret is disclosed here>"
}
}Attack Chain
- Exposure: The module-execution API is reachable over the network via the HTTP MCP transport (`POST /mcp`, `tools/call`) and the REST route (`POST /v1/execute`). Both require a valid Execution-API bearer token, which the server mints at startup and enforces fail-closed.
- Control: The authenticated caller fully controls the `module_id` (`env.set`) and the `name` parameter (the target environment variable). No sanitization or normalization is applied to `name`.
- Path: `tools/call` -> `_handle_tool_call` -> `execute_module` -> `ModuleRegistry.get("env.set")` -> `env_set()`. The direct module path does not pass through the step executor, so the persisted-output redactor never runs.
- Guard: The capability denylist and the dangerous-permission gate are the intended controls. `env.set` is not on the denylist and declares `required_permissions=[]`, so both gates and the engine backstop pass it. No output redaction is wired into the live response path.
- Primitive: `env_set()` reads `os.environ.get(name)` into `previous_value`, overwrites `os.environ[name]`, and returns the captured prior value.
- Result: Disclosure of any single host environment variable (credentials, tokens, connection strings) to a constrained authenticated client that the denylist is designed to withhold such reads from, plus a mandatory overwrite of the targeted variable.
Bypass Evidence
The relevant guard is the deny-by-default module capability policy. `env.get` is denied (verified: `module_filter.is_allowed("env.get")` is `False`), while `env.set` is allowed (`module_filter.is_allowed("env.set")` is `True`) because it is not present in `_DEFAULT_DENYLIST` and declares no dangerous permission. The `${env.*}` interpolation control (`is_env_var_allowed`) is called only from the engine variable resolver (`src/core/engine/variable_resolver.py`) and gates interpolation, not the `env.set` module output, so it does not run on this path. There is no redaction on the live module-execution response: a search for redaction in `src/core/mcp_handler.py` finds none, and `_handle_tool_call` emits `json.dumps(result)` and `structuredContent = result` directly.
Attempts to invalidate the finding, and their outcomes:
- Is the path reachable without authentication? No. `POST /mcp` and `POST /v1/execute` both carry `Depends(require_auth)`, which returns 401 on a missing or bad token and 503 when auth is uninitialized; `init_auth` always mints a token (no auth-disabled mode), and `enforce_bind_policy` refuses a non-loopback bind without active auth. This holds at tags v2.28.0, v2.29.0, v2.31.2 and the examined HEAD. Reachability is therefore authenticated only.
- Is `previous_value` redacted anywhere on this path? No, as shown above.
- Is this merely working as designed for a token holder? No. The policy explicitly withholds host environment reads (`env.get` is denied for that exact reason) and the documented model constrains untrusted token-holding clients to a safe subset; `env.set` grants a capability beyond what the bearer token is intended to confer.
- Is this a duplicate of the `${env.*}` interpolation advisory (CVE-2026-67427)? No. That control gates interpolation at a single resolver call site and is unaffected here; `env.set` is a distinct sink with a distinct remediation boundary, and its output field is not covered by that fix.
Affected Versions
- `Ecosystem: pip`
- `Package: flyto-core`
- `Confirmed affected range: >= 2.28.0`
- `Latest release checked: 2.32.1 on PyPI (https://pypi.org/project/flyto-core/), matching repository source at commit 7911c9cbdb3a7d1cea7818608ceaf61057ebf5f2, corroborated at git tags v2.28.0, v2.29.0, v2.31.2`
- `Fix status: not fixed`
The vulnerable condition (`env_set` returning `previous_value`, and `env.set` absent from `_DEFAULT_DENYLIST`) is present at every inspected tag from v2.28.0 through the examined HEAD, and the module-execution auth guard is present across the same range, so the authenticated reachability applies throughout. The introduction boundary below v2.28.0 could not be established because the repository history is a single squashed import with no earlier tags. The latest published version on PyPI is 2.32.1, which matches the examined source tree.
Suggested Fix
Enforce the same host-environment-read boundary on `env.set` that already applies to `env.get`. Concretely: add `env.set` (or an `env.*` scope) to `_DEFAULT_DENYLIST`, and/or stop returning `previous_value` for a variable that is not permitted by the environment allowlist, so the read side effect is gated through the same `is_env_var_allowed` policy as `env.get` and `${env.*}` interpolation. The remediation should cover the direct module-execution path as well as any recipe, foreach, composite, or nested-invocation caller, and should not rely on output redaction alone.
Interim mitigation without a code change: operators serving untrusted authenticated clients can set a restrictive `FLYTO_MODULE_ALLOWLIST` that omits `env.set` (and `env.*`), which blocks the module at the capability filter.
Reported by zx (GitHub: @manus-pi).
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.33.0 | 0 d | 2.41.0 no afectada |
2.33.0Arsenal 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-cqv6-3m5f-qvw2Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
