/

CVE-2026-18482

Severity:

CRITICAL RISK

(9.8)

OS Command Injection (CWE-78) in Neo.mjs MCP Server

CVE-2026-18482

Awaiting Analysis

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary OS Command Execution

Severity:

CRITICAL RISK

(9.8)

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

A critical OS command injection vulnerability in Neo.mjs allows caller-controlled absolutePath values to be inserted into shell commands by the FileSystemService.mjs component.

If an AI agent can be induced to invoke the affected MCP tools, an attacker may execute arbitrary operating-system commands with the privileges of the MCP server process.

Affected context

The vulnerability occurs in the ai/mcp/server/file-system MCP server, specifically in the checkSyntax() and runPlaywrightTest() functions. It becomes risky when an AI agent is available to invoke these tools and attacker-influenced absolutePath values can reach the command construction logic without effective validation or safe argument handling.

Exploit preconditions

  • Attack surface: File-system MCP server tools exposed to an AI agent or connected client
  • Required access: Ability to influence tool arguments or induce an agent to submit attacker-controlled path values
  • Trigger point: Invocation of checkSyntax() or runPlaywrightTest()
  • Why exploitation is possible: Caller-controlled absolutePath values are unsafely interpolated into shell commands, allowing command syntax to be interpreted by the operating system

Why this happens

The underlying bug is command construction from untrusted input. The affected functions interpolate a caller-controlled path into a shell command rather than treating it strictly as data or passing it through a safe argument interface.

This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, commonly known as OS command injection. Shell metacharacters or other command syntax contained in the input may alter the intended command behavior.

Potential impact

  • An attacker may execute arbitrary OS commands in the MCP server environment.
  • The process may access files, services, or credentials available to its runtime identity.
  • The vulnerability could enable data theft, tampering, or destructive activity.
  • A compromised server could facilitate lateral movement or broader system compromise.
  • AI-agent workflows and connected developer environments may be affected.

General mitigation guidance

Mitigation generally focuses on removing shell interpretation from file-processing workflows and reducing trust in agent-supplied arguments.

Common defensive patterns include:

  • Using APIs that execute programs directly with structured argument arrays instead of invoking a shell.
  • Treating tool parameters as untrusted data and applying strict path validation, canonicalization, and allowlisting.
  • Restricting file operations to approved directories and rejecting unexpected path forms.
  • Separating syntax checking and test execution from highly privileged environments.
  • Running MCP services with least-privilege identities, restricted filesystem access, and minimal network permissions.
  • Applying explicit authorization and confirmation controls to tools capable of executing commands.
  • Avoiding reliance on escaping alone when a shell-free execution alternative is available.

How teams detect issues like this

Detection approaches commonly include:

  • Static analysis rules for string interpolation or concatenation used to build shell commands.
  • Code review checks for subprocess, shell, exec, or spawn APIs receiving tool parameters.
  • Testing with metacharacters and boundary values to verify that inputs remain data rather than executable syntax.
  • Policy enforcement requiring shell-free process execution and approved path allowlists for MCP tools.
  • Runtime monitoring for unexpected child processes, command-line patterns, file access, or network activity from the MCP server.

Automated security review tools can help identify command construction paths, but findings should be validated against actual agent-to-tool data flows.

Sources

SourceLink
github.comgithub.com/neomjs/neo/commit/5acc564ea1b278bca5fab1f8f397a6ba9b849d75
github.comgithub.com/neomjs/neo/commit/88c77fc4
novice-22.comnovice-22.com/posts/neo-mjs/

Frequently asked

questions

It can be exploitable through a connected AI agent or MCP client when the attacker can influence tool arguments or cause the agent to invoke the affected functions. The exact reachability depends on how the MCP server is exposed and authorized.

Authentication requirements depend on the deployment. An attacker generally needs access to a client, agent workflow, or integration that can reach the vulnerable file-system tools.

Avoid shell interpretation for operations involving caller-controlled paths. Use structured process APIs, strict path and argument validation, and narrowly scoped execution privileges.

Treat all agent- and client-provided tool arguments as untrusted, enforce tool-level authorization, review subprocess usage, and monitor MCP services for abnormal process execution.

Find out what's already
exploitable in your codebase.