Back to skill

Security audit

bocha-skill

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent Bocha web-search integration, but the package includes a concrete API-key-shaped secret and publishing helper commands that deserve review before installation or reuse.

Install only if you intend to send search queries to Bocha's API and can provide your own BOCHA_API_KEY. Do not use or copy the sk- key shown in PUBLISH.md; it should be rotated by the publisher if it was ever valid. Avoid running publish.sh unless you are comfortable with it installing a global npm CLI, and review any delete commands before use.

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

T09 · Insecure Skill Coding Practices

Error
Location
PUBLISH.md:29
Finding
Hardcoded Bocha API Credential in Published Documentation<![CDATA[ ## Vulnerability Details **File Location**: `PUBLISH.md`, line 29 **Vulnerability Type**: Hardcoded secret exposure **Risk Level**: High ### Vulnerable Code ```bash export BOCHA_API_KEY="sk-a2f0234180684fe0adcf6302c6027040" ``` ### Technical Analysis The publishing guide contains a concrete API-key-shaped credential instead of a placeholder. Documentation is included in the distributed skill package and may be copied, indexed, cached, or committed to public repositories. Anyone with access to the package can retrieve this value without authentication. If the credential is still valid, an attacker can use it as a bearer credential when sending requests to the Bocha API. The presence of the secret also contradicts the document's own guidance against hardcoded API keys. ### Attack Path 1. An attacker downloads or reads the published skill package. 2. The attacker searches the package for common secret prefixes such as `sk-`. 3. The attacker extracts the credential from `PUBLISH.md`. 4. The attacker supplies it as a bearer token in requests to the Bocha API. 5. If the credential remains active, requests are charged against or attributed to the credential owner's account. No access to the victim's local system is required for this exploitation path. ### Impact Assessment If valid, the exposed credential may permit unauthorized use of the associated Bocha API account, including: - Consumption of paid search credits or account balance. - Exhaustion of API quotas and resulting denial of service to the legitimate owner. - Requests attributed to the victim's account. - Potential access to any API operations authorized for that key. The finding does not establish that the credential remains valid or that it grants privileges outside the Bocha API account. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions 1. Revoke or rotate the exposed credential immediately through the Bocha account console. 2. Replace the value with an unmistakable placeholder: ```bash export BOCHA_API_KEY="your-bocha-api-key" ``` 3. Review repository history, published archives, release artifacts, and caches for additional copies of the credential. 4. Enable automated secret scanning in pre-commit hooks and CI/CD pipelines. 5. Add patterns for Bocha API keys and generic `sk-` tokens to the scanning rules. 6. Store real credentials only in environment variables or an approved secrets manager. 7. If supported by the provider, restrict replacement keys by scope, quota, source address, and expiration. ]]>

T08 · Insecure Dependencies

Warning
Location
publish.sh:18
Finding
Automatic Installation of an Unpinned Global npm Package<![CDATA[ ## Vulnerability Details **File Location**: `publish.sh`, lines 18-22 **Vulnerability Type**: Mutable and unpinned third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```bash # 检查 clawdhub 是否安装 if ! command -v clawdhub &> /dev/null; then echo -e "${YELLOW}⚠️ clawdhub CLI 未安装,正在安装...${NC}" npm install -g clawdhub fi ``` Related unpinned installation instructions also appear in `README.md`, `PUBLISH.md`, and `QUICK_PUBLISH.md`. ### Technical Analysis The publishing script automatically installs the latest version of the `clawdhub` npm package globally when a command with that name is not already available. No exact version, lockfile, integrity digest, or artifact signature is specified. Consequently, the code executed by this step can differ from the code that was reviewed. npm package installation may execute package lifecycle scripts under the privileges of the user running `publish.sh`. A compromised package release, maintainer account, registry response, or transitive dependency could therefore introduce arbitrary local code execution. Global installation also modifies shared user or system tooling rather than containing the dependency within the project. ### Attack Path 1. An attacker compromises the relevant package, one of its dependencies, its publisher account, or the package delivery channel. 2. The attacker publishes a malicious version under the package name used by the script. 3. A user without an existing `clawdhub` executable runs `publish.sh`. 4. The script invokes `npm install -g clawdhub` without pinning or integrity verification. 5. npm retrieves the mutable package release and runs any applicable installation lifecycle code. 6. Malicious code executes with the permissions of the user running the publishing script. This path is contingent on a supply-chain compromise; the audited package itself does not contain evidence that the current `clawdhub` package is malicious. ### Impact Assessm ...[truncated 645 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not automatically install global software from the publishing script. 2. Require users to install a reviewed CLI release explicitly, and terminate with clear instructions when it is absent. 3. Pin an exact reviewed version rather than resolving the latest release: ```bash npm install --save-dev --save-exact clawdhub@<reviewed-version> ``` 4. Commit and enforce a lockfile with package integrity metadata. 5. Prefer a project-local executable invoked through a controlled package script rather than a global installation. 6. Verify the package's official ownership, provenance, release signatures, and integrity before use. 7. Use `npm ci` in a restricted build environment and consider disabling lifecycle scripts where they are unnecessary. 8. Run publishing in an isolated, least-privileged environment with narrowly scoped credentials. 9. Add dependency scanning and review updates before changing the pinned version. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
publish.sh:47
Finding
ClawdHub API Token Is Read with Terminal Echo Enabled<![CDATA[ ## Vulnerability Details **File Location**: `publish.sh`, lines 47-48 **Vulnerability Type**: Plaintext display of an authentication token **Risk Level**: Low ### Vulnerable Code ```bash read -p "请输入你的 API Token: " token clawdhub login --token "$token" ``` ### Technical Analysis Bash `read` is used without the `-s` option. As a result, the ClawdHub API token is visibly echoed in the terminal while the user types it. Although `"$token"` is correctly quoted and the code does not demonstrate shell command injection, the token can be exposed to nearby observers, screen-sharing participants, terminal recording systems, or captured interactive session output. The token also remains in the shell variable until the script exits or the variable is explicitly cleared. ### Attack Path 1. A user selects token-based authentication while running `publish.sh`. 2. The script prompts for the API token using an ordinary echoed input field. 3. The token appears visibly in the terminal as it is entered. 4. An attacker observes the screen, a shared terminal session, or a terminal recording. 5. The attacker captures the token and submits it to ClawdHub authentication. 6. If the token is valid and has sufficient scope, the attacker performs actions authorized for that token. This attack requires visibility into the interactive terminal or its recording. ### Impact Assessment The attacker may obtain the ClawdHub privileges assigned to the exposed token. Depending on its configured scope, this could include: - Authenticating as the token owner. - Publishing or updating skills. - Modifying or deleting published content. - Accessing account or package information available to the token. The exact scope cannot be established from the project because token permissions are controlled externally by ClawdHub. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions 1. Disable terminal echo while reading the token: ```bash read -r -s -p "Enter your ClawdHub API token: " token echo clawdhub login --token "$token" unset token ``` 2. Prefer the CLI's secure interactive authentication flow when available. 3. Clear the token variable immediately after use. 4. Avoid logging commands, enabling shell tracing, or recording sessions during authentication. 5. Use short-lived, revocable, least-privileged tokens. 6. Document a prompt rotation procedure in case a token is accidentally displayed or recorded. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (21)

Missing User Warnings

High
Confidence
99% confidence
Finding
The example shows a realistic secret format (`sk-...`) without an explicit warning that it is not a reusable credential, making accidental reuse or disclosure more likely. In skill-publishing documentation, readers often copy-paste commands verbatim, so a real-looking key materially increases the chance of secret leakage and unauthorized third-party use.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared purpose describes an end-user search capability using the Bocha AI Search API. The actual code chunk does not implement search, call the Bocha API, or handle web/image/news queries at all. Its primary purpose is release automation: ensuring the ClawdHub CLI is installed, authenticating to ClawdHub, collecting publishing metadata, and publishing the skill. These are materially different behaviors and include undeclared capabilities such as package publication, CLI installation, and credential handling for ClawdHub.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The document embeds a concrete-looking `BOCHA_API_KEY` value directly in a shell command, which contradicts its own guidance against hardcoding secrets. If this token is real or was copied from a real environment, it could be harvested from the published skill and abused to consume API quota or access the Bocha service under the author's account.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
对于 markdown 文件,SQP-2 要求对可能影响系统完整性或造成不可逆后果的行为提供用户警示。L247 给出了 `clawdhub delete ... --yes` 的删除命令,且 `--yes` 会跳过交互确认,但文档未说明该操作可能不可恢复、会影响现有用户或应先二次核对目标版本。

Natural-Language Policy Violations

Medium
Confidence
83% confidence
Finding
The natural-language description says the skill is designed for Chinese search and gives a Chinese-language usage example, presenting a locale-specific behavior. Under SQP-3, forcing a specific language or locale without user opt-in or clear justification can violate language/locale policy expectations.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The guide includes a destructive `clawdhub delete bocha-search --yes` command that bypasses confirmation and is presented as a normal troubleshooting step without an explicit warning about irreversibility or scope. In a publish guide, users may copy-paste commands verbatim, so this increases the chance of accidental deletion of a published skill or related account resource.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The README explains that user queries are sent to Bocha's external API but does not clearly warn users that their search terms will leave the local environment and be processed by a third party. In a search skill, queries may contain sensitive internal data, so lack of explicit disclosure creates a real privacy and data-handling risk even if the transmission is functionally expected.

External Transmission

Medium
Category
Data Exfiltration
Content
1. 用户输入搜索请求
2. OpenClaw 识别并路由到 bocha-search skill
3. 脚本读取 `BOCHA_API_KEY` 环境变量
4. 调用博查 API: `POST https://api.bocha-ai.com/v1/web-search`
5. 格式化结果为 Markdown 输出

## 发布到 ClawdHub
Confidence
96% confidence
Finding
This line documents active transmission of user-provided search data to an external API endpoint. External transmission is expected for a web-search skill, but it remains security-relevant because prompts, search terms, and possibly metadata may be exposed to a third-party service outside the user's trust boundary.

External Transmission

Medium
Category
Data Exfiltration
Content
**解决**:
1. 检查网络连接
2. 确认 API 端点可访问:`curl https://api.bocha-ai.com/v1/web-search`
3. 检查防火墙设置

## 许可证
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Lp3

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding
The skill declares network and environment-variable usage but does not explicitly scope or disclose those capabilities through permissions or allowed-tools. This weakens reviewability and user consent, making it easier for a skill to access secrets and send data externally without clear guardrails.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The description explains setup and features but does not clearly warn users that their queries will be transmitted to Bocha's external API. Users may unknowingly send sensitive personal, corporate, or regulated data to a third party, creating privacy and compliance risk.

Session Persistence

Medium
Category
Rogue Agent
Content
1. Visit [博查AI开放平台](https://open.bocha.cn/)
2. Register an account (注册账号)
3. Create an application and get your API KEY
4. Recharge if needed (充值以获得搜索额度)

### Step 2: Configure OpenClaw
Confidence
73% confidence
Finding
The documentation tells users to store a long-lived API key in persistent OpenClaw configuration or environment variables without discussing secure storage or least privilege. Persistent credential storage increases the blast radius if the local machine, config files, logs, or subprocess environment are exposed.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The routing statement says the skill may automatically trigger on Chinese queries or broad terms like 'search', which can cause unintended invocation. That increases the chance that user prompts, including sensitive research queries, are silently sent to a third-party provider without deliberate user choice.

External Transmission

Medium
Category
Data Exfiltration
Content
## Technical Details

### API Endpoint
- **URL**: `https://api.bocha.cn/v1/web-search`
- **Method**: POST
- **Auth**: Bearer token in Authorization header
Confidence
88% confidence
Finding
The skill is designed to send data to an external API endpoint, which is expected behavior for a web search integration, but it still creates real data-exfiltration risk. Any user query, potentially including sensitive content, will leave the local environment and be processed by a third party.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The script’s user-facing comments and prompts are written in Chinese throughout, including operational messages and required input prompts. For a general-purpose publish script, this imposes a specific language on the user without opt-in or any documented justification for a Chinese-only locale.

External Transmission

Medium
Category
Data Exfiltration
Content
const { URL } = require('url');

// API Configuration
const BOCHA_API_ENDPOINT = 'https://api.bocha.cn/v1/web-search';

// Colors for terminal output (optional)
const colors = {
Confidence
88% confidence
Finding
The skill is explicitly designed to communicate with an external search API, which means user-supplied queries and related metadata leave the local environment. In the context of an agent skill, this is security-relevant because operators may unknowingly expose sensitive prompts, research topics, or internal identifiers to a third party if outbound transmission is not made explicit and controlled.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The tool sends the user's search query to a third-party service at api.bocha.cn, but the output and runtime behavior do not clearly warn users that their input is being transmitted off-box. This creates a privacy and data-handling risk, especially if users enter sensitive terms, credentials, internal project names, or regulated data assuming the search runs locally.

Natural-Language Policy Violations

Low
Confidence
82% confidence
Finding
The natural-language description emphasizes Chinese-specific optimization (`中文优化`) and frames the skill primarily around Chinese usage. This may create a language/locale preference without explicit user opt-in or a documented reason that the skill is intentionally region- or language-specific.

Natural-Language Policy Violations

Low
Confidence
76% confidence
Finding
The file states users can ask in Chinese or English, but then says the skill will automatically route Chinese queries to this provider and repeatedly emphasizes Chinese-only optimization. This can amount to a language/locale preference baked into behavior without a clear opt-in or explicit user choice mechanism.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
The returned text is hardcoded in Chinese and date formatting is explicitly forced to the 'zh-CN' locale. This is a natural-language policy concern because the skill imposes a specific language/locale on all users without opt-in, fallback, or documentation that it is intended only for Chinese-language contexts.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The description states the skill is "Optimized for Chinese content and queries," which expresses a language/locale preference in natural-language metadata without offering user choice or opt-in. Under the policy rule for language/locale constraints, this can be considered a mild policy violation because the skill does not explicitly present localization as optional or region-specific.

Static analysis

No suspicious patterns detected.