Back to skill

Security audit

Baidu Chinese Search

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Baidu search skill, but users should protect the Baidu API key they configure for it.

Install only if you are comfortable sending your search queries to Baidu and using a Baidu API key. Store the key carefully, keep the OpenClaw config private, avoid sharing logs or screenshots that reveal it, and rotate the key if it may have been exposed.

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
references/apikey-fetch.md:18
Finding
Plaintext API Key Storage in OpenClaw Configuration<![CDATA[ ## Vulnerability Details **File Location**: `references/apikey-fetch.md`, lines 18-22 **Vulnerability Type**: Plaintext sensitive credential storage **Risk Level**: Medium ### Vulnerable Code Snippet ```json { "skills": { "entries": { "baidu-search": { "env": { "BAIDU_API_KEY": "your_actual_api_key_here" ``` ### Technical Analysis The setup guide instructs users to store the Baidu API key directly in `~/.openclaw/openclaw.json` as plaintext. No guidance is provided to restrict file permissions, use a dedicated secret manager, or otherwise protect the credential at rest. Although the API key is legitimately required by the Skill, persisting it in an inadequately protected configuration file may expose it to other local users, processes, backup systems, diagnostic tools, or accidental repository commits. The runtime network behavior itself is consistent with the declared functionality: `scripts/search.py` reads `BAIDU_API_KEY` from the environment and sends it as a Bearer credential only to the declared Baidu HTTPS API endpoint. ### Attack Path 1. A user follows the setup guide and places a valid Baidu API key in `~/.openclaw/openclaw.json`. 2. The configuration file is created with permissions that allow another local account or process to read it, or it is copied into an insecure backup or support bundle. 3. The attacker reads the plaintext `BAIDU_API_KEY` value. 4. The attacker submits authenticated requests to the Baidu API while impersonating the victim. 5. The stolen credential remains usable until it expires or is revoked. This path requires access to the configuration file or an exposed copy of it; the audited Skill does not itself transmit the key to an undeclared endpoint. ### Impact Assessment An attacker who obtains the key can consume the victim's Baidu API quota, incur service charges where applicable, access capabilities authorized to that API credential, and cause service disruption through quota ...[truncated 164 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer injecting `BAIDU_API_KEY` at runtime from an operating-system credential store, deployment secret manager, or OpenClaw-supported protected secret facility. 2. If configuration-file storage is unavoidable, explicitly require owner-only permissions: ```bash chmod 600 ~/.openclaw/openclaw.json ``` 3. Warn users not to commit, upload, print, or include the configuration file in logs, backups, or support bundles without redaction. 4. Use a dedicated, least-privileged API credential for this Skill and apply provider-side quota and usage restrictions where available. 5. Document procedures for immediate credential revocation and rotation after suspected exposure. 6. Avoid commands that display the complete configuration when validating it, because validation output may expose the key in terminals or captured logs. Use a validation method that does not print secret values. ]]>
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 (5)

Lp3

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding
The skill declares that it requires an environment variable and inherently performs outbound network access, but it does not explicitly declare a tool scope such as permissions or allowed-tools. This creates a trust and review gap: operators cannot easily constrain what the skill is allowed to access, and a networked skill handling API credentials is more dangerous when its execution boundaries are implicit rather than explicit.

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 guide instructs users to store a live API key in a local JSON config file but gives no warning about credential sensitivity, file permissions, secret rotation, or avoiding accidental disclosure through backups, screenshots, logs, or version control. While this is common operational guidance, it increases the risk of credential exposure if the config file is broadly readable or mishandled.

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
90% confidence
Finding
This code sends the user-provided query content in `requestBody` to Baidu's external search endpoint via `requests.post`. While the network call is central to the script's purpose, the file itself provides no clear user-facing disclosure that input data will be transmitted to a third-party service.

Static analysis

No suspicious patterns detected.