/

CVE-2026-25130

Severity:

CRITICAL RISK

(9.6)

OS Command Injection in Cybersecurity AI Function Tools via

CVE-2026-25130

Awaiting Analysis

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.6)

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

The Cybersecurity AI (CAI) framework up to version 0.5.10 contains OS command injection vulnerabilities in several function tools that invoke shell commands with user-controlled arguments.

Because user input is passed directly into subprocess.Popen(..., shell=True) and some tools like find_file() run without explicit user approval, an attacker can inject additional shell arguments to achieve remote code execution on the host system, bypassing human-in-the-loop safeguards.

Affected context

This vulnerability occurs in CAI deployments that:

  • Expose function tools which internally use subprocess.Popen(..., shell=True)
  • Accept user-controlled or model-controlled arguments that are concatenated into shell command strings
  • Treat certain commands (for example, find in find_file()) as "safe" and auto-approved, running them without additional human confirmation

The risk is most pronounced when CAI is connected to external users, chat interfaces, or autonomous agents that can influence tool arguments.

Exploit preconditions

  • Attack surface: Any CAI function tool that builds shell commands from user or model input and executes them via subprocess.Popen(..., shell=True)
  • Required access: Ability to supply or influence the args (or equivalent) parameter to vulnerable tools, either directly as a user or indirectly through prompts to the AI agent
  • Trigger point: Invocation of the tool, such as find_file(), which passes the supplied arguments to the shell without sufficient sanitization or escaping
  • Why exploitation is possible: The shell interprets injected tokens (e.g., additional flags or command separators) as part of the command line; with shell=True, these tokens can introduce new commands (like -exec or ;) that run with the same privileges as the CAI process, and pre-approval of "safe" base commands removes the human review step.

Why this happens

The underlying issue is the construction and execution of shell commands from externally influenced strings using subprocess.Popen(..., shell=True) without robust validation, escaping, or argument separation.

Instead of treating untrusted input as opaque data, the vulnerable tools embed it directly into command lines, allowing the shell to parse and expand it as executable syntax. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where delimiters, operators, or additional arguments can be injected to alter command behavior or append new commands. The assumption that certain base commands (like find) are inherently "safe" led to pre-approval, but the danger lies in their arguments, not just the command name.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the CAI host process
  • Reading, modifying, or deleting files accessible to the CAI runtime
  • Stealing secrets such as API keys, model credentials, or configuration data
  • Installing backdoors or additional malware on the host system
  • Pivoting to other internal services or networks reachable from the compromised host
  • Undermining any "human-in-the-loop" safety controls by exploiting pre-approved tools

General mitigation guidance

Effective mitigation focuses on removing command injection sinks and tightening trust boundaries around tool execution:

  • Prefer API-level or library calls over shell commands wherever possible, so arguments are handled as structured parameters rather than shell-parsed strings.
  • If shell execution is unavoidable, use subprocess.Popen (or similar) with shell=False, passing arguments as a list to avoid shell parsing.
  • Enforce strict allowlists for commands and flags, validating each argument against a constrained schema instead of interpolating free-form strings.
  • Treat all user-controlled or model-controlled parameters as untrusted, even for commands perceived as "safe"; remove blanket pre-approvals and require explicit policies for tool usage.
  • Run CAI workloads with least-privilege OS accounts, minimizing filesystem and network access so that a successful injection yields limited damage.
  • Consider sandboxed execution environments (containers, jails, or restricted VMs) for tools that need shell access, isolating them from sensitive host resources.

How teams detect issues like this

Detection can combine code-level analysis with runtime monitoring:

  • Use static analysis or linters to flag:
  • subprocess (or equivalent) calls using shell=True
  • String concatenation or interpolation that mixes user/model input with command lines
  • Tool wrappers that treat certain commands as "safe" without validating their arguments
  • Incorporate security-focused code review checklists that ask:
  • "Does this tool execute shell commands? If yes, how are arguments constructed and validated?"
  • "Can an external user or AI agent influence any part of this command string?"
  • Apply policy enforcement in CI/CD pipelines:
  • Reject changes that introduce new shell=True usages or raw shell command construction
  • Require explicit security sign-off for any tool that interacts with the OS shell
  • At runtime, monitor for unusual child process patterns (unexpected commands, suspicious flags, or high-risk utilities) spawned by CAI processes and alert on anomalies.

Sources

SourceLink
github.comgithub.com/aliasrobotics/cai/blob/559de8fcbc2b44f3b0360f35ffdc2bb975e7d7e4/src/cai/tools/reconnaissance/filesystem.py#L60
github.comgithub.com/aliasrobotics/cai/commit/e22a1220f764e2d7cf9da6d6144926f53ca01cde
github.comgithub.com/aliasrobotics/cai/security/advisories/GHSA-jfpc-wj3m-qw2m

Frequently asked

questions

Yes. If CAI is exposed through a network interface (such as an API, chat frontend, or agent endpoint) that allows remote users to influence tool arguments, an attacker can exploit the vulnerability remotely by crafting input that leads the agent to call vulnerable tools with malicious parameters.

The attacker needs the ability to control or meaningfully influence the arguments passed to vulnerable function tools—for example, by supplying input to an AI conversation, prompt, or API that ultimately becomes args to a shell command. No direct shell or system-level access is required beyond that.

The safest pattern is to eliminate shell-based execution of untrusted input. Replace shell commands with direct library or API calls; where shell use is unavoidable, disable shell=True, pass arguments as a list, and strictly validate or whitelist all parameters before execution. Also, remove auto-approval of tools whose behavior depends on user-controlled arguments.

Design tools under a "no direct shell from user input" principle. Treat all AI- or user-supplied strings as untrusted, avoid interpolating them into command lines, and enforce defensive coding guidelines (no shell=True, argument whitelisting, least privilege). Incorporate security checks into CI/CD and perform regular reviews of new tools to ensure they do not introduce injection-capable sinks.

Find out what's already
exploitable in your codebase.