/

CVE-2026-48116

Severity:

HIGH RISK

(7.5)

Command Injection in AnythingLLM Filesystem Agent

CVE-2026-48116

Modified

Vulnerability type

Category:

Command Injection

CWE:

CWE-77, CWE-88

Impact:

Arbitrary Command Execution within Application Container

Severity:

HIGH RISK

(7.5)

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

AnythingLLM's filesystem-search-files agent skill previously passed an LLM-controlled search pattern directly to the ripgrep CLI without a -- end-of-options separator.

An attacker who can chat with an agent on a deployment with the filesystem plugin enabled can craft a pattern that is interpreted as ripgrep options, chaining this with filesystem write capabilities to execute arbitrary commands inside the AnythingLLM server container.

Affected context

This vulnerability affects AnythingLLM deployments where:

  • The filesystem plugin is enabled (enabled by default in the official Docker image).
  • Agents are configured with the filesystem-search-files skill.
  • Untrusted users or external systems can send chat messages that the agent processes.

In this context, user-provided content is transformed into a search pattern that is passed directly to the ripgrep binary without robust argument handling, allowing crafted patterns to be treated as command-line options rather than plain text.

Exploit preconditions

  • Attack surface: The conversational agent interface exposed by AnythingLLM.
  • Required access: Ability to initiate or influence chats with an agent that has the filesystem-search-files skill and access to the filesystem-write-text-file skill (or equivalent write capability).
  • Trigger point: When the agent invokes ripgrep and passes the LLM-controlled pattern as a positional argument without a -- separator.
  • Why exploitation is possible: ripgrep interprets any argument beginning with - as an option. Because the pattern is not validated, escaped, or isolated as data, an attacker can provide patterns like --pre=/bin/sh, causing ripgrep to invoke arbitrary interpreters or commands over files it walks.

Why this happens

The core issue is improper handling of untrusted input when constructing command-line invocations. The filesystem-search-files skill passes an LLM-controlled pattern directly to the ripgrep process as a raw positional argument.

Without a -- end-of-options separator or robust escaping, user-controlled text that begins with - is treated as a flag by ripgrep rather than data. This leads to a form of command injection, where user input indirectly controls which binaries are executed and with what parameters.

This behavior maps to:

  • CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), because user-controlled values affect the behavior of an executed command.
  • CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection'), because user input is incorrectly parsed as command-line options instead of being constrained to a single safe argument.

Potential impact

  • Execution of arbitrary commands or scripts within the AnythingLLM server container.
  • Reading or exfiltrating sensitive files accessible to the server process.
  • Modifying or deleting data on the container filesystem.
  • Using the compromised container as a pivot point for lateral movement within the hosting environment.
  • Tampering with agent behavior, logs, or model inputs/outputs stored on disk.

General mitigation guidance

Effective mitigation centers on treating all command-line arguments derived from user or model-controlled data as untrusted and strictly isolating them as data:

  • Always use a -- end-of-options delimiter when passing user-controlled patterns to CLI tools so they cannot be interpreted as flags.
  • Prefer high-level library APIs (e.g., language-native search or filesystem traversal libraries) instead of shelling out to external binaries.
  • When external commands are necessary, invoke them via parameterized process execution APIs (e.g., execve-style calls or language equivalents) and avoid shell interpretation entirely.
  • Validate and constrain input patterns to a safe subset (e.g., disallow leading -, limit length, restrict special characters when feasible).
  • Run the application and its plugins under least-privilege identities with minimal filesystem permissions to reduce blast radius.
  • Separate read and write capabilities where possible so that an agent with filesystem search features is not also able to create or modify executable content without explicit policy.

How teams detect issues like this

Organizations can identify and monitor similar issues using:

  • Static analysis and code review:
  • Flag any use of external commands where arguments are derived from user or LLM-controlled input.
  • Look for missing -- separators when passing free-form text to CLI tools that treat --prefixed arguments as options.
  • Check for direct concatenation or interpolation of untrusted data into command strings.
  • Security-focused linting and CI policies:
  • Enforce rules that disallow shell invocation APIs (e.g., system, exec with shell, child_process.exec) when untrusted input is involved.
  • Require use of safe process-spawning APIs with explicit argument arrays and documented sanitization steps.
  • Runtime monitoring and logging:
  • Log command executions from the application context, including argument lists, and alert on suspicious patterns such as --pre=, --exec, or unexpected interpreters (e.g., /bin/sh, bash, python).
  • Monitor containers for anomalous process trees spawned from the application.

Sources

SourceLink
github.comgithub.com/Mintplex-Labs/anything-llm/commit/94ed62d320df1a06c229e4bc3ee09c2cb5111b33
github.comgithub.com/Mintplex-Labs/anything-llm/security/advisories/GHSA-6hrp-7mw6-8v59

Frequently asked

questions

Yes, in typical deployments where the agent interface is reachable over a network. An attacker only needs the ability to interact with an agent that has the filesystem-search-files skill and the filesystem write capability enabled; no direct shell access is required.

The attacker must be able to send or influence chat messages to an agent running within AnythingLLM that has the filesystem plugin enabled. No local OS account is needed, but the attack is constrained to what the compromised container's process can access.

The most robust fix is to avoid passing untrusted data directly as command-line flags, use argument-array process APIs, and insert a -- end-of-options separator for any user-controlled values that must be passed to CLI tools. Where possible, replace external tool calls with library-level equivalents that treat inputs as data, not as part of a command line.

Adopt a secure coding standard for command execution: require strict separation of data and code, mandate input validation and escaping for any data flowing into process arguments, prohibit shell-based execution with untrusted input, and integrate automated checks in CI to flag unsafe command construction patterns before they reach production.

Find out what's already
exploitable in your codebase.