/

CVE-2026-10214

Severity:

HIGH RISK

(7.3)

OS Command Injection in chatgpt-on-wechat Bash Tool

CVE-2026-10214

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution via Shell Command Injection

Severity:

HIGH RISK

(7.3)

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 command injection vulnerability in the Bash Tool component of chatgpt-on-wechat up to version 2.0.8 allows attacker-controlled input to be incorporated into shell commands without proper sanitization.

When untrusted data reaches the _get_safety_warning function in agent/tools/bash/bash.py, a remote attacker may be able to execute arbitrary OS commands under the privileges of the running application.

Affected context

This weakness appears in deployments of chatgpt-on-wechat that:

  • Enable and expose the Bash Tool functionality
  • Allow user-controlled or external input to reach the _get_safety_warning logic
  • Execute shell commands on the host or container environment based on that input

The risk is higher when the bot is reachable from untrusted networks or integrated into workflows where user messages can influence command strings.

Exploit preconditions

  • Attack surface: Network-accessible chatgpt-on-wechat instance with Bash Tool enabled.
  • Required access: Ability to send crafted input that is processed by the Bash Tool and reaches _get_safety_warning.
  • Trigger point: Invocation of functionality that constructs and executes shell commands based on attacker-influenced data.
  • Why exploitation is possible: The code builds OS command strings using unvalidated, unsanitized input and passes them to a shell interpreter, allowing injection of additional commands or arguments.

Why this happens

The root cause aligns with CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') and CWE-78: Improper Neutralization of Special Elements used in an OS Command.

In _get_safety_warning, application logic appears to concatenate or interpolate user-influenced data into a shell command line and execute it through a system shell.

By failing to strictly validate or neutralize shell metacharacters and by invoking a general-purpose shell instead of parameterized APIs, the implementation allows crafted input to break out of the intended command structure and execute arbitrary OS commands.

Potential impact

  • Remote execution of arbitrary OS commands under the application's OS account
  • Access to sensitive configuration, environment variables, or chat logs
  • Lateral movement within the host or container environment
  • Data exfiltration, modification, or destruction on the affected system
  • Use of the compromised instance as a pivot for broader network attacks

General mitigation guidance

Effective mitigation for this vulnerability class generally focuses on avoiding direct shell invocation with untrusted data and reducing the privileges of any components that must run commands.

Recommended defensive patterns include:

  • Prefer high-level language APIs or dedicated libraries for system operations instead of building raw shell command strings.
  • If command-line tools are unavoidable, use parameterized execution (e.g., passing arguments as lists) and avoid shell=True-style execution.
  • Strictly validate and constrain any inputs that can influence commands to a safe, allow-listed set of values (e.g., enumerated options, fixed subcommands).
  • Implement robust input normalization and rejection of shell metacharacters where user-provided tokens are necessary.
  • Run the Bash Tool and related components under a minimally privileged OS user, and isolate them using containers or sandboxes where feasible.
  • Limit access to the Bash Tool feature to trusted users or controlled environments, and disable it when not strictly required.

How teams detect issues like this

Detection typically combines code-centric review with runtime monitoring:

  • Static analysis and code review:
  • Search for uses of shell execution APIs (e.g., subprocess with shell invocation, os.system, or similar) that accept variables derived from user or network input.
  • Flag dynamic command construction patterns such as string concatenation, f-strings, or formatting that mix user data into command lines.
  • Enforce secure-coding guidelines or linters that prohibit shell-based execution when untrusted data is involved.
  • Automated tooling:
  • Use application security testing tools and SAST scanners configured with rules for OS command injection (CWE-77/CWE-78).
  • Integrate these tools into CI pipelines to block risky patterns before deployment.
  • Runtime and operational monitoring:
  • Monitor the application host or container for abnormal process creation behavior (unexpected shells, unusual command arguments).
  • Log and review invocations of the Bash Tool, especially where user messages or external events influence command execution.

Sources

SourceLink
github.comgithub.com/zhayujie/CowAgent/commit/16d9b449c9aa53ccee44144a762a2737d7ba4fc4
github.comgithub.com/zhayujie/CowAgent/issues/2803
github.comgithub.com/zhayujie/CowAgent/releases/tag/2.0.9
vuldb.comvuldb.com/cve/CVE-2026-10214
vuldb.comvuldb.com/submit/821929
vuldb.comvuldb.com/vuln/367493
vuldb.comvuldb.com/vuln/367493/cti

Frequently asked

questions

Exploitability depends on how the Bash Tool is exposed. If a chatgpt-on-wechat instance with this feature enabled is reachable by untrusted users, a remote attacker may be able to trigger command execution by sending crafted inputs that reach _get_safety_warning.

Typically, no local OS privileges are required beyond network access to the bot. However, any bot-side authentication or access controls can limit who can reach the vulnerable functionality; if the Bash Tool is restricted to certain roles or channels, the attacker must satisfy those conditions.

The most robust fix is to remove direct shell invocation for user-influenced operations, replacing it with safe, parameterized APIs. Where shell use is unavoidable, strictly validate inputs against allow-lists and ensure that no raw user-controlled strings are interpolated into command lines.

Adopt secure coding standards that ban or tightly constrain shell execution, add automated checks for command injection patterns, and treat all external input as untrusted by default. During design, consider whether features that execute system commands are necessary and, if so, encapsulate them behind hardened interfaces with strict validation and least-privilege execution.

Find out what's already
exploitable in your codebase.