Back to skill

Security audit

Baidu Search

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Baidu web-search skill, with the main caution that search requests are sent to Baidu and the script also prints the parsed request to stdout.

Install only if you are comfortable sending search queries to Baidu's API. Do not submit secrets, private internal URLs, credentials, or confidential research terms, because the query is transmitted externally and may also appear in local agent or execution logs due to request logging.

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:38
Finding
Sensitive Search Query Disclosed Through Standard Output Logging## Vulnerability Details **File Location**: `scripts/search.py`, line 38 **Vulnerability Type**: Plaintext disclosure of potentially sensitive user input **Risk Level**: Medium **Complete Code Snippet**: ```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 request, the script writes the complete request object to standard output. This includes the `query` value and any additional supplied fields. Search queries can contain confidential names, internal URLs, proprietary terms, incident details, credentials pasted by mistake, or other sensitive information. Standard output is commonly captured by agent transcripts, CI/CD systems, process supervisors, centralized logging services, and automation platforms. Consequently, data intended only for the Baidu search request may be retained or exposed to additional parties. This logging is unnecessary for the declared search functionality and exceeds the minimum data handling needed to perform a search. The issue is limited to disclosure of data supplied in the request; the code does not print the `BAIDU_API_KEY`. ### Attack Path 1. An attacker persuades a user or agent to include confidential information in a search query. 2. The caller invokes `search.py` with that query in the JSON argument. 3. The script parses the request and prints the complete `parse_data` object. 4. The execution environment captures standard output in a transcript or log. 5. An attacker or unauthorized operator with access to those logs retrieves the sensitive query. Exploitation requires the victim to submit sensitive content and the attacker to have, or later gain, access to captured output. ### Impact Assessment The vulnerability can disclose the complete search request to parties with access to execution logs or ag ...[truncated 438 chars]
Remediation
## Remediation Suggestions Remove the statement that prints the parsed request: ```python parse_data = json.loads(query) ``` If diagnostic logging is required: 1. Enable it only through an explicit debug option that is disabled by default. 2. Log a fixed message such as `Request parsed successfully` rather than the request contents. 3. Redact or omit the `query` field and any future fields that may contain secrets or personal data. 4. Ensure production environments do not retain sensitive debugging output. 5. Document that search queries are transmitted to the declared Baidu API so users can avoid submitting inappropriate confidential data. 6. Add tests verifying that neither normal nor error output contains the query or `BAIDU_API_KEY`.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill declares use of environment variables and implicitly performs network access, but it does not declare an explicit tool/permission scope such as allowed-tools or permissions. This weakens least-privilege controls and makes it harder for a host agent or reviewer to understand and constrain what the skill can access, increasing the risk of unintended secret exposure or unrestricted outbound requests.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The examples use only Chinese queries such as "人工智能", "最新新闻", and "旅游景点", and the skill is branded specifically around Baidu, but the documentation does not state that the skill is China/Chinese-specific or offer users a language/locale choice. This can be read as imposing a language/locale expectation without opt-in, which matches the policy category for natural-language locale violations.

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
97% confidence
Finding
The code performs an outbound HTTP POST to a third-party service with a JSON body built from user input, creating a direct external transmission channel. While expected for a search skill, it is still security-relevant because any sensitive content in the query is disclosed to the external provider and may be logged or retained outside local control.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script sends the user-provided search query and optional filters to Baidu's external web search API, which is a real data egress path. In a skill context, queries may contain sensitive user data, internal prompts, or proprietary research terms, and this file provides no consent, warning, minimization, or redaction before transmission.

Static analysis

No suspicious patterns detected.