Back to skill

Security audit

企业微信通知提醒

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward WeCom webhook sender with visible network and optional scheduling behavior, but users should handle webhook keys carefully.

Install only if you are comfortable sending the chosen message content and mentions to WeCom. Do not paste real webhook keys into shell history or persistent cron definitions when avoidable; use a protected secret file or secret manager, and rotate any key that may have been exposed.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
send_weixin.sh:50
Finding
Webhook Secret Exposed Through Command-Line Arguments and Persistent Cron Definitions## Vulnerability Details **File Location**: `send_weixin.sh:11-12`, `send_weixin.sh:50-52`, and `SKILL.md:48-73` **Vulnerability Type**: Credential exposure through process arguments, command history, and scheduler configuration **Risk Level**: Medium ### Vulnerable Code `send_weixin.sh:11-12`: ```bash WEBHOOK_KEY="$1" MSGTYPE="$2" ``` `send_weixin.sh:50-52`: ```bash response=$(curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=$WEBHOOK_KEY" \ -H "Content-Type: application/json" \ -d "$JSON_DATA") ``` `SKILL.md:48-57`: ```bash openclaw cron add \ --cron "0 14 * * *" \ --agent main \ --message "执行:~/.openclaw/workspace/skills/weixin-webhook/send_weixin.sh 'your_key' 'text' '【健康提醒】请做提肛运动!' 'liujie'" \ --name "daily_kegel" \ --description "每日提肛提醒" \ --no-deliver ``` ### Technical Analysis The webhook key is a bearer credential: possession of the key permits a caller to submit messages to the corresponding WeCom group webhook. The script accepts this credential as its first command-line argument and interpolates it into the URL passed to `curl`. Command-line secrets may be exposed through: - Shell history when users invoke the script interactively. - Process inspection facilities while the script or `curl` is running. - Diagnostic or process-monitoring tools that record argument vectors. - Scheduler configuration and task inspection, because the documented cron command embeds the key directly in the persistent `--message` value. - Operational logs that capture task definitions or invoked commands. The script does not print the key directly, but that does not prevent disclosure through the command invocation and persistent scheduler metadata. ### Attack Path 1. A user follows the documentation and supplies a valid webhook key as a script argument or embeds it in an OpenClaw cron task. 2. The key becomes available in shell history, scheduler confi ...[truncated 1124 chars]
Remediation
## Remediation Suggestions - Do not pass the webhook key directly as a command-line argument. - Load the credential from a permission-restricted secret file, operating-system credential store, or supported secret-management facility. - If an environment variable must be used, inject it through a protected scheduler secret mechanism rather than writing it literally into the cron task message. - Ensure secret files are owned by the intended service account and use restrictive permissions such as `0600`. - Update the scheduling examples so task definitions reference a secret identifier or protected file instead of containing the key. - Avoid verbose command logging and redact webhook URL query parameters from process-monitoring and diagnostic output. - Document key rotation and immediately revoke any key suspected of having appeared in history, logs, or scheduler metadata. - Consider accepting the payload through standard input and reading the webhook configuration at runtime from a protected source.

T09 · Insecure Skill Coding Practices

Warning
Location
send_weixin.sh:19
Finding
JSON Payload Injection Through Unescaped Message and Mention Values## Vulnerability Details **File Location**: `send_weixin.sh:19-40` **Vulnerability Type**: Improper encoding of user-controlled data in JSON **Risk Level**: Medium ### Vulnerable Code `send_weixin.sh:19-40`: ```bash case "$MSGTYPE" in text) # 基础text对象 - 注意这里是对象,不加外层{} TEXT_OBJ="\"content\":\"$CONTENT\"" # 添加mentioned_list if [ -n "$MENTIONED_LIST" ]; then MENTIONED_ARRAY=$(echo "$MENTIONED_LIST" | tr ',' '\n' | awk '{print "\""$0"\""}' | paste -sd ',' -) TEXT_OBJ="$TEXT_OBJ, \"mentioned_list\":[$MENTIONED_ARRAY]" fi # 添加mentioned_mobile_list if [ -n "$MENTIONED_MOBILE_LIST" ]; then MOBILE_ARRAY=$(echo "$MENTIONED_MOBILE_LIST" | tr ',' '\n' | awk '{print "\""$0"\""}' | paste -sd ',' -) TEXT_OBJ="$TEXT_OBJ, \"mentioned_mobile_list\":[$MOBILE_ARRAY]" fi # 完整JSON:text的值是一个对象{...} JSON_DATA="{\"msgtype\":\"text\",\"text\":{$TEXT_OBJ}}" ;; markdown) JSON_DATA="{\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"$CONTENT\"}}" ;; ``` ### Technical Analysis The script builds JSON by directly concatenating `CONTENT`, `MENTIONED_LIST`, and `MENTIONED_MOBILE_LIST` into quoted JSON strings. It does not apply JSON-specific escaping for quotation marks, backslashes, newlines, carriage returns, tabs, or other control characters. Shell quoting prevents these values from being re-evaluated as shell commands, so the reviewed code does not establish shell command injection. However, shell quoting does not make the values safe for a different output grammar such as JSON. An attacker-controlled value containing quotation marks and JSON delimiters can terminate the intended string and introduce additional object properties or array elements. Less carefully crafted values can make the payload malformed, causing message deliver ...[truncated 1712 chars]
Remediation
## Remediation Suggestions - Replace manual string concatenation with a JSON-aware serializer. - Use `jq` with `--arg` so content and individual mention values are escaped according to JSON rules. - Convert comma-separated mention inputs into arrays and pass them through the serializer rather than adding quotation marks with `awk`. - Validate mobile-number and user-ID formats where practical, while retaining JSON encoding as the primary security control. - Reject invalid message types and optionally impose length limits consistent with the WeCom API. - Check that generated payloads are valid JSON before transmission. - Use `curl --fail-with-body` and inspect both the HTTP status and WeCom response code so malformed or rejected messages cause a nonzero script exit status. - Add regression tests covering quotation marks, backslashes, multiline content, Unicode, empty mention elements, and attempted JSON-property injection. A safer construction pattern is: ```bash JSON_DATA=$(jq -n \ --arg content "$CONTENT" \ '{msgtype: "markdown", markdown: {content: $content}}') ``` Equivalent encoder-native construction should be used for text messages and mention arrays.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (3)

External Transmission

Medium
Category
Data Exfiltration
Content
# 发送请求
echo "发送的JSON数据:$JSON_DATA"
response=$(curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=$WEBHOOK_KEY" \
  -H "Content-Type: application/json" \
  -d "$JSON_DATA")
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
This shell script sends user-supplied content, mention lists, and the webhook key to an external WeCom webhook endpoint via HTTP, which is a network transmission of potentially sensitive data. Although the script prints the JSON payload, it does not clearly warn the user that data will be sent to a remote service or explain the privacy implications.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
The file's user-facing comments and usage examples are written only in Chinese, which imposes a specific language without any opt-in or explanation. Under the stated policy, forcing a language/locale without user choice or documented justification is a natural-language policy issue.

Static analysis

No suspicious patterns detected.