T09 · Insecure Skill Coding Practices
- Location
scripts/send_message.py:48- Finding
Arbitrary Shell Command Injection Through Recipient and Message Inputs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a real WeCom message automation tool, but it has unsafe command execution and message-sending safeguards that users should review before installing.
Install only if you are comfortable granting desktop control and screen-capture capabilities to a script that can send live WeCom messages. Review or fix the shell command construction, require recipient confirmation before sending, avoid full-screen capture, and clean up temporary screenshots before using it with sensitive chats or work data.
scripts/send_message.py:48Arbitrary Shell Command Injection Through Recipient and Message Inputs
scripts/send_message.py:331Ambiguous OCR Matching Can Send Messages to the Wrong Recipient
scripts/send_message.py:121Full-Screen Capture Collects Data Outside the WeCom Task Scope
scripts/send_message.py:27Sensitive Screenshots Are Retained in a Predictable Shared Temporary Directory
This is a concrete tool-parameter abuse issue: shell command construction is centralized in run(), and multiple higher-level functions feed it attacker-influenced parameters. Inputs like args.message flow into paste_text(), args.name can influence OCR search commands, and OCR-detected text is also reused in shell invocations, making command injection practical and dangerous on a macOS host with GUI automation privileges.
def run(cmd, timeout=15):
log(f"→ {cmd[:120]}")
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout)
if result.returncode != 0 and result.stderr:
log(f" stderr: {result.stderr[:200]}")
return result
The skill invokes powerful local shell-based GUI automation tools but does not declare any explicit tool scope or permission boundaries. Because it also requires Accessibility and Screen Recording privileges, the absence of scoped permissions increases the risk of unintended command execution, opaque behavior, and abuse of highly sensitive desktop capabilities.
This skill depends on Screen Recording and Accessibility access, which are highly sensitive OS permissions that can expose on-screen data and allow control of other applications. Failing to clearly warn users in the skill description can cause them to grant broad privileges without understanding the privacy and security implications.
The script forces OCR processing to use only Simplified Chinese, Traditional Chinese, and U.S. English via a fixed recognitionLanguages list. This is a natural-language policy concern because it imposes specific language/locale handling without offering the user a choice or documenting an opt-in.
The file-level natural-language instructions, usage text, and runtime-facing strings are entirely in Chinese, with no indication that the user can choose another language or that the locale restriction is intentional and documented as region-specific. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.
The helper wraps subprocess.run with shell=True and is later used to build commands from untrusted inputs such as the recipient name, message text, screenshot path, and OCR keyword. Because several callers interpolate user-controlled or OCR-derived strings directly into shell command strings, an attacker can inject shell metacharacters and execute arbitrary commands on the host running the automation.
def run(cmd, timeout=15):
log(f"→ {cmd[:120]}")
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout)
if result.returncode != 0 and result.stderr:
log(f" stderr: {result.stderr[:200]}")
return result
This script performs real GUI automation to locate chats and send messages with no interactive confirmation, dry-run mode, recipient preview, or final send prompt. In the context of a messaging skill, this can cause unintended message delivery, misdirected communication due to OCR mistakes, or abuse by upstream prompts that trigger the skill without the operator fully understanding that it will send live messages.
The documentation includes a prescriptive instruction for Chinese input handling ('只用 ... paste 中文') and the overall skill description and trigger phrases are centered on Chinese usage without stating that this is optional or region-specific. This can be a language/locale policy issue because the skill appears to assume a specific language mode without user opt-in.
No suspicious patterns detected.