Back to skill

Security audit

Bocha Search (Momo优化版)

Security checks for vulnerabilities and agentic risk

Overview

This Bocha search skill appears purpose-aligned, but it needs review because it handles an API key insecurely and sends user searches to an external service.

Review before installing. Use a low-privilege Bocha API key, avoid putting secrets or private terms in search queries, prefer an environment variable or protected secret input over command-line setup, and restrict permissions on ~/.openclaw/skills-config/bocha-search.json if you use the setup script.

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
scripts/setup.sh:14
Finding

API Credential Stored Without Restrictive File Permissions

Content
View full analysis
"$CONFIG_DIR/bocha-search.json" << JSON { "apiKey": "$API_KEY" } JSON ``` ### Technical Analysis The setup script writes the Bocha API key in plaintext without establishing restrictive permissions on either the configuration directory or the credential file. The permissions are inherited from the user's current `umask`. Under a permissive configuration, other local users or processes may be able to read the file. The documented setup mechanism also passes the API key as a command-line argument: ```bash ~/.openclaw/skills/bocha-search/scripts/setup.sh YOUR_API_KEY ``` Command-line secrets may be retained in shell history and can be temporarily visible through local process-inspection interfaces. ### Attack Path 1. A user runs the documented setup command with the API key as an argument. 2. The command may be recorded in the user's shell history or exposed through process inspection while running. 3. The script creates `bocha-search.json` using permissions determined by the existing `umask`. 4. A local user or process with access to the history, process metadata, or insufficiently protected file reads the credential. 5. The attacker uses the stolen key to authenticate to the Bocha API. ### Impact Assessment Successful exploitation exposes the user's Bocha API credential. An attacker could submit API requests as the victim, consume the victim's quota, incur costs associated with the account, or access capabilities granted to that key. This issue does not independently grant elevated operating-system privileges. Its scope is limited to local principals capable of reading the exposed command or file and to the permissions associated with the compromised API key. ]]>
Remediation
View remediation
"$tmp_file" chmod 600 "$tmp_file" mv "$tmp_file" "$CONFIG_DIR/bocha-search.json" ``` 5. Update the documentation so it does not recommend placing API credentials directly on the command line. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/search.sh:32
Finding

Unescaped User Input Allows JSON Request-Structure Injection

Content
View full analysis
"$CONFIG_DIR/bocha-search.json" << JSON { "apiKey": "$API_KEY" } JSON ``` ### Technical Analysis The script interpolates `QUERY` directly into a quoted JSON string and inserts `COUNT` as a raw JSON value. Neither value is encoded with a JSON-aware serializer. A query containing quotation marks, backslashes, control characters, or JSON delimiters can terminate or modify the intended `query` value. Because `COUNT` is inserted without quotes and is not validated as an integer in the documented range of 1 through 10, crafted input can add or replace JSON fields or make the request malformed. For example, a crafted count such as: ```text 5, "freshness": "pd", "unexpected": true ``` would alter the request structure rather than being treated as a result count. Likewise, an API key containing JSON-special characters can produce an invalid or modified configuration document during setup. Shell metacharacters embedded in these variables are not directly evaluated as shell commands in the shown code, so this is JSON injection and request manipulation rather than demonstrated shell command injection. ### Attack Path 1. An application, agent, or user passes attacker-controlled text as the search query or result count. 2. The script interpolates the value directly into the JSON request body without encoding or ...[truncated 1165 chars]
Remediation
View remediation
10 )); then echo "Count must be an integer from 1 through 10." >&2 exit 1 fi ``` 2. Construct the request with `jq` rather than string interpolation: ```bash REQUEST_BODY=$(jq -n \ --arg query "$QUERY" \ --argjson count "$COUNT" \ '{ query: $query, summary: true, freshness: "noLimit", count: $count }') RESPONSE=$(curl -sS "https://api.bocha.cn/v1/web-search" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ --data-binary "$REQUEST_BODY") ``` 3. Generate the credential configuration using a JSON serializer: ```bash jq -n --arg key "$API_KEY" '{apiKey: $key}' \ > "$CONFIG_DIR/bocha-search.json" ``` 4. Check serialization and `curl` failures explicitly. Use `curl --fail-with-body` where supported and reject invalid or unexpected response structures before processing them. 5. Treat all arguments as untrusted when the script can be invoked by an agent, automation system, or external integration. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (12)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill documents and invokes shell scripts but does not declare an explicit tool scope such as permissions or allowed-tools. This weakens least-privilege controls because an agent or reviewer cannot easily determine the intended execution boundary, increasing the chance of unintended shell access or misuse.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill sends user search queries to a third-party API but does not clearly warn that user-provided content will leave the local environment. This creates a privacy and data-handling risk because users may unknowingly submit sensitive prompts, internal terms, or regulated data to an external service.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

Natural-language policy checks apply to all file types, including markdown. The description says the tool returns Chinese results, which imposes a language/locale behavior without any opt-in, alternative language option, or explanation that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 40)May include surrounding context.

~/.openclaw/skills/bocha-search/scripts/search.sh "关键词"

text

### 直接用 curl

```bash
curl -s "https://api.bocha.cn/v1/web-search" \

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 43)May include surrounding context.

直接用 curl

bash
curl -s "https://api.bocha.cn/v1/web-search" \
  -H "Authorization: Bearer $BOCHA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The description states that the tool returns Chinese results, which imposes a language preference as part of the skill behavior. Under the policy, language constraints should either offer user choice or be clearly documented as a justified region-specific limitation; neither is present here.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

This curl invocation transmits user input and an API credential to an external network endpoint. Although external transmission is expected for a web-search skill, it remains a genuine security concern because the query content leaves the local environment and may disclose sensitive information if users are not clearly warned or if the environment assumes tools are local-first.

Content

Scanner excerpt · scripts/search.sh (reported line 33)May include surrounding context.

sh
fi

# 执行搜索
RESPONSE=$(curl -s "https://api.bocha.cn/v1/web-search" \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d "{

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

This curl invocation transmits user input and an API credential to an external network endpoint. Although external transmission is expected for a web-search skill, it remains a genuine security concern because the query content leaves the local environment and may disclose sensitive information if users are not clearly warned or if the environment assumes tools are local-first.

Content

Scanner excerpt · scripts/search.sh (reported line 33)May include surrounding context.

sh
fi

# 执行搜索
RESPONSE=$(curl -s "https://api.bocha.cn/v1/web-search" \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d "{

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script sends the user-supplied search query to a third-party service at api.bocha.cn without any runtime warning, consent prompt, or masking. This is a real privacy/security issue because users may enter sensitive internal terms, credentials, or proprietary data assuming the tool is local, and the skill context is explicitly a search tool that exfiltrates input by design.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · scripts/setup.sh (reported line 16)May include surrounding context.

sh
# 保存到配置文件
CONFIG_DIR="$HOME/.openclaw/skills-config"
mkdir -p "$CONFIG_DIR"

cat > "$CONFIG_DIR/bocha-search.json" << JSON
{

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code persists a user-supplied API key to disk in JSON format under the home directory. Although the script prints where the file is saved, it does not disclose that a sensitive credential is being stored locally or provide any caution about protecting the file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script's comments and user-visible output are entirely in Chinese, including usage guidance and status messages. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale restriction is clearly justified.

Content

No source excerpt is available for this finding.