Back to skill

Security audit

Baidu Search

Security checks for vulnerabilities and agentic risk

Overview

The skill performs Baidu web search as advertised, but it handles search queries and an API key in ways users should review before installing.

Install only if you are comfortable sending search terms to Baidu and storing a Baidu API key for this skill. Avoid searching for secrets, personal data, or confidential internal information, and protect ~/.openclaw/openclaw.json with restrictive permissions if you follow the documented setup.

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/search.py:35
Finding
Unredacted Search Queries Written to Standard Output<![CDATA[ ## Vulnerability Details **File Location**: `scripts/search.py`, lines 35–40 **Vulnerability Type**: Sensitive data exposure through application logging **Risk Level**: Medium ### Vulnerable Code ```python query = sys.argv[1] parse_data = {} try: parse_data = json.loads(query) print(f"success parse request body: {parse_data}") except json.JSONDecodeError as e: print(f"JSON parse error: {e}") ``` ### Technical Analysis After parsing the command-line JSON argument, the script prints the complete request object to standard output. This includes the value of `query` and any additional caller-supplied fields. Search queries can contain confidential names, internal URLs, unpublished project information, incident data, personal information, credentials pasted by mistake, or other sensitive context. Printing the full request is not necessary to perform the declared search functionality. Standard output may be retained in OpenClaw transcripts, gateway logs, terminal capture systems, CI/CD logs, monitoring services, or other centralized logging infrastructure. Consequently, data intended only for the search provider may be disclosed to additional parties with log access. The API key itself is not included in this log statement. ### Attack Path 1. A user or Agent invokes the Skill with confidential information in the `query` field. 2. The script parses the supplied JSON. 3. The `print` statement serializes and writes the entire parsed object to standard output. 4. OpenClaw, a shell wrapper, CI system, or monitoring service captures the output. 5. A user or process with access to those logs retrieves the confidential query. An attacker able to influence search requests could also deliberately place sensitive-looking or misleading content in logs, although this does not directly grant code execution. ### Impact Assessment Successful exploitation exposes the contents of search requests to parties that can access captured output. The scope i ...[truncated 312 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Remove the request-body logging statement entirely: ```python parse_data = json.loads(query) ``` If operational logging is required: 1. Log only non-sensitive metadata, such as whether parsing succeeded. 2. Do not log the query text or arbitrary caller-supplied fields. 3. Send diagnostics to standard error rather than mixing them with structured search results. 4. Make verbose logging opt-in and disabled by default. 5. Apply field-based redaction before logging any request object. 6. Configure Agent and gateway logs with restrictive access controls and short retention periods. 7. Review existing logs and securely delete historical query data where appropriate. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
references/apikey-fetch.md:17
Finding
API Key Stored in a Plaintext Configuration File Without Permission Hardening<![CDATA[ ## Vulnerability Details **File Location**: `references/apikey-fetch.md`, lines 17–31 **Vulnerability Type**: Insecure credential storage guidance **Risk Level**: Medium ### Vulnerable Documentation ```markdown ### 2. Configure OpenClaw Edit the OpenClaw configuration file: `~/.openclaw/openclaw.json` Add or merge the following structure: ```json { "skills": { "entries": { "baidu-search": { "env": { "BAIDU_API_KEY": "your_actual_api_key_here" } } } } } ``` ``` The guide later recommends this storage approach without documenting file-permission restrictions or an alternative secret-management mechanism. ### Technical Analysis The setup guide instructs users to persist the Baidu API key directly in `~/.openclaw/openclaw.json`. A configuration file can be an acceptable credential source when properly protected, but the instructions do not require restrictive permissions, warn against committing or backing up the file, or recommend a dedicated secret store. If the file inherits permissive permissions or is copied into broadly accessible backups, diagnostics, dotfile repositories, or support bundles, the API key can be disclosed. The risk is particularly relevant on shared systems or where multiple tools can inspect the user's home directory. The executable script itself reads only the specifically declared `BAIDU_API_KEY` environment variable and sends it over HTTPS to Baidu’s official Qianfan endpoint. No hardcoded credential or unrelated credential collection was identified in the script. ### Attack Path 1. A user follows the documented setup procedure and stores a valid Baidu API key in `~/.openclaw/openclaw.json`. 2. The configuration file has permissive permissions, is included in a backup or dotfile repository, or is collected in a diagnostic bundle. 3. Another local user, process, repository reader, backup operator, or support recipient obtains the file. 4. The party extracts the plainte ...[truncated 810 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer OpenClaw’s supported secret-management facility or an operating-system credential store when available. 2. If the JSON configuration must contain the key, explicitly require owner-only permissions: ```bash chmod 600 ~/.openclaw/openclaw.json ``` 3. Advise users to verify ownership and permissions: ```bash ls -l ~/.openclaw/openclaw.json ``` 4. Warn users not to commit the file to source control, include it in support bundles, or copy it into unencrypted backups. 5. Document credential rotation and immediate revocation procedures for suspected exposure. 6. Recommend using a dedicated, minimally scoped API credential with usage limits and billing alerts where Baidu supports those controls. 7. Ensure error handling and diagnostics never print the API key or complete environment. ]]>
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 (8)

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill invokes code with both network access and an API key dependency, but it does not declare any explicit tool scope or permissions boundary in the skill metadata. This creates a transparency and governance gap: an agent or user cannot easily determine or constrain what capabilities the skill may exercise, increasing the chance of unintended external requests or secret exposure through overly broad execution context.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill says it performs web search via Baidu, but it does not clearly warn users that submitted queries are transmitted to Baidu's external API. Users may enter sensitive internal data, credentials, or proprietary research terms under the assumption of local processing, causing inadvertent third-party disclosure.

Session Persistence

Medium
Category
Rogue Agent
Content
Visit: **https://console.bce.baidu.com/ai-search/qianfan/ais/console/apiKey**

- Log in to your Baidu Cloud account
- Create an application or view existing API keys
- Copy your **API Key** (only API Key is needed)

### 2. Configure OpenClaw
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
94% confidence
Finding
The guide explicitly instructs users to place a live API key in plaintext within a local JSON file and does not mention file permission hardening, secret stores, or other secure handling practices. While this is common in developer tooling, it increases the chance of credential disclosure through backups, filesystem compromise, screenshots, shell history, or accidental inclusion in version control.

External Transmission

Medium
Category
Data Exfiltration
Content
}

    # 使用POST方法发送JSON数据
    response = requests.post(url, json=requestBody, headers=headers)
    response.raise_for_status()
    results = response.json()
    if "code" in results:
Confidence
91% confidence
Finding
This code performs an outbound HTTP POST to a third-party service with user-controlled content. In the context of a web-search skill this is core functionality, but it still creates a genuine external transmission risk because entered queries leave the local trust boundary and may be stored or processed by the provider.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The skill sends the user-supplied query content to Baidu's external web search API, which is an external data disclosure boundary. In a search skill this behavior is expected, but it is still a real privacy/security concern because users may place sensitive data in queries and the file contains no disclosure, consent, or minimization around that transmission.

Natural-Language Policy Violations

Low
Confidence
72% confidence
Finding
The skill includes Chinese-only example queries and uses Chinese-language content throughout the examples, which can imply a fixed locale or language expectation. Because the file does not state that the skill is China-specific or explicitly allow other languages, this creates a mild natural-language locale policy concern.

Missing User Warnings

Low
Confidence
95% confidence
Finding
The script logs the fully parsed request body to stdout, which can expose search terms and optional parameters in logs, terminal history, or orchestration systems. If users include sensitive information in queries, that data may be retained beyond the intended request path and become accessible to operators or other systems.

Static analysis

No suspicious patterns detected.