| 제목 | zhayujie chatgpt-on-wechat <= 2.0.7 OS Command Injection (CWE-78) |
|---|
| 설명 | # 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. |
|---|
| 원천 | ⚠️ https://github.com/zhayujie/CowAgent/issues/2803 |
|---|
| 사용자 | Eric-a (UID 96353) |
|---|
| 제출 | 2026. 05. 07. PM 01:34 (1 월 ago) |
|---|
| 모더레이션 | 2026. 05. 31. AM 09:19 (24 days later) |
|---|
| 상태 | 수락 |
|---|
| VulDB 항목 | 367493 [zhayujie chatgpt-on-wechat 까지 2.0.8 Bash Tool agent/tools/bash/bash.py _get_safety_warning 권한 상승] |
|---|
| 포인트들 | 20 |
|---|