Back to skill

Security audit

Bazhuayu Webhook

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its webhook automation purpose, but its setup and migration helpers handle secrets unsafely and include a real local code-execution risk.

Review this before installing. Treat the webhook key like an account credential, avoid running setup-secure.sh with untrusted or copied webhook URLs, avoid storing real keys in .env.example, .env.migrated, shell history, screenshots, or Git, and delete or protect migration backups. Use test/dry-run first and only run live commands when you intend to trigger the configured RPA workflow.

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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
setup-secure.sh:139
Finding
Arbitrary Python Code Execution Through Unsafe Configuration Interpolation<![CDATA[ ## Vulnerability Details **File Location**: `setup-secure.sh`, lines 139-156 **Vulnerability Type**: Untrusted input embedded into generated Python source **Risk Level**: High ### Vulnerable Code ```bash python3 << EOF import json from pathlib import Path import os config_file = Path("$CONFIG_FILE") # Attempt to read existing configuration if config_file.exists(): config = json.load(open(config_file)) else: config = { 'paramNames': [], 'defaultParams': {} } # Update configuration config['url'] = "$WEBHOOK_URL" config['key'] = '' ``` The value assigned to `WEBHOOK_URL` originates from interactive input or an existing configuration: ```bash read -p "Enter the new Webhook URL: " WEBHOOK_URL ``` ### Technical Analysis The script expands `WEBHOOK_URL` directly into Python source code executed through a heredoc. The value is not serialized, escaped, or passed as data. A value containing quotation marks and Python statements can terminate the intended string literal and inject additional Python code. For example, a malicious URL value shaped like the following can alter the generated Python program: ```text "; __import__('os').system('touch /tmp/setup-code-executed'); injected=" ``` The resulting Python source contains an attacker-controlled call to `os.system()`. The issue is Python source injection rather than recursive shell command substitution: shell metacharacters inside a variable are not automatically reevaluated, but Python syntax inserted into the heredoc is parsed and executed by the Python interpreter. The same risk applies when `WEBHOOK_URL` is loaded from an existing `config.json`, meaning a tampered configuration can trigger execution when the user later runs the setup script. ### Attack Path 1. An attacker supplies a crafted webhook URL through setup instructions, a copied configuration, or a modified `config.json`. 2. The user invokes `./setup-secure.sh`. 3. The script stores the crafted value in `WE ...[truncated 838 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Do not embed configuration values into generated Python source. Pass them as environment variables or command-line arguments and read them as data. A safer pattern is: ```bash CONFIG_FILE="$CONFIG_FILE" WEBHOOK_URL="$WEBHOOK_URL" python3 <<'EOF' import json import os from pathlib import Path config_file = Path(os.environ["CONFIG_FILE"]) webhook_url = os.environ["WEBHOOK_URL"] if config_file.exists(): with config_file.open("r", encoding="utf-8") as handle: config = json.load(handle) else: config = { "paramNames": [], "defaultParams": {} } config["url"] = webhook_url config["key"] = "" with config_file.open("w", encoding="utf-8") as handle: json.dump(config, handle, ensure_ascii=False, indent=2) os.chmod(config_file, 0o600) EOF ``` Additional hardening should include: 1. Quote the heredoc delimiter to prevent shell expansion inside the Python program. 2. Validate that webhook URLs use an expected scheme, preferably HTTPS. 3. Optionally restrict the hostname to documented Octoparse domains where compatible with legitimate deployments. 4. Never construct executable source code through string interpolation. 5. Add regression tests using URLs containing quotes, semicolons, backslashes, Unicode characters, and newlines. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
setup-secure.sh:73
Finding
Webhook Signing Keys Are Entered Visibly, Printed, and Written to Plaintext Helper Files<![CDATA[ ## Vulnerability Details **File Locations**: - `setup-secure.sh`, lines 73 and 105-119 - `bazhuayu-webhook.py`, lines 152 and 215-226 - `migrate-to-env.sh`, lines 60-82 **Vulnerability Type**: Plaintext sensitive-data exposure **Risk Level**: Medium ### Vulnerable Code From `setup-secure.sh`: ```bash read -p "请输入签名密钥 (Key): " WEBHOOK_KEY ``` ```bash ENV_CONFIG="# 八爪鱼 RPA Webhook 配置 # 创建于:$(date '+%Y-%m-%d %H:%M:%S') # 请将以下两行添加到 ~/.bashrc 或 ~/.zshrc export BAZHUAYU_WEBHOOK_URL=\"$WEBHOOK_URL\" export BAZHUAYU_WEBHOOK_KEY=\"$WEBHOOK_KEY\"" echo "$ENV_CONFIG" ENV_FILE="$SCRIPT_DIR/.env.example" echo "$ENV_CONFIG" > "$ENV_FILE" chmod 600 "$ENV_FILE" ``` Equivalent behavior exists in the Python initializer: ```python key = input("请输入签名密钥 (Key): ").strip() ``` ```python print(f'export BAZHUAYU_WEBHOOK_KEY="{key}"') for env_name, value in env_params.items(): print(f'export {env_name}="{value}"') ``` The migration script also prints and stores the extracted key: ```bash if [ -n "$CURRENT_KEY" ]; then ENV_CONFIG="$ENV_CONFIG export BAZHUAYU_WEBHOOK_KEY=\"$CURRENT_KEY\"" fi echo "$ENV_CONFIG" ENV_FILE="$SCRIPT_DIR/.env.migrated" echo "$ENV_CONFIG" > "$ENV_FILE" chmod 600 "$ENV_FILE" ``` ### Technical Analysis The signing key is treated as sensitive in the runtime, but the setup workflows undermine that protection in several ways: 1. `read -p` and Python `input()` echo the key while it is typed. 2. The complete key is printed to standard output. 3. The complete key is written to `.env.example` or `.env.migrated`. 4. Users are encouraged to place the key directly into shell startup files. 5. The audited artifact does not contain the `.gitignore` that documentation claims protects these generated files. Mode `600` reduces exposure to other local users but does not protect against: - Terminal recording and scrollback capture. - CI or support logs. - Screen sharing or screenshots. - User-level malware and processes. - Backups and synchroniza ...[truncated 1330 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Read secrets without terminal echo: ```bash read -r -s -p "Enter the signing key: " WEBHOOK_KEY echo ``` For Python, use: ```python from getpass import getpass key = getpass("Enter the signing key: ").strip() ``` 2. Never print the complete signing key. Display only confirmation or a short fingerprint: ```python fingerprint = hashlib.sha256(key.encode()).hexdigest()[:12] print(f"Signing key configured; fingerprint: {fingerprint}") ``` 3. Do not write real credentials to `.env.example`. That file should contain placeholders only: ```text BAZHUAYU_WEBHOOK_URL=https://example.invalid/webhook BAZHUAYU_WEBHOOK_KEY=replace-with-your-key ``` 4. If a local secret file is necessary, create it only after explicit user consent, use a clearly sensitive name such as `.env`, open it atomically with mode `600`, and warn the user that it contains credentials. 5. Add an actual `.gitignore` containing at least: ```gitignore config.json config.json.backup.* .env .env.* !.env.example *.log ``` If `.env.example` remains a placeholder-only file, it may be safely unignored. It must never contain a real key. 6. Prefer a platform credential store or a dedicated secrets manager over shell startup files. 7. Remove documentation that recommends `echo $BAZHUAYU_WEBHOOK_KEY`, because it exposes the complete key to the terminal. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
migrate-to-env.sh:16
Finding
Migration Leaves Additional Plaintext Copies of the Original Signing Key<![CDATA[ ## Vulnerability Details **File Location**: `migrate-to-env.sh`, lines 16 and 31-34 **Vulnerability Type**: Insecure sensitive-data backup **Risk Level**: Medium ### Vulnerable Code ```bash BACKUP_FILE="$SCRIPT_DIR/config.json.backup.$(date +%Y%m%d%H%M%S)" ``` ```bash # Back up the original configuration echo "📦 备份原配置文件..." cp "$CONFIG_FILE" "$BACKUP_FILE" echo "✅ 备份完成:$BACKUP_FILE" ``` The script later clears the key only from the active configuration: ```python if 'key' in config: config['key'] = '' ``` ### Technical Analysis The migration process is presented as moving a secret out of `config.json`, but it first creates a complete timestamped copy of the original file. If the original configuration contains a signing key, the backup continues to contain that key after migration. The script does not: - Explicitly set the backup to mode `600`. - Check the resulting backup permissions. - Remove the backup after migration succeeds. - Warn clearly that the backup still contains the signing key. - Provide automatic retention limits. - Include a verified `.gitignore` entry for `config.json.backup.*`. Depending on the source mode, current umask, filesystem behavior, backup tooling, and repository workflow, the credential may remain more broadly exposed than intended. Repeated migrations can create multiple long-lived copies. ### Attack Path 1. A legacy `config.json` contains a plaintext webhook signing key. 2. The user runs `./migrate-to-env.sh`. 3. The script copies the complete configuration to a timestamped backup. 4. The active configuration is cleared, but the backup retains the original key. 5. The backup is later read by another local process, included in an archive, synchronized, or accidentally committed. 6. An attacker recovers the key and invokes the protected RPA webhook. ### Impact Assessment The issue defeats the intended reduction in stored secret copies and creates a false sense that migration removed the credential from d ...[truncated 242 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Ask the user whether a secret-bearing backup should be created. 2. If a backup is required, create it with enforced permissions and verify them: ```bash umask 077 install -m 600 "$CONFIG_FILE" "$BACKUP_FILE" chmod 600 "$BACKUP_FILE" ``` 3. Clearly label the backup as containing sensitive credentials. 4. Offer to delete the backup after the migrated configuration has been verified. 5. Add `config.json.backup.*` to `.gitignore`. 6. Avoid creating multiple uncontrolled backups; apply a short retention policy. 7. Consider backing up only non-sensitive fields rather than copying the complete original configuration. 8. Document that normal file deletion may not guarantee secure erasure on journaled, copy-on-write, encrypted, or remotely synchronized filesystems. ]]>

T08 · Insecure Dependencies

Note
Location
MANUAL.md:453
Finding
Documentation Recommends Installing an Unused and Unpinned Third-Party Dependency<![CDATA[ ## Vulnerability Details **File Location**: `MANUAL.md`, line 453 **Vulnerability Type**: Unnecessary unpinned package installation **Risk Level**: Low ### Vulnerable Code ```bash pip3 install requests ``` ### Technical Analysis The runtime implementation uses Python's standard-library `urllib.request` and does not import `requests`. The documented package installation is therefore unnecessary. The command does not constrain the package version, verify hashes, select a reviewed package index, or isolate installation in a virtual environment. Package resolution consequently depends on the user's active pip configuration and package indexes. Although `requests` is a well-known package and no malicious dependency is shipped by this project, unnecessary installation expands the supply-chain attack surface. Risks include a compromised index, malicious package substitution through a custom index, or a future compromised release. ### Attack Path 1. A user follows the troubleshooting or installation documentation. 2. The user runs `pip3 install requests`. 3. Pip resolves the package and transitive dependencies from the configured package indexes. 4. A compromised or substituted artifact is downloaded and installed. 5. Package installation or later imports execute attacker-controlled code with the user's privileges. This path depends on compromise or manipulation of the package supply chain; the audited project itself does not provide such a malicious package. ### Impact Assessment A compromised dependency could execute code with the privileges of the user running pip. If pip is invoked with administrative privileges outside the documented command, the impact could increase to system-wide compromise. Because the dependency is not needed by the current implementation, the exposure provides no corresponding functional benefit. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions Remove the `pip3 install requests` instruction because the program uses the Python standard library and does not require it. If the project later adopts third-party dependencies: 1. Declare them in a reviewed requirements file. 2. Pin exact versions. 3. Use cryptographic hashes with `pip --require-hashes`. 4. Install into an isolated virtual environment. 5. Use a trusted, explicitly configured package index. 6. Regularly scan dependencies for known vulnerabilities. 7. Keep the dependency set limited to packages required by runtime code. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • Rogue AgentSelf-Modification, Session Persistence
Findings (57)

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Content
配置完成后,请手动将 export 命令添加到 `~/.bashrc` 或 `~/.zshrc`。

---

## 📝 方式二:手动配置

### 步骤 1: 设置环境变量

```bash
# 临时设置(当前终端会话)
export BAZHUAYU_WEBHOOK_KEY="你的签名密钥"
export BAZHUAYU_WEBHOOK_URL="https://api-rpa.bazhuayu.com/api/v1/bots/webhooks/xxx/invoke"

# 永久设置(添加到 ~/.bashrc 或 ~/.zshrc)
echo 'export BAZHUAYU_WEBHOOK_KEY="你的签名密钥"' >> ~/.bashrc
echo 'export BAZHUAYU_WEBHOOK_URL="https://api-rpa.bazhuayu.com/api/v1/bots/webhooks/xxx/invoke"' >> ~/.bashrc
source ~/.bashrc
```

### 步骤 2: 编辑配置文件

```bash
vim config.json
```

填入配置(**key 留空**):

```json
{
  "url": "https://api-rpa.bazhuayu.com/api/v1/bots/webhooks/你的 ID/invoke",
  "key": "",
  "paramNames": ["keyword", "url"],
  "defaultParams": {
    "keyword": "默认关键词",
    "url": "https://example.com"
  }
}
```

### 步骤 3: 验证配置

```bash
python3 bazhuayu-webhook.
Confidence
75% confidence
Finding
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
--prune-empty --tag-name-filter cat -- --all

# 2. 推送更改
git push origin --force --all

# 3. 联系 GitHub/GitLab 支持清除缓存 (如已推送到远程)
Confidence
70% 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).

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The Chinese description frames the skill as a webhook-trigger utility, but the documented workflow includes interactive collection of secrets, creation of local config and .env-related files, permission modification, optional shell environment changes, and migration execution. Even if intended for convenience, these side effects materially expand the trust boundary and could expose or persist sensitive data on disk without users realizing the full scope.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The Chinese description frames the skill as a webhook-trigger utility, but the documented workflow includes interactive collection of secrets, creation of local config and .env-related files, permission modification, optional shell environment changes, and migration execution. Even if intended for convenience, these side effects materially expand the trust boundary and could expose or persist sensitive data on disk without users realizing the full scope.

Ae1

High
Category
analysis-evasion
Content
- **安全指南**: `SECURITY.md` - 安全最佳实践
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Hidden Instructions

High
Category
Prompt Injection
Content
<p>本教程详细介绍如何在八爪鱼 RPA 中创建和配置 Webhook 触发器。</p>

        <!-- 步骤 1 -->
        <div class="step">
            <h2><span class="step-number">1</span>进入触发器管理</h2>
            <ol>
Confidence
70% confidence
Finding
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Env Variable Harvesting

High
Category
Data Exfiltration
Content
config['key'] = env_key
    
    # 3. 加载环境变量中的参数默认值 (BAZHUAYU_PARAM_*)
    for env_name, env_value in os.environ.items():
        if env_name.startswith('BAZHUAYU_PARAM_'):
            param_name = env_name.replace('BAZHUAYU_PARAM_', '')
            # 转换为驼峰或小写格式
Confidence
70% confidence
Finding
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
This markdown file is written entirely in Chinese and does not indicate that other languages are supported or that the Chinese-only presentation is an intentional, justified region-specific requirement. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy violation.

Session Persistence

Medium
Category
Rogue Agent
Content
```bash
# 创建目录
mkdir -p ~/.openclaw/workspace/skills/bazhuayu-webhook
cd ~/.openclaw/workspace/skills/bazhuayu-webhook

# 下载主程序(需要主程序文件)
Confidence
60% confidence
Finding
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.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The manual instructs users to place the Webhook signing key directly in a local config.json file but does not warn about file permissions, secret leakage, or safer secret storage options. Because this key authorizes invocation of remote RPA jobs, exposure could let anyone with filesystem access or access to backups/repositories trigger automation on the user's account.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The run examples show simple commands that trigger a remote Webhook-backed RPA task, but the manual does not clearly warn that these commands will execute automation in the user's external RPA environment. In an agent or copy-paste context, this can lead to unintended job execution, side effects on third-party sites, or use of paid/account-bound resources.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
2. **同步系统时间**
   ```bash
   # Linux
   sudo ntpdate pool.ntp.org
   
   # 或使用 timedatectl
   sudo timedatectl set-ntp true
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
2. **同步系统时间**
   ```bash
   # Linux
   sudo ntpdate pool.ntp.org
   
   # 或使用 timedatectl
   sudo timedatectl set-ntp true
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
2. **同步系统时间**
   ```bash
   # Linux
   sudo ntpdate pool.ntp.org
   
   # 或使用 timedatectl
   sudo timedatectl set-ntp true
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
2. **同步系统时间**
   ```bash
   # Linux
   sudo ntpdate pool.ntp.org
   
   # 或使用 timedatectl
   sudo timedatectl set-ntp true
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
2. **同步系统时间**
   ```bash
   # Linux
   sudo ntpdate pool.ntp.org
   
   # 或使用 timedatectl
   sudo timedatectl set-ntp true
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The quickstart tells users to run test commands but does not explicitly warn that doing so will send a real request to the configured external Webhook endpoint. In this skill’s context, that can unintentionally trigger a remote RPA job, causing side effects such as data collection, task execution, or unintended automation against external systems.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The final instruction to run the tool lacks any warning that execution will invoke the configured remote Webhook and trigger the associated RPA workflow. Because this is the final call-to-action in a setup guide, users are especially likely to execute it immediately without understanding that it performs an external action with potentially irreversible operational effects.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
The skill documentation is presented entirely in Chinese from the title onward, with no indication that users may choose another language or that the skill is intended only for a Chinese-speaking or region-specific audience. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
This markdown file contains all user-facing security guidance in Chinese, and there is no indication that the skill is region-specific or that users can opt into this locale. That creates a natural-language policy concern because it effectively forces a specific language for understanding safety-critical instructions.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# 设置正确权限 (仅所有者可读写)
chmod 600 config.json

# 验证权限
ls -la config.json
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# 设置正确权限 (仅所有者可读写)
chmod 600 config.json

# 验证权限
ls -la config.json
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# 设置正确权限 (仅所有者可读写)
chmod 600 config.json

# 验证权限
ls -la config.json
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# 设置正确权限 (仅所有者可读写)
chmod 600 config.json

# 验证权限
ls -la config.json
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# 设置正确权限 (仅所有者可读写)
chmod 600 config.json

# 验证权限
ls -la config.json
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Static analysis

No suspicious patterns detected.