Back to skill

Security audit

112131131313131

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward Baidu web search skill, with some privacy and credential-handling cautions but no evidence of hidden, destructive, or deceptive behavior.

Install only if you are comfortable sending search queries to Baidu's AI Search service. Avoid searching for secrets, internal URLs, customer data, or regulated personal data, and protect the BAIDU_API_KEY in your OpenClaw configuration with appropriate local file permissions and rotation if 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 (2)

T09 · Insecure Skill Coding Practices

Note
Location
scripts/search.py:38
Finding

Sensitive Search Query Exposed Through Standard Output Logging

Content
View full analysis

Vulnerability Details

File Location: scripts/search.py, lines 38–44
Vulnerability Type: Sensitive data exposure through application logging
Risk Level: Low

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

The script writes the complete parsed request object to standard output. This object includes the user-supplied search query and may include other request parameters.

Search queries can contain personal information, confidential project names, internal infrastructure details, credentials entered accidentally, or other sensitive material. Standard output may be retained by OpenClaw, gateway services, container runtimes, CI systems, terminal history capture, or centralized logging infrastructure.

Logging the full request is not required for the declared web-search functionality and therefore creates an avoidable secondary disclosure channel. The API key is not included in this log statement.

Attack Path

  1. A user or agent invokes the Skill with a query containing sensitive information.
  2. The script parses the request JSON.
  3. The complete parsed request, including the query, is printed to standard output.
  4. The execution environment captures or persists standard output.
  5. A user or service with access to those logs can recover the sensitive query.

This issue does not directly grant system privileges or code execution. Exploitation requires access to the relevant execution logs or output stream.

Impact Assessment

The primary impact is loss of confidentiality for search queries. Exposure is limited to information supplied in the request object and does not, based on the reviewed code, include the BAIDU_API_KEY.

The practical scope depends on the surrounding logging ...[truncated 161 chars]

Remediation
View remediation

Remediation Suggestions

Remove the full-request logging statement:

python
parse_data = json.loads(query)

If diagnostic logging is necessary:

  • Require an explicit debug option that is disabled by default.
  • Log only non-sensitive metadata, such as whether parsing succeeded.
  • Do not log query text, authorization headers, API keys, or complete request bodies.
  • Apply structured redaction before logging any user-controlled object.
  • Configure production logs with appropriate access controls and retention limits.

A safer implementation is:

python
try:
    parse_data = json.loads(query)
except json.JSONDecodeError as e:
    print(f"JSON parse error: {e}")
    sys.exit(1)

T09 · Insecure Skill Coding Practices

Note
Location
scripts/search.py:9
Finding

Outbound HTTP Request Lacks a Bounded Timeout

Content
View full analysis

Vulnerability Details

File Location: scripts/search.py, lines 9–19
Vulnerability Type: Unbounded external network operation
Risk Level: Low

Vulnerable Code

python
def baidu_search(api_key, requestBody: dict):
    url = "https://qianfan.baidubce.com/v2/ai_search/web_search"

    headers = {
        "Authorization": "Bearer %s" % api_key,
        "X-Appbuilder-From": "openclaw",
        "Content-Type": "application/json"
    }

    # 使用POST方法发送JSON数据
    response = requests.post(url, json=requestBody, headers=headers)

Technical Analysis

The requests.post call does not specify a connection or read timeout. Python Requests does not impose a timeout by default, so the operation may wait indefinitely if the remote endpoint accepts a connection but does not complete the response, or if network conditions prevent progress.

The outbound request itself is necessary for the declared Skill functionality. It sends the API key as a bearer token and the search query in the request body to the fixed HTTPS Baidu AI Search endpoint. No evidence was found that these values are sent to an unrelated destination. The weakness is the absence of resource bounds around that necessary network operation.

Attack Path

  1. The Skill invokes the fixed Baidu AI Search endpoint.
  2. The endpoint, an intermediary, or the network path delays or stalls the connection or response.
  3. Because no timeout is configured, the HTTP operation remains blocked.
  4. The Skill invocation does not complete and continues occupying its worker or execution slot.
  5. Repeated stalled invocations may consume multiple workers and reduce service availability.

The fixed HTTPS destination prevents ordinary query input from selecting an attacker-controlled URL. Exploitation therefore depends on control or disruption of the endpoint, DNS or network path, or on an upstream service failure.

Impact Assessment

The issue affe ...[truncated 407 chars]

Remediation
View remediation

Remediation Suggestions

Configure explicit connection and read timeouts and handle timeout failures separately:

python
try:
    response = requests.post(
        url,
        json=requestBody,
        headers=headers,
        timeout=(5, 30),
    )
    response.raise_for_status()
except requests.Timeout:
    raise RuntimeError("Baidu AI Search request timed out")
except requests.RequestException as exc:
    raise RuntimeError(f"Baidu AI Search request failed: {exc}")

Additional hardening should include:

  • Keep both connection and read timeouts finite.
  • If retries are added, use a strict retry limit and exponential backoff.
  • Avoid retrying indefinitely.
  • Apply an overall execution deadline at the Skill or worker level.
  • Continue using the fixed HTTPS endpoint and do not permit user input to override the destination.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The usage examples exclusively use Chinese query strings such as "人工智能", "最新新闻", and "旅游景点", which signals a default language/locale expectation. Because the skill does not explicitly state that it is China/Chinese-specific or offer user choice of query language, this can be read as a language-policy constraint without opt-in.

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 · references/apikey-fetch.md (reported line 11)May include surrounding context.

md
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

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documentation explicitly tells users to place a live API key in a plaintext JSON configuration file under their home directory, but provides no warning about credential sensitivity, file permissions, or safer secret-handling options. This increases the chance of credential exposure through local compromise, backups, screenshots, shell history-adjacent workflows, or accidental sharing of the config file.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% 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 · scripts/search.py (reported line 19)May include surrounding context.

python
}

    # 使用POST方法发送JSON数据
    response = requests.post(url, json=requestBody, headers=headers)
    response.raise_for_status()
    results = response.json()
    if "code" in results:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script transmits the user's search query to an external third-party service, which can expose sensitive or proprietary user input to that provider. In a search skill this is expected behavior, but the lack of any disclosure, consent boundary, or data-minimization makes it a real privacy and data-handling risk if users submit secrets, internal URLs, or regulated data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code logs the full parsed request body, which includes the raw user query and possibly other user-supplied fields. If logs are retained, aggregated, or accessible to operators, this can leak sensitive search terms and create an avoidable secondary exposure channel beyond the external API transmission itself.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The manifest frames this skill as a web search tool for live information and research, but the code also implements credential retrieval from process environment variables. While common operationally, accessing environment-stored secrets is a separate capability not described in the stated purpose and is not inherent to the user-facing search behavior.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.