| Título | zhayujie chatgpt-on-wechat <= 2.0.7 OS Command Injection (CWE-78) |
|---|
| Descrição | # Technical Details
An Unauthenticated Remote Code Execution (RCE) via Agent Bash Tool Bypass exists in the `Bash` tool in `agent/tools/bash/bash.py` of chatgpt-on-wechat.
The application fails to sandbox OS commands and relies entirely on a trivial keyword blocklist (e.g., `rm -rf /`, `shutdown`). When the LLM decides to execute the `bash` tool based on a user's prompt, the input command is checked by the `_get_safety_warning` method which only checks for exact-match patterns. Commands that bypass the filter are passed without modification to a `subprocess.run(command, shell=True)` sink, running under the bot's privileges.
# Vulnerable Code
File: agent/tools/bash/bash.py
Method: _get_safety_warning / execute
Why: The `_get_safety_warning` method uses a trivial array-based exact blocklist, failing to effectively sanitize inputs. The `execute` method passes command input directly to `subprocess.run(shell=True)`.
# Reproduction
1. Deploy the `chatgpt-on-wechat` instance with default configurations (`use_agent: true`).
2. Download the HTTP Exploit script `exploit.py`.
3. Run `python3 exploit.py` to send crafted prompts to the `/message` endpoint, tricking the LLM into executing arbitrary code (e.g. `cat /etc/shadow`).
# Impact
- Complete Remote Code Execution on the system hosting the application.
- Complete host/container compromise, enabling lateral movement, data exfiltration, or hijacking of API keys. |
|---|
| Fonte | ⚠️ https://github.com/zhayujie/CowAgent/issues/2803 |
|---|
| Utilizador | Eric-a (UID 96353) |
|---|
| Submissão | 07/05/2026 13h34 (há 28 dias) |
|---|
| Moderação | 31/05/2026 09h19 (24 days later) |
|---|
| Estado | Aceite |
|---|
| Entrada VulDB | 367493 [zhayujie chatgpt-on-wechat até 2.0.8 Bash Tool agent/tools/bash/bash.py _get_safety_warning Elevação de Privilégios] |
|---|
| Pontos | 20 |
|---|