Back to skill

Security audit

whatsapp-monitor

Security checks for vulnerabilities and agentic risk

Overview

This skill is Review-worthy because it monitors private WhatsApp chats and exports matches to Feishu while leaving privacy, credential, and network exposure safeguards under-scoped.

Install only if you are authorized to monitor the specific WhatsApp chats and export their contents to Feishu. Keep the OpenClaw gateway bound to localhost or protect it with authenticated TLS, avoid opening the port broadly, store Feishu secrets outside plaintext config where possible, do not use the config-printing command with real secrets, pin dependencies, and review setup/reset commands before running them on an existing deployment.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (6)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/config_manager.py:133
Finding
Plaintext Storage of Feishu Credentials and Private WhatsApp Messages<![CDATA[ ## Vulnerability Details **File Location**: `scripts/config_manager.py:133-143`, `scripts/config_manager.py:213-217` **Vulnerability Type**: Plaintext sensitive-data storage with unrestricted default file permissions **Risk Level**: High ### Vulnerable Code ```python def save_whatsapp_config(self): try: with open(self.whatsapp_config_path, 'w', encoding='utf-8') as f: json.dump(self.whatsapp_config, f, ensure_ascii=False, indent=2) def save_feishu_config(self): try: with open(self.feishu_config_path, 'w', encoding='utf-8') as f: json.dump(self.feishu_config, f, ensure_ascii=False, indent=2) ``` ```python with open(self.matched_messages_path, 'w', encoding='utf-8') as f: json.dump({ "last_updated": datetime.now().isoformat(), "messages": existing_messages }, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis The configuration manager serializes Feishu application secrets, tenant access tokens, table tokens, WhatsApp target metadata, and matched WhatsApp messages directly into plaintext JSON files. Files created through ordinary `open(..., 'w')` calls inherit permissions determined by the process umask. The application does not explicitly enforce owner-only permissions, encrypt message contents, or separate credentials from general configuration. The matched-message cache contains message content, sender details, chat identifiers, timestamps, and potentially attachment or chat-link metadata. The credential file may contain reusable Feishu API credentials. Adding these locations to `.gitignore` only reduces accidental source-control commits and does not protect the data from local users, backup systems, malware, or other processes. ### Attack Path 1. A user configures valid Feishu credentials and starts monitoring WhatsApp conversations. 2. The Skill writes the credentials to `config/feishu-settings.json`. 3. Keyword-matched messages are written to `data/matched_mess ...[truncated 737 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Remove secrets from JSON configuration and load them from environment variables, an operating-system keychain, or a dedicated secret manager. - Create sensitive files with owner-only permissions such as `0600`, and verify existing file permissions before use. - Encrypt cached message content at rest using a key stored separately from the data. - Store only fields required for export and redact unnecessary sender, attachment, and chat metadata. - Apply an explicit retention policy and securely delete successfully exported or expired records. - Refuse to start if secret or cache files are readable by group or other users. - Document backup and data-protection requirements for the cache and configuration directories. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
run_skill.sh:77
Finding
Feishu Credentials Exposed Through the Configuration Command<![CDATA[ ## Vulnerability Details **File Location**: `run_skill.sh:77-86` **Vulnerability Type**: Sensitive information disclosure through standard output **Risk Level**: High ### Vulnerable Code ```bash config) echo "[INFO] Showing configuration..." echo echo "=== WhatsApp Targets ===" if [[ -f config/whatsapp-targets.json ]]; then cat config/whatsapp-targets.json else echo "Config file not found" fi echo echo "=== Feishu Settings ===" if [[ -f config/feishu-settings.json ]]; then cat config/feishu-settings.json else echo "Config file not found" fi ;; ``` ### Technical Analysis The `config` action prints the complete Feishu settings file without redacting `app_secret`, `tenant_access_token`, `table_app_token`, or `table_token`. Standard output is frequently captured by CI systems, orchestration platforms, shell-session recorders, remote support tools, terminal logs, and monitoring agents. This disclosure does not require exploitation of a parsing flaw. It occurs through a documented launcher action and exposes credentials whenever a configured deployment runs that action. ### Attack Path 1. A user stores valid Feishu credentials in `config/feishu-settings.json`. 2. The user, administrator, support process, or automation invokes `run_skill.sh config`. 3. The script emits the complete credential file to standard output. 4. A CI log, terminal recorder, support transcript, or other observer captures the output. 5. An attacker retrieves the exposed token or application secret. 6. The attacker authenticates to Feishu within the permissions granted to the affected application or token. ### Impact Assessment The exposed credentials may permit access to the configured Feishu tenant or multidimensional table. The exact scope depends on application permissions and token type. Potential consequences include unauthorized record access, data modification, message-data disclosure, and continued access until the affected secret ...[truncated 27 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Never print the complete Feishu configuration file. - Parse the JSON and replace all secret values with fixed redaction markers. - Display only non-sensitive fields such as table name, export threshold, configured host, and whether each credential is present. - Send no credentials to standard output or logs, including during errors. - Add automated tests that fail if known secret field names are emitted by the configuration command. - Rotate any credentials that may already have appeared in captured logs. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/whatsapp_client.py:19
Finding
Unauthenticated Plaintext Access to the OpenClaw WhatsApp Gateway<![CDATA[ ## Vulnerability Details **File Location**: `scripts/whatsapp_client.py:19-26`, `scripts/whatsapp_client.py:162-170`, `scripts/whatsapp_client.py:237-246` **Vulnerability Type**: Insecure transport and missing client authentication **Risk Level**: High ### Vulnerable Code ```python openclaw_config = config.get("openclaw", {}) host = openclaw_config.get("host", "localhost") port = openclaw_config.get("port", 18789) self.base_url = f"http://{host}:{port}" self.api_key = None self.session = None ``` ```python async with aiohttp.ClientSession() as session: async with session.get( f"{self.base_url}/api/v1/channels/whatsapp/messages", params=params, timeout=30 ) as response: ``` ```python async with aiohttp.ClientSession() as session: async with session.post( f"{self.base_url}/api/v1/channels/whatsapp/send", json=data, timeout=30 ) as response: ``` The associated guidance also recommends opening the gateway port: ```bash sudo ufw allow 18789/tcp sudo firewall-cmd --permanent --add-port=18789/tcp sudo firewall-cmd --reload ``` ### Technical Analysis The client always builds its gateway base URL using plaintext HTTP, even when the configured host is remote. Although an `api_key` member exists, it is initialized to `None` and is not added to message-reading, status, contact, chat-list, or message-sending requests. For localhost-only use, plaintext transport is less exposed. However, the configuration permits arbitrary hosts, and the documentation explicitly describes LAN access and broad firewall rules. In those configurations, WhatsApp data and commands traverse the network without confidentiality, integrity protection, or demonstrated authentication. ### Attack Path 1. An operator configures the OpenClaw host as another machine on the local network. 2. The operator follows the documentation and opens TCP port 18789. 3. The client sends message queries and message-send commands over H ...[truncated 635 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Permit plaintext HTTP only for loopback addresses and reject non-loopback HTTP configurations. - Add configurable HTTPS support and validate server certificates. - Require an API token or mutually authenticated TLS for every gateway endpoint. - Store the gateway credential in a secret manager rather than the target configuration file. - Reuse a hardened `aiohttp.ClientSession` with authentication, TLS, timeout, and connection settings applied consistently. - Bind the gateway to loopback by default. - Replace broad firewall rules with source-restricted rules or a private authenticated tunnel. - Clearly warn users that directly exposing message and send endpoints is unsafe. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/message_processor.py:100
Finding
Regular Expression Denial of Service in Message Filtering<![CDATA[ ## Vulnerability Details **File Location**: `scripts/message_processor.py:100-107`, `scripts/message_processor.py:124-131` **Vulnerability Type**: Unbounded regular-expression evaluation **Risk Level**: Medium ### Vulnerable Code ```python for pattern in keyword_patterns: try: if re.search(pattern, content, re.IGNORECASE | re.MULTILINE): matched_keywords.append(f"正则: {pattern}") except re.error as e: self.logger.warning(f"正则表达式错误: {pattern} - {str(e)}") ``` ```python try: pattern = clean_keyword for match in re.finditer(pattern, content, re.IGNORECASE | re.MULTILINE): positions.append((match.start(), match.end())) except re.error: start = 0 ``` ### Technical Analysis Patterns from the target configuration are evaluated by Python's backtracking regular-expression engine without a timeout, complexity validation, input-length limit, or execution isolation. Syntactically valid patterns containing nested or ambiguous quantifiers can cause catastrophic backtracking on crafted message content. The same matched pattern can be evaluated a second time by `re.finditer` during context extraction, compounding CPU consumption. Because message processing occurs inside the primary asynchronous monitoring loop, a blocking regular-expression operation stalls all message polling and exports. ### Attack Path 1. A pathological but syntactically valid pattern is added to `keyword_patterns`, whether accidentally or by a person able to edit the configuration. 2. An attacker sends specially constructed text to a monitored WhatsApp chat. 3. The monitor retrieves the message and calls `re.search` against the configured pattern. 4. Catastrophic backtracking consumes the monitoring process's CPU for an extended period. 5. The event loop cannot poll other targets or export pending messages, causing service degradation or denial of service. ### Impact Assessment Exploitation affects the availability of the monitoring ...[truncated 204 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Use a regular-expression implementation that supports strict execution timeouts. - Reject nested quantifiers, ambiguous alternation, backreferences, and other high-risk pattern constructs during configuration validation. - Compile and validate all patterns at startup rather than during message processing. - Apply a conservative maximum length to message content before regex evaluation. - Limit the number and size of patterns per target. - Run unavoidable complex matching in an isolated worker with CPU and wall-clock limits. - Avoid evaluating the same pattern again during context extraction; retain match spans from the initial evaluation. ]]>

T08 · Insecure Dependencies

Warning
Location
requirements.txt:2
Finding
Automatic Installation of Unpinned Third-Party Dependencies<![CDATA[ ## Vulnerability Details **File Location**: `requirements.txt:2-6`, `install_deps.sh:21-25`, `run_skill.sh:31-39` **Vulnerability Type**: Non-reproducible dependency installation and supply-chain exposure **Risk Level**: Medium ### Vulnerable Code ```text aiohttp>=3.8.0 pydantic>=2.0.0 python-dateutil>=2.8.0 requests>=2.28.0 pyyaml>=6.0 ``` ```bash for pkg in pyyaml aiohttp pydantic requests python-dateutil; do echo "Installing ${pkg}..." "${PYTHON}" -m pip install "${pkg}" --quiet done ``` ```bash if ! "${PYTHON}" -c "import aiohttp, pydantic, yaml, requests" &>/dev/null; then echo "[WARNING] Some dependencies missing. Installing..." if ! "${PYTHON}" -m pip install -r requirements.txt --quiet; then echo "[ERROR] Failed to install dependencies" exit 1 fi fi ``` ### Technical Analysis The dependency file provides only lower bounds and no upper bounds, exact versions, hashes, or lock file. The dedicated installer is weaker still: it installs package names directly without applying even the stated minimum constraints. Runtime launchers automatically invoke `pip` when imports are missing. Consequently, installations are not reproducible and may retrieve future package releases that were not present during this audit. Python package installation may execute package build logic, and imported packages execute module initialization code under the privileges of the user running the Skill. The reviewed package names are legitimate and no typosquatted package was identified. The vulnerability is the unsafe and implicit dependency acquisition process rather than evidence that the current packages are malicious. ### Attack Path 1. A dependency publisher account, release process, package index route, or future package release is compromised. 2. A user runs the installer or starts the Skill on a system where one of the imports is missing. 3. `pip` resolves an unpinned current release from the package index. 4. Malicious installation or imp ...[truncated 552 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Pin every direct and transitive dependency to reviewed versions. - Generate and commit a lock file with cryptographic hashes. - Install with hash verification enabled. - Use a dedicated virtual environment or isolated container. - Remove automatic package installation from runtime launchers; fail safely with explicit installation instructions instead. - Make `install_deps.sh` consume the same locked dependency set rather than installing package names directly. - Run dependency vulnerability and provenance scanning in CI. - Regularly update pinned versions through a reviewed and tested process. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/setup.py:125
Finding
Setup Script Overwrites Existing Configuration and Project Files Without Confirmation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup.py:125-131`, `scripts/setup.py:153-157`, `scripts/setup.py:337-341` **Vulnerability Type**: Destructive file overwrite and unsafe configuration initialization **Risk Level**: Medium ### Vulnerable Code ```python whatsapp_config_path = config_dir_path / "whatsapp-targets.json" with open(whatsapp_config_path, 'w', encoding='utf-8') as f: json.dump(whatsapp_config, f, ensure_ascii=False, indent=2) feishu_config_path = config_dir_path / "feishu-settings.json" with open(feishu_config_path, 'w', encoding='utf-8') as f: json.dump(feishu_config, f, ensure_ascii=False, indent=2) ``` ```python req_path = Path(base_dir) / "requirements.txt" with open(req_path, 'w', encoding='utf-8') as f: f.write(requirements) ``` ```python readme_path = Path(base_dir) / "README.md" with open(readme_path, 'w', encoding='utf-8') as f: f.write(readme_content) ``` ### Technical Analysis The setup workflow opens existing files in write mode without checking whether they already exist, obtaining user confirmation, creating backups, or performing an atomic migration. Invoking the setup action can therefore erase configured monitoring targets and Feishu credentials. It also replaces dependency constraints and project documentation. The launcher exposes this behavior through `run_skill.sh setup`, which presents the operation as a setup wizard even though the Python script performs unconditional replacement. ### Attack Path 1. A deployment is configured with production WhatsApp targets, keywords, Feishu credentials, and dependency restrictions. 2. An administrator or automation invokes `run_skill.sh setup` or executes `scripts/setup.py`. 3. The setup script opens the existing files with mode `w`. 4. Existing contents are truncated and replaced with defaults. 5. Monitoring stops using the intended targets or credentials, and previous configuration cannot be recovered unless an external backup exists. ### ...[truncated 364 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Refuse to overwrite existing files by default. - Require an explicit `--force` option and interactive confirmation before destructive replacement. - Create timestamped backups before modifying configuration. - Use atomic writes through a temporary file followed by a rename. - Separate first-time initialization from configuration migration. - Preserve existing secret and target values when adding new schema fields. - Validate generated files before replacing the originals. - Clearly describe destructive behavior in launcher output and documentation. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (61)

Missing User Warnings

High
Confidence
95% confidence
Finding
The skill explicitly enables continuous monitoring of WhatsApp chats and export of matching message content, sender data, and timestamps to Feishu, but it does not prominently warn users about privacy, consent, cross-system data sharing, or legal/compliance implications. In this context, the absence of clear disclosure and guardrails materially increases the risk of unauthorized surveillance, collection of third-party communications, and improper exfiltration of sensitive data to another platform.

Ae1

High
Category
analysis-evasion
Content
python scripts/setup.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python scripts/setup.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Tool Parameter Abuse

High
Category
Tool Misuse
Content
```bash
# 删除所有数据和日志
rm -f data/matched_messages.json
rm -f logs/whatsapp-monitor.log

# 重置配置文件
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
```bash
# 删除所有数据和日志
rm -f data/matched_messages.json
rm -f logs/whatsapp-monitor.log

# 重置配置文件
rm -f config/whatsapp-targets.json
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
rm -f logs/whatsapp-monitor.log

# 重置配置文件
rm -f config/whatsapp-targets.json
rm -f config/feishu-settings.json
python scripts/setup.py
```
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
# 重置配置文件
rm -f config/whatsapp-targets.json
rm -f config/feishu-settings.json
python scripts/setup.py
```
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Credential Access

High
Category
Privilege Escalation
Content
env/
venv/
.venv/
.env
*.log
"""
            with open(gitignore_path, 'w', encoding='utf-8') as f:
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

High
Confidence
98% confidence
Finding
The skill description explains how to trigger WhatsApp monitoring and export behavior but does not clearly warn users that it processes potentially sensitive private communications. In a messaging-monitoring context, missing privacy and consent warnings can lead to deployment without informed consent, creating serious confidentiality, compliance, and insider-misuse risks.

Credential Access

High
Category
Privilege Escalation
Content
1. **获取 API 凭证**
   - 访问 Facebook Developer Portal
   - 创建 WhatsApp Business 应用
   - 获取 Phone Number ID 和 Access Token

2. **配置 OpenClaw**
   ```yaml
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

High
Confidence
95% confidence
Finding
The generated README instructs users to monitor WhatsApp messages and export their contents, senders, attachments, and chat links to Feishu, but it does not warn about consent, privacy, retention, or legal/compliance implications. In this skill context, that omission is materially risky because the tool is explicitly designed for surveillance-like collection and third-party transfer of potentially sensitive communications.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The file begins in English but switches into Chinese for key setup and workflow instructions, which can impose a specific language on users without opt-in. There is no statement that the skill is intended only for Chinese-speaking users or that alternative language documentation is available.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The guide describes continuous monitoring of WhatsApp messages, keyword filtering, storage, and export to Feishu, but it does not warn users about privacy, consent, data retention, or cross-system sharing of message content. This omission can lead to unauthorized surveillance or mishandling of personal/business communications, especially because the skill processes sensitive chat data by design.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The reset section instructs users to delete message data, logs, and configuration files without clearly warning that the action is irreversible and may erase audit trails and credentials/configuration state. In operational environments, this can cause accidental data loss and hinder forensic review or recovery after incidents.

Natural-Language Policy Violations

Medium
Confidence
82% confidence
Finding
The natural-language content in target names, identifiers, and keyword lists is entirely Chinese, which suggests the skill is configured for a specific language/locale by default. There is no indication in this file that users can choose another language or that the locale restriction is explicitly documented as intentional and justified.

Vague Triggers

Medium
Confidence
87% confidence
Finding
The keyword list contains broad, common terms such as '问题', '帮忙', and '会议' that are likely to appear in many normal conversations. In a monitoring configuration, this can cause over-collection, false alerts, or unintended actions against chats or contacts that were not meant to be monitored, increasing privacy and operational risk.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This Python file contains user-facing natural-language strings and documentation entirely in Chinese, including the module description and later console output, with no indication that language selection is optional. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly justified.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Content
missing_packages = []
    for package in required_packages:
        try:
            __import__(package)
        except ImportError:
            missing_packages.append(package)
Confidence
75% confidence
Finding
Dynamic __import__() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The documented trigger conditions are broad enough that a general conversation mentioning WhatsApp monitoring concepts could activate the skill unintentionally. Because this skill monitors and exports private messages, accidental activation increases the risk of unauthorized surveillance, collection, or forwarding of sensitive communications.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The document states that the skill monitors WhatsApp messages and later documents endpoints for reading chats/messages and sending messages, which can affect user privacy and communications. Although there is a later generic security section, it does not clearly warn users up front that the integration can access message contents and send messages on their behalf.

Internal Network Request

Medium
Category
Server-Side Request Forgery
Content
curl http://localhost:18789/health

# 或使用 Python
python -c "import requests; r = requests.get('http://localhost:18789/health'); print(r.status_code)"
```

### 7. 防火墙配置
Confidence
70% confidence
Finding
Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Missing User Warnings

Medium
Confidence
86% confidence
Finding
The document gives explicit instructions to open a firewall port and enable network access, but it does not warn that doing so can expose the OpenClaw Gateway to other hosts and increase attack surface. In a skill context, operational guidance that changes host firewall posture without security caveats can lead users to unintentionally expose sensitive APIs or monitoring infrastructure.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
**Linux 防火墙**:
```bash
# Ubuntu/Debian
sudo ufw allow 18789/tcp

# CentOS/RHEL
sudo firewall-cmd --permanent --add-port=18789/tcp
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
**Linux 防火墙**:
```bash
# Ubuntu/Debian
sudo ufw allow 18789/tcp

# CentOS/RHEL
sudo firewall-cmd --permanent --add-port=18789/tcp
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
**Linux 防火墙**:
```bash
# Ubuntu/Debian
sudo ufw allow 18789/tcp

# CentOS/RHEL
sudo firewall-cmd --permanent --add-port=18789/tcp
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Static analysis

No suspicious patterns detected.