/

CVE-2026-54051

Severity:

CRITICAL RISK

(9.9)

Command Injection (CWE-78) in Network-AI Sandbox

CVE-2026-54051

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

CRITICAL RISK

(9.9)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Network-AI's agent sandbox uses a command allowlist that glob-matches full shell command strings, but then executes them via /bin/sh -c, allowing shell metacharacters to bypass intended restrictions.

If an attacker controls an agent's command string and any broad pattern like git *, npm *, or node * is allowed, they can append additional shell commands and achieve arbitrary command execution in the orchestrator environment.

Affected context

This vulnerability arises in Network-AI deployments where:

  • The ShellExecutor runs commands through /bin/sh -c
  • The sandbox allowlist (SandboxPolicy.isCommandAllowed) uses glob patterns over the entire command string
  • Broad patterns such as git *, npm *, node *, or similar are present to allow scoped tool usage

In such setups, a compromised or malicious agent that can propose shell commands gains a path to escape intended sandbox boundaries.

Exploit preconditions

  • Attack surface: Agent command execution interface within Network-AI
  • Required access: Ability for an adversary to influence or control the shell command string sent to ShellExecutor (e.g., compromised agent, malicious tool, or untrusted workflow definition)
  • Trigger point: Execution of an allowed command pattern, such as git *, which is passed to /bin/sh -c without strict tokenization
  • Why exploitation is possible: The allowlist checks only a glob match on the full string, while /bin/sh -c interprets shell metacharacters (;, &, |, etc.), so a seemingly limited command like git status; evil still matches git * yet executes additional attacker-supplied commands.

Why this happens

The core issue is an overly permissive and incorrectly layered command validation strategy.

Instead of validating discrete executable paths and arguments, the sandbox applies glob patterns to the entire command string and then delegates interpretation to a shell (/bin/sh -c), which expands metacharacters and composes pipelines.

This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because shell metacharacters are not rejected or isolated before execution, allowing injection of additional commands beyond the intended allowed tool call.

Potential impact

  • Compromise of the Network-AI orchestrator host via arbitrary command execution
  • Exfiltration or destruction of data accessible to the orchestrator process
  • Installation of backdoors or persistence mechanisms on the underlying system
  • Abuse of CI/CD or automation environments for supply-chain attacks
  • Lateral movement to other services reachable from the orchestrator environment

General mitigation guidance

Effective mitigation focuses on removing shell interpretation from the command path and tightening command validation semantics.

Pattern-based strategies include:

  • Executing commands via direct process spawning with explicit executable and argument arrays, avoiding /bin/sh -c or equivalent shells
  • Introducing a quote-aware tokenizer that separates program names and arguments before any allowlist evaluation
  • Enforcing allowlists on normalized command tokens (e.g., specific binaries and whitelisted argument patterns) rather than on raw strings
  • Rejecting unquoted shell metacharacters (;, &, |, $, backticks, (, ), <, >, {, }, and newlines) at the sandbox boundary
  • Reducing trust in agents by limiting which tools they can invoke and aligning privileges with least-privilege principles
  • Avoiding broad wildcard rules such as node * or npm * and preferring narrowly scoped, task-specific allowlist entries

How teams detect issues like this

Detection can rely on both static and runtime signals.

Common approaches include:

  • Static analysis rules that flag use of /bin/sh -c or similar APIs when combined with dynamic input from agents or workflows
  • Code review checklists that require commands to be built from structured argv arrays and prohibit raw string shells in sandboxed contexts
  • Configuration reviews that highlight overly broad allowlist entries (e.g., *, git *, npm *, node *) and require justification
  • Logging and monitoring of executed commands, with alerts on suspicious shell metacharacters or multi-command sequences originating from agents
  • Incorporation of automated security scanning tools in CI pipelines to enforce policies on process execution and sandbox enforcement code

Sources

SourceLink
github.comgithub.com/Jovancoding/Network-AI/commit/379f77656b578144e03415c5b134d8309a4b5792
github.comgithub.com/Jovancoding/Network-AI/security/advisories/GHSA-qw6v-5fcf-5666

Frequently asked

questions

Exploitability depends on whether an attacker can influence agent-issued commands and whether the allowlist contains broad patterns; in environments where agents execute workflows derived from untrusted or semi-trusted sources, the risk extends to full arbitrary code execution.

The attacker must be able to control or significantly influence the commands that the sandboxed agent submits, such as by compromising an agent, supplying untrusted workflows, or controlling upstream inputs that are transformed directly into shell commands.

The most robust fix is to eliminate shell-based execution of arbitrary strings by using process spawning with explicit argv arrays, coupled with strict tokenization and allowlisting on the executable and its arguments, and to systematically remove or narrow any broad wildcard rules.

Future systems should treat shell invocation as a last resort, prefer structured APIs that separate command and arguments, enforce early rejection of shell metacharacters, design allowlists around well-defined tools and argument schemas, and integrate security reviews for any component that constructs or executes OS-level commands.

Find out what's already
exploitable in your codebase.