llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · network-ai

GHSA-MFXV-JG44-XJ48

network-ai AgentVCR cassette name path traversal allows arbitrary .json file read and write

Parche disponible
Descargar PNG JSON
CVSS 3.1
8.8
Alta
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición34 dDesde la divulgación, 17 oct 2026, 1:17 p. m.
Detección32 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir de cerca
Monitorear y programar la remediación
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico total. Hay versiones corregidas disponibles.
No es drama, es prevención. Hazme caso.Si el fabricante actualiza el aviso, vuelve a mirar.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 5.15.5
Monitoreo
Detectada +1
17 oct 26
19 nov 26
21 nov 26
17 oct 26
26 oct 26
4 nov 26
12 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-MFXV-JG44-XJ48 divulgada · CVSS 8.8 (GitHub)
Remediación Parche 5.15.5 network-ai · 0 d desde divulgación
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

`AgentVCR` in the `network-ai` package constructs cassette file paths by joining a developer-configured base directory with a caller-supplied `name` value and a `.json` suffix, without validating that `name` stays inside the base directory. A caller that controls the `name` argument to `AgentVCR.load()` or `AgentVCR.save()` can use relative traversal sequences such as `../../etc/some-config` to read or write JSON files anywhere the process has filesystem permissions, escaping the intended cassette directory. The capability is a confidentiality and integrity breach limited to paths that resolve to a `.json` suffix.

Root Cause

The `AgentVCR.load(name)` and `AgentVCR.save(name)` methods build the on-disk path with `join(this.config.cassettePath, name + '.json')` and immediately read from or write to that path. Node.js `path.join()` normalizes embedded `..` segments, so a `name` containing relative traversal resolves to a location outside `cassettePath`. The methods perform no normalization-and-containment check (no `resolve()` comparison against the base, no `..` or path-separator rejection, no allowlist) before touching the filesystem. The security invariant that a cassette must reside under the configured `cassettePath` is never enforced.

lib/agent-vcr.ts:170-172  AgentVCR.load():  const filePath = join(this.config.cassettePath, `${name}.json`); await readFile(filePath, 'utf-8')
lib/agent-vcr.ts:181-194  AgentVCR.save():  const filePath = join(this.config.cassettePath, `${name}.json`); await writeFile(filePath, JSON.stringify(this.cassette, null, 2), 'utf-8')

Impact

An attacker who can influence the cassette `name` passed to `load()` or `save()` gains two primitives, both bounded to the process's own filesystem authority and to paths resolving to a `.json` extension. Through `load()` the attacker reads arbitrary `.json` files and receives their contents (the method returns the parsed object), which can disclose configuration, credentials, or other sensitive data stored in JSON. Through `save()` the attacker writes or overwrites arbitrary `.json` files, corrupting application configuration or data files whose names end in `.json`. The written content is not limited to a recorded cassette structure: `load()` assigns the parsed file contents directly to the in-memory cassette and `save()` serializes that object back to disk, so a `load()` followed by a `save()` copies attacker-chosen JSON to an attacker-chosen `.json` path. Where a deployment keeps security state in JSON, this is enough to forge the orchestrator's own policy files. Overwriting the trust-level configuration with a crafted entry caused `AuthGuardian` to issue a grant to an agent that the operator's configuration had placed below the denial threshold, and overwriting the active-grant store invalidated the tokens held by legitimate agents. No remote code execution path was demonstrated. In a multi-agent testing or orchestration deployment, cassette names are commonly derived from test parameters, request data, or agent instructions, any of which may originate from an untrusted source.

Proof of Concept

The following script reproduces the traversal using only temporary directories. It demonstrates the read primitive escaping the configured cassette directory.

TMP=$(mktemp -d)
TMPBASE="$TMP" node -r ts-node/register/transpile-only - <<'TS'
const { AgentVCR } = require('./lib/agent-vcr');
const fs = require('fs');
const path = require('path');

const base = process.env.TMPBASE;
const cassettes = path.join(base, 'cassettes');
const secretDir = path.join(base, 'outside');
fs.mkdirSync(cassettes, { recursive: true });
fs.mkdirSync(secretDir, { recursive: true });
fs.writeFileSync(path.join(secretDir, 'secret.json'), '{"leaked":true}');

const vcr = new AgentVCR({ mode: 'replay', cassettePath: cassettes });

(async () => {
  const traversal = path.relative(cassettes, path.join(secretDir, 'secret'));
  const loaded = await vcr.load(traversal);
  console.log(JSON.stringify({ name: traversal, loaded }, null, 2));
  fs.rmSync(base, { recursive: true, force: true });
})();
TS
{
  "name": "../outside/secret",
  "loaded": { "leaked": true }
}

Attack Chain

  1. Exposure: `AgentVCR` is exported from the package public surface (`index.ts:1150`) and ships in the npm artifact (`dist/lib/agent-vcr.js`, included via the `files` entry in `package.json:136`). A consuming application instantiates it and calls `load()` or `save()`.
  2. Control: The attacker controls the `name` argument. The appended `.json` suffix does not neutralize preceding `..` segments.
  3. Path: `name` flows directly into `join(this.config.cassettePath, name + '.json')` at `lib/agent-vcr.ts:171` (load) and `:193` (save); `path.join()` normalizes the traversal to a location outside `cassettePath`.
  4. Guard: No normalization-and-containment check, separator rejection, or allowlist exists on either method body.
  5. Primitive: The resolved path reaches `readFile()` at `lib/agent-vcr.ts:172` or `writeFile()` at `:194`.
  6. Result: Arbitrary `.json` file read (contents returned) or arbitrary `.json` file write/overwrite, within process filesystem permissions.

Bypass Evidence

No relevant guard or prior fix protects this code path. The published advisory for this package addressed the same class of relative path traversal in `EnvironmentManager.restore()` by adding an identifier regex and a resolved-directory containment assertion in `lib/env-manager.ts`; that remediation is scoped exclusively to `restore()` and does not touch `lib/agent-vcr.ts`. An exhaustive search of `lib/agent-vcr.ts` for `resolve`, `dirname`, `startsWith`, `sanitiz`, `validat`, `check`, `regex`, and `.test(` returned no matches, confirming no validation is applied to `name`. The strongest counter-argument, that `name` might always be a hardcoded constant, does not hold at the library boundary: the public API documents no constraint and enforces none, and the record/replay use case naturally derives cassette names from external parameters.

Affected Versions

  • Ecosystem: `npm`
  • Package: `network-ai`
  • Confirmed affected range: `>= 5.13.4, <= 5.15.4`
  • Latest release checked: `5.15.4` (npm registry https://www.npmjs.com/package/network-ai)
  • Fix status: not fixed

The `lib/agent-vcr.ts` module first appears in release `5.13.4`; it is absent from `5.13.3` and earlier. The vulnerable code is present and unchanged through the latest published release `5.15.4` (git tag `v5.15.4`). No fix for this code path has been released.

Suggested Fix

Enforce that the resolved cassette path remains inside the configured `cassettePath` before any filesystem operation in both `load()` and `save()`. Validate `name` against a strict identifier allowlist (for example `/^[\w-]+$/`) that rejects path separators and `..`, and additionally assert that `dirname(resolve(join(cassettePath, name + '.json'))) === resolve(cassettePath)` so that encoded or platform-specific separator variants cannot escape. Apply the same check to every method that derives a path from a caller-supplied cassette name, mirroring the containment approach already used for `EnvironmentManager.restore()`.

---

Reported by zx.

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:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
8.3/ 10Alto
Vector 8.3 (muy fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
network-ai≥ 5.13.4 ≤ 5.15.4
5.13.4
5.15.4
6.0.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmnetwork-ai
Corregida 5.15.5 0 d 6.0.1 no afectada
Versiones corregidas5.15.5
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/Jovancoding/Network-AI/security/advisories/GHSA-mfxv-jg44-xj48

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