Back to skill

Security audit

Baidu Ecommerce Search

Security checks for vulnerabilities and agentic risk

Overview

This ecommerce skill is mostly coherent, but it can create orders and store addresses while sending the user’s API token in URL query strings.

Review before installing. Use only a tightly scoped Baidu ecommerce token if available, avoid running order or address commands without explicit user approval, and be aware that address details and the API token may appear in terminal output, shell history, or infrastructure URL logs.

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/common.py:48
Finding
API Token Exposed in URL Query Strings## Vulnerability Details **File Location**: `scripts/common.py:48-56` **Vulnerability Type**: Sensitive credential exposure through URL query parameters **Risk Level**: Medium ### Vulnerable Code ```python params["key"] = get_token() params["_t"] = int(time.time() * 1000) url = f"{BASE_URL}/{endpoint}?" + urllib.parse.urlencode(params) try: req = urllib.request.Request(url) req.add_header("User-Agent", "BaiduEcommerceSkill/1.0") with urllib.request.urlopen(req, timeout=timeout) as response: ``` ### Technical Analysis The shared API client inserts `BAIDU_EC_SEARCH_TOKEN` into the `key` query parameter of every request. Although HTTPS encrypts the URL while it is in transit, URLs may be retained in reverse-proxy access logs, application telemetry, monitoring platforms, debugging output, browser or gateway history, and infrastructure error reports. This request function is shared by all operations, including access to address and order information and state-changing operations such as `address_add` and `order_create`. Those state-changing calls are also sent using GET because no request body or explicit HTTP method is configured. Exploitation requires access to a component or record containing the complete request URL. There is no evidence that this project itself logs the URL; the risk arises from common URL handling by surrounding infrastructure. ### Attack Path 1. A user configures a valid `BAIDU_EC_SEARCH_TOKEN`. 2. The user invokes any Skill operation. 3. `request_api()` appends the token to the request URL as `key`. 4. A reverse proxy, gateway, telemetry service, diagnostic tool, or another authorized observer records the complete URL. 5. An attacker obtains access to that record and extracts the token. 6. The attacker replays the token against the Baidu ecommerce API. 7. Subject to the token's server-side permissions, the attacker accesses ecommerce data or invokes transaction-related op ...[truncated 745 chars]
Remediation
## Remediation Suggestions 1. Transmit the token in an HTTP header, preferably `Authorization: Bearer <token>`, rather than in the URL. 2. If the server uses a custom authentication scheme, place the credential in a dedicated non-URL header and document that scheme. 3. Use POST or another semantically appropriate method with a request body for state-changing operations such as address creation and order creation. 4. Configure clients, gateways, proxies, monitoring systems, and exception handlers to redact authorization headers and sensitive parameters. 5. Never print or include the token in errors, telemetry, or diagnostic output. 6. Rotate credentials that may already have appeared in URL logs and apply short expiration periods where supported. 7. Restrict each token to the minimum required API capabilities and implement server-side authorization for every operation. 8. Add automated tests that verify generated URLs do not contain credentials and that state-changing endpoints do not use GET.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (26)

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding
The description presents a broad ecommerce assistant focused on product knowledge and transaction execution, with examples including search, order placement, and after-sales. The actual code chunk is narrowly focused on address management: retrieving address lists, recognizing address text, and adding an address. Address handling could be tangentially related to ecommerce checkout, but it is a distinct capability not explicitly declared in the description. Because the implemented behavior is materially different from the described capabilities in this chunk, this should be flagged as a mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The code chunk is narrowly focused on 商品百科知识 (product knowledge encyclopedia). It defines three API-backed functions: brand_info, entity_info, and param_info, corresponding to brand knowledge, category selection guidance, and product parameter lookup. The CLI only supports the subcommands brand, entity, and param. There is no evidence in this chunk of ecommerce transaction execution such as product search, placing orders, or after-sales handling, nor of product comparison or ranking retrieval. Because the declared description presents a substantially broader ecommerce service than the actual implemented behavior in this code chunk, this is a description-behavior mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
This code chunk’s primary purpose is infrastructure support for synchronization and request throttling, not ecommerce functionality. While such a utility could support an ecommerce skill internally, the declared description presents end-user capabilities like product comparison, brand/category knowledge, search, order placement, and after-sales. None of those behaviors appear in this code. The code accesses local filesystem resources and an environment variable, which are not reflected in the declared purpose. Per the criteria, this is a mismatch because the actual behavior is materially different from the declared primary purpose, even if it may be a supporting component of a larger system.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding
The supplied code is focused specifically on order management. It validates inputs and calls APIs for order creation, order history, and order detail. The declared description presents a much broader ecommerce assistant including product knowledge, comparisons, rankings, search, order placement, and after-sales. While order placement is consistent with part of the description, most of the declared capabilities are absent from this code chunk. Therefore the description does not accurately represent what this code actually does, because the code's primary purpose is materially narrower than the declared one.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The README documents commands that can create real orders and modify account data, but it does not warn users that these operations may trigger live transactions or persistent changes. In an agent or automation context, a user or downstream system could invoke these examples as if they were harmless demos, leading to unintended purchases, order creation, or account-state changes.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The README includes an address recognition example containing a full name, street address, and phone number, which normalizes exposing sensitive personal data in command-line usage without any privacy warning. Users may copy this pattern with real PII into logs, shell history, terminal recordings, or agent traces, increasing the risk of inadvertent disclosure.

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill declares access to an environment token and implicitly relies on networked scripts, but does not define any explicit tool scope such as allowed tools or permissions boundaries. This weakens least-privilege controls and makes it harder for a host agent or reviewer to constrain what the skill may execute or access if the surrounding runtime is permissive.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The workflow handles personal data such as recipient name, address, and phone number, and also creates purchase transactions, but the skill text does not require an explicit privacy/consent warning before collecting or submitting that data. In a transactional context, this can lead to users disclosing sensitive information or authorizing purchases without clear notice of what will be processed and sent to an external service.

Missing User Warnings

Medium
Confidence
80% confidence
Finding
The docstring states that the command returns address IDs, recipient names, phone numbers, and detailed addresses, and the main flow prints the JSON result directly. There is descriptive documentation of functionality, but no explicit warning to the user that invoking this command will display sensitive personal data on stdout.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The recognise operation submits raw address text to request_api, and the example input includes a person's name, street address, and phone number. Although the docstring describes the function, there is no explicit warning, confirmation, or visible user disclosure that sensitive personal data will be transmitted to a remote API.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
This code uses Chinese-only natural-language documentation and user-visible error strings, such as the module docstring and the environment-variable error message, without offering an alternative language or documenting that the skill is intended only for Chinese-speaking users. That creates a language/locale policy concern because the skill effectively forces a specific language without user opt-in.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file's natural-language content, including the title, docstrings, usage text, and example query format, is entirely in Chinese and implies Chinese-language interaction by default. This can violate language/locale policy when no user opt-in or documented locale limitation is provided.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
All natural-language strings, docstrings, and usage guidance in this file are presented only in Chinese, and the skill does not offer any language/locale choice. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale restriction is explicitly justified.

Unbounded Resource Access

Medium
Category
Excessive Agency
Content
return LOCK_FILE


def _acquire_lock(timeout=None):
    """
    获取文件锁
Confidence
75% confidence
Finding
Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Unbounded Resource Access

Medium
Category
Excessive Agency
Content
return LOCK_FILE


def _acquire_lock(timeout=None):
    """
    获取文件锁
Confidence
75% confidence
Finding
Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Unbounded Resource Access

Medium
Category
Excessive Agency
Content
return LOCK_FILE


def _acquire_lock(timeout=None):
    """
    获取文件锁
Confidence
75% confidence
Finding
Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
The `order_create` function directly invokes a purchase-related API action once called, with only parameter presence checks and no in-file confirmation, review step, or friction before creating an order. In an agent/skill context, this increases the risk of unintended purchases if another component misinterprets user intent, passes attacker-influenced parameters, or triggers the action without an explicit final user confirmation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The module description, docstrings, examples, and user-facing error messages are all written exclusively in Chinese, including the required query formats such as "xxx品牌榜". This imposes a language/locale constraint on users without any opt-in or explanation that the skill is intended only for a Chinese-language or region-specific context.

Natural-Language Policy Violations

Low
Confidence
80% confidence
Finding
The skill description and examples are presented entirely in Chinese and the interaction guidance assumes Chinese-language operation. There is no indication that users may choose another language or that the Chinese-only behavior is a documented, justified locale restriction.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
The module docstring and function documentation are written only in Chinese, which can impose a language requirement on users without opt-in. The policy allows fixed-language behavior when a locale constraint is explicitly documented and justified, but that is not stated here.

Missing User Warnings

Low
Confidence
84% confidence
Finding
The script sends the user-provided query to an external API via `request_api`, but there is no confirmation prompt, visible notice, or warning in the code that user input will be transmitted. For a code file, outbound transmission of user data should have some form of disclosure unless it is clearly communicated elsewhere.

Missing User Warnings

Low
Confidence
77% confidence
Finding
This code sends user-provided query data to an external API via request_api in brand_info, entity_info, and param_info. While the API behavior is central to the script's purpose, the file itself does not include any user-facing notice, logging, or comment disclosing that query text is transmitted off-process/off-host.

Natural-Language Policy Violations

Low
Confidence
94% confidence
Finding
The top-level docstring presents the skill's purpose exclusively in Chinese and does not offer any language choice or explain why a Chinese-only description is required. The policy explicitly calls for flagging language or locale constraints when they are imposed without user opt-in or clear justification.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
User-facing descriptions, help text, and error messages in this file are all written in Chinese, and the skill does not indicate that language selection is optional or region-specific. This can violate language/locale policy when a skill forces a specific language without user opt-in.

Missing User Warnings

Low
Confidence
84% confidence
Finding
This Python file sends the user-provided search keyword to an external API via `request_api("spu_list", {"query": keyword})`. While the docstring explains the feature, there is no explicit user-facing warning, logging, or comment disclosing that input data is transmitted over the network.

Static analysis

No suspicious patterns detected.