Back to skill

Security audit

Official Baidu Search

Security checks for vulnerabilities and agentic risk

Overview

Review before installing: this is a coherent Baidu search proxy, but one execution path can expose your Baidu API-backed search service to unauthenticated network callers.

Install only if you are comfortable operating a local Baidu API proxy. Run it bound to 127.0.0.1 or behind trusted authentication, protect the BAIDU_API_KEY and .env file, monitor quota/cost, and avoid sending sensitive searches unless you accept that they go to Baidu and may appear in local logs or error paths.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
src/baidu_search/main.py:45
Finding

Unauthenticated Public Search Endpoint Can Consume the Operator's Baidu API Credentials

Content
View full analysis
SearchResponse: """ 搜索网页 - **query**: 搜索关键词 - **top_k**: 返回结果数量 (1-20, 默认 10) - **recency_filter**: 时间过滤 (day, week, month, year) - **site_filter**: 限定搜索的网站列表 """ return search(request) if __name__ == "__main__": import uvicorn uvicorn.run("baidu_search.main:app", host="0.0.0.0", port=8001) ``` The endpoint ultimately retrieves and uses the operator's credential: ```python def search(request: SearchRequest) -> SearchResponse: """执行百度搜索""" api_key = _get_api_key() headers = { "Content-Type": "application/json", "Authorization": f"Bearer {api_key}" } ``` ### Technical Analysis The `/search` route has no authentication or authorization control. When the module is executed directly, Uvicorn listens on `0.0.0.0`, making the application reachable through every available network interface unless an external firewall prevents access. Every accepted request invokes `search()`, which reads the operator-controlled `BAIDU_API_KEY` and uses it to authenticate a request to the Baidu Qianfan service. Consequently, any network client that can reach the service can indirectly exercise the operator's upstream credential without possessing it. This behavior also conflicts with the local-only startup example in `SKILL.md`, which binds the documented service to `127.0.0.1`. The direct Python execution path silently provides a broader exposure boundary. The absence of request rate limiting, caller quotas, or practical maximum lengths for `query` and `site_filter` further increases the potential for resource and upstream quota abuse. ### Attack Path 1. The operator start ...[truncated 1272 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
src/baidu_search/main.py:26
Finding

Sensitive Request Data and Raw Upstream Errors Are Exposed Through Logging and HTTP Responses

Content
View full analysis
JSONResponse: logger.error( "Validation error on %s %s. body=%s errors=%s", request.method, request.url.path, exc.body, exc.errors(), ) return JSONResponse( status_code=422, content=jsonable_encoder({"detail": exc.errors()}), ) ``` The upstream error handler logs and returns the complete Baidu response body: ```python if response.status_code != 200: logger.error( "Baidu API error: status=%d, body=%s", response.status_code, response.text ) raise HTTPException( status_code=response.status_code, detail=f"Baidu API error: {response.text}" ) ``` ### Technical Analysis The validation exception handler records `exc.body`, which can contain the complete client request. Search queries can include personal, confidential, or operational information. A malformed request containing such information causes it to be retained in application logs. The upstream error handler has two related disclosure paths: 1. It writes the full upstream response body to application logs. 2. It embeds the same body in an `HTTPException`, returning provider-controlled diagnostic content to the calling client. Raw upstream errors may include echoed request content, provider diagnostics, internal identifiers, or implementation details that clients do not need. Because the `/search` route is unauthenticated, any reachable client may deliberately trigger errors and inspect the refl ...[truncated 1754 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (14)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 37)May include surrounding context.

bash
cd {baseDir}
echo "BAIDU_API_KEY=your-api-key" > .env
uv venv && uv pip install -e ".[dev]"
uv run --env-file .env uvicorn baidu_search.main:app --host 127.0.0.1 --port 8001

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 39)May include surrounding context.

bash
cd {baseDir}
echo "BAIDU_API_KEY=your-api-key" > .env
uv venv && uv pip install -e ".[dev]"
uv run --env-file .env uvicorn baidu_search.main:app --host 127.0.0.1 --port 8001

Possible Typosquatting: 'uvicorn' resembles popular package 'gunicorn'

High
Category
Supply Chain
Confidence
70% confidence
Finding

Package name closely resembles a popular package, suggesting possible typosquatting. Attackers publish malicious packages with similar names to trick developers into installing them.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises network access and use of an environment-provided API key, but it does not declare any explicit tool scope or permission boundary. That makes the skill harder to review and govern, and can allow broader-than-expected access in agent environments where permission metadata is used for enforcement or user consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The markdown states the skill searches the Chinese internet specifically, and the surrounding examples and naming are entirely Chinese/Baidu-specific. Under the stated policy, forcing a specific language/locale without user opt-in can be a natural-language policy violation unless clearly justified as region-specific; this file does not explicitly provide that justification or opt-in language.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% 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 · SKILL.md (reported line 51)May include surrounding context.

Quick Start

  1. 检查服务: curl http://127.0.0.1:8001/ping

  2. 搜索网页:

bash

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

Multiple docstrings and comments are written exclusively in Chinese, indicating the skill is localized to a specific language without offering any user choice or documenting a justified region-specific constraint. This matches the policy category for language or locale restrictions without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest description is written only in Chinese ("百度 AI 搜索 API 代理服务"), which may impose a language-specific experience without indicating any user choice or locale-specific justification. Under the policy, language constraints should either be optional or clearly documented as region-specific.

Content

No source excerpt is available for this finding.

Unverifiable Dependency: fastapi has 3 known advisory(ies) (CVE-2021-32677 (Cross-Site Request Forgery (CSRF) in FastAPI); CVE-2021-32677 (FastAPI is a web framework for building APIs with Python 3.6+ based on standard ); CVE-2024-24762 (FastAPI is a web framework for building APIs with Python 3.8+ based on standard )), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Unverifiable Dependency: httpx has 2 known advisory(ies) (CVE-2021-41945 (Improper Input Validation in httpx); CVE-2021-41945 (Encode OSS httpx <=1.0.0.beta0 is affected by improper input validation in `http)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Unverifiable Dependency: uvicorn has 4 known advisory(ies) (CVE-2020-7694 (Log injection in uvicorn); CVE-2020-7695 (HTTP response splitting in uvicorn); CVE-2020-7694 (This affects all versions of package uvicorn. The request logger provided by the) +1 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Unverifiable Dependency: pytest has 2 known advisory(ies) (CVE-2025-71176 (pytest has vulnerable tmpdir handling); CVE-2025-71176 (pytest has vulnerable tmpdir handling)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The only natural-language description in this file is the Chinese string "百度搜索 API 代理服务", which presents the skill in a specific language without any indication that users can opt into another language or locale. Under the policy, forcing a language without user choice can be a natural-language policy violation unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The API title and description are presented only in Chinese, and the endpoint documentation is also Chinese-only. This creates a language/locale constraint in the skill's natural-language interface without offering a user choice or documenting a justified region-specific requirement.

Content

No source excerpt is available for this finding.