Back to skill

Security audit

baidu search

Security checks for vulnerabilities and agentic risk

Overview

This Baidu search skill appears intended to do web searches, but it needs review because it prints search requests and tells users to store an API key persistently without security guidance.

Install only if you are comfortable sending searches to Baidu and storing a Baidu API key for the skill. Before use, remove or disable the request-body print in scripts/search.py and protect ~/.openclaw/openclaw.json as a sensitive credentials file, for example by restricting access and avoiding sync or support uploads that include it.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/search.py:39
Finding
Sensitive Search Queries Exposed Through Unconditional Logging## Vulnerability Details **File Location**: `scripts/search.py`, line 39 **Vulnerability Type**: Sensitive data exposure through logging **Risk Level**: Medium **Vulnerable Code**: ```python print(f"success parse request body: {parse_data}") ``` ### Technical Analysis The script unconditionally writes the complete parsed request object to standard output. This object contains the user-supplied search query and may also contain other request parameters. Search queries can include confidential names, private URLs, internal project information, incident details, credentials accidentally included by a user, or other sensitive material. In an OpenClaw deployment, standard output may be displayed to other users, captured by a gateway, forwarded to centralized logging, or retained beyond the execution of the Skill. Logging the request contents is not necessary for the declared web-search functionality and therefore exceeds the minimum data exposure required to perform the task. The API key itself is not printed by this statement. ### Attack Path 1. An attacker persuades a user or Agent to perform a Baidu search containing confidential information. 2. The Skill parses the supplied JSON request. 3. Before executing the search, the Skill prints the complete request object to standard output. 4. OpenClaw, a gateway, shell redirection, or a logging service captures and retains the output. 5. An individual with access to those logs retrieves the sensitive query data. This issue does not directly provide code execution or elevated system privileges. Exploitation requires the ability to influence query content and subsequently access the generated output or logs. ### Impact Assessment The issue can disclose the full search query and associated request parameters within the scope of each Skill invocation. Exposure is limited to data supplied in the request object; no evidence shows that the statement exposes the `BAIDU_API_KEY` ...[truncated 332 chars]
Remediation
## Remediation Suggestions Remove the unconditional logging statement: ```python # Do not print parse_data or the query. ``` If diagnostic output is required: 1. Place it behind an explicitly enabled debug setting that is disabled by default. 2. Log only a generic event such as `Request parsed successfully`. 3. Never include the query, authorization header, API key, or complete request body. 4. Configure OpenClaw and related logging systems to restrict log access and use short retention periods. 5. Review existing logs and securely delete retained query data where policy permits. 6. Add automated tests or linting rules that detect logging of request bodies, secrets, and sensitive environment variables.
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 (6)

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill requires environment access for BAIDU_API_KEY and performs network operations, but it does not declare an explicit tool scope such as permissions or allowed-tools. This weakens least-privilege controls and can allow broader execution capabilities than reviewers or runtime policy expect, increasing the chance of unintended external access or secret exposure if the skill is modified or misused.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
The examples consistently use Chinese queries such as "人工智能", "最新新闻", and "旅游景点", which suggests a language-specific usage pattern. Because the file does not state that the skill is region-specific or that users may choose their preferred language, this can violate the policy against forcing a specific language without opt-in.

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
95% confidence
Finding
The documentation instructs users to store a live Baidu API key directly in a persistent plaintext config file under the user's home directory, but gives no warning about treating the file as sensitive or restricting file permissions. This increases the risk of credential exposure through local compromise, backups, accidental sharing, dotfile sync, or support/debug uploads, which could enable unauthorized use of the Baidu service.

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
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The script prints the fully parsed request body, which includes the user's search query, to stdout before sending it to Baidu. Queries may contain sensitive research topics, credentials, personal data, or proprietary information, and logging them creates an additional disclosure channel beyond the intended external API transmission.

Static analysis

No suspicious patterns detected.