T09 · Insecure Skill Coding Practices
- Location
scripts/whatsapp_happybday.py:115- Finding
Shell Command Injection Through Dynamically Constructed wacli Commands
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is purpose-aligned but needs Review because it can monitor all WhatsApp groups, retain private message text, run on a schedule, and automatically send messages while also containing a command-injection flaw.
Install only if you are comfortable granting a scheduled tool access to your WhatsApp groups and allowing it to post messages. Keep simulation mode enabled until you have reviewed behavior, avoid live sending without a group allowlist and explicit consent, and do not use the current script on sensitive accounts until the shell=True command execution and plaintext message retention are fixed.
scripts/whatsapp_happybday.py:115Shell Command Injection Through Dynamically Constructed wacli Commands
scripts/whatsapp_happybday.py:237Plaintext Retention of Private WhatsApp Group Messages
scripts/whatsapp_happybday.py:121Unscoped Monitoring of All WhatsApp Groups
requirements.txt:1Unpinned Third-Party Dependency
scripts/whatsapp_happybday.py:50Environment Configuration Loaded After Security-Relevant Values Are Read
The description emphasizes convenience and automation but does not clearly warn users that the skill continuously monitors WhatsApp groups and may automatically send messages on their behalf. This weakens informed consent and makes it more likely a user enables the skill without understanding the privacy and reputational consequences.
This is a true tool-parameter abuse issue because the shell command wrapper is reused for multiple wacli operations and receives dynamic parameters incorporated into a shell string. The skill context makes it more dangerous because inputs originate from chat metadata and generated messages; a crafted group JID or message containing shell-breaking characters could pivot a messaging automation tool into arbitrary OS command execution.
def run_wacli_command(cmd):
"""Execute wacli command"""
try:
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, encoding='utf-8', errors='replace', timeout=60)
return result.stdout, result.stderr, result.returncode
except Exception as e:
return "", str(e), 1
The skill is designed to autonomously decide when a person should be congratulated and then send a message without human review. In a private-group messaging environment, this can misfire on jokes, sarcasm, or unrelated mentions, causing spam, disclosure of inferred personal events, or inappropriate automated participation in conversations.
**Version 1.0.2 - Security & Consistency Fixes**
**Monitor WhatsApp groups to dynamically detect people who should be congratulated. It identifies keywords (e.g., "birthday", "congratulations") and the person's name using a score-based system, then automatically sends a random customizable congratulatory message.**
## 🎯 Features
The README explicitly describes monitoring WhatsApp groups and automatically sending messages, but it does not clearly warn users that the skill accesses private group communications and may process personal data such as names and message content. In a messaging context, missing privacy and consent guidance can lead to unauthorized surveillance-like use, accidental policy violations, and improper handling of sensitive conversational data.
The skill declares capabilities that imply environment access, file reads/writes, and shell execution but does not restrict them with explicit tool scopes or permissions. In combination with autonomous WhatsApp monitoring and message sending, this gives the skill unnecessarily broad operational authority and increases the blast radius if the script is modified, misused, or prompted indirectly.
The skill is explicitly designed to autonomously decide when someone should be congratulated and to send a message without a per-message user review. Autonomous decision-making over private communications is risky because false positives, manipulation by group participants, or misidentification of names can cause unauthorized or embarrassing messages to be sent.
---
name: whatsapp-happybday
version: 1.0.2
description: Monitor WhatsApp groups to dynamically detect people who should be congratulated. It identifies keywords (e.g., "birthday", "congratulations") and the person's name using a score-based system, then automatically sends a random customizable congratulatory message.
triggers:
- whatsapp happybday
- monitor whatsapp group
The trigger phrases are broad and action-oriented, such as monitoring WhatsApp groups or sending congratulations, which increases the chance of accidental activation in unrelated conversations. Because this skill can monitor communications and send messages automatically, unintended invocation can lead to privacy-impacting behavior or unauthorized outbound communication.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
To make the skill work, you need to configure a few environment variables and (optionally) customize the dictionaries.
.env)Create a .env file in the skill's root directory (~/.openclaw/skills/whatsapp-happybday/.env) or export these variables in your environment:
# Skip list with enhanced format:
This finding is substantively the same scheduled-execution issue: the skill instructs the user to install a cron job that keeps the behavior active across sessions. In this context, persistence is more dangerous because the scheduled task performs monitoring and may send external messages, turning a one-time setup into ongoing autonomous action.
### 2. Automated Execution (Cron Job)
Create a cron job to run the monitor script periodically (e.g., every hour between 8 AM and 8 PM). Run this in your terminal:
```bash
openclaw cron add \
This finding is substantively the same scheduled-execution issue: the skill instructs the user to install a cron job that keeps the behavior active across sessions. In this context, persistence is more dangerous because the scheduled task performs monitoring and may send external messages, turning a one-time setup into ongoing autonomous action.
### 2. Automated Execution (Cron Job)
Create a cron job to run the monitor script periodically (e.g., every hour between 8 AM and 8 PM). Run this in your terminal:
```bash
openclaw cron add \
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
if sys.executable == '/opt/homebrew/bin/python3':
# Try to find the correct python-dotenv installation
import subprocess
result = subprocess.run(['which', 'python3'], capture_output=True, text=True)
if result.returncode == 0:
python_path = result.stdout.strip()
print(f"Using Python: {python_path}")
The helper uses subprocess.run(cmd, shell=True, ...) on command strings that are later built with interpolated values such as group_jid and message text. If any of those values contain shell metacharacters or quotes, an attacker controlling WhatsApp-derived data or configuration could trigger shell command injection and execute arbitrary commands on the host.
def run_wacli_command(cmd):
"""Execute wacli command"""
try:
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, encoding='utf-8', errors='replace', timeout=60)
return result.stdout, result.stderr, result.returncode
except Exception as e:
return "", str(e), 1
The script reads and analyzes recent WhatsApp group messages to infer personal events without presenting any user-facing privacy notice or consent mechanism. In this context, monitoring private group chats and extracting names increases privacy risk and may violate participant expectations or platform policy, especially since the data is persisted in local state.
The script can automatically send WhatsApp messages once scoring thresholds are met, with no explicit runtime confirmation or user-facing warning at the moment of transmission. In this skill context, that can lead to unintended messaging, harassment, reputational harm, or spam if detection is wrong or manipulated by group participants.
The dependency is specified without a version pin, which makes builds non-reproducible and can cause the skill to install different releases over time, including vulnerable or breaking versions. In a skill that may process WhatsApp-derived content and run unattended, unexpected dependency changes increase supply-chain risk and operational unpredictability.
python-dotenv
The manifest does not pin python-dotenv, so it is impossible to determine whether installation will resolve to a version affected by known advisories. While requirements.txt alone does not prove exploitation, the lack of version control means a vulnerable release could be installed, which is a real supply-chain weakness.