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.
