Back to skill

Security audit

B2B全网商品寻源助手

Security checks for vulnerabilities and agentic risk

Overview

This B2B product-search skill is mostly coherent and read-only, but its script can silently redirect procurement searches to an arbitrary API host through an undocumented environment variable.

Review this before installing in environments where procurement intent, budgets, preferred locations, or supplier searches are sensitive. The normal external lookup is expected, but the endpoint override should be removed or allowlisted before use in a managed or high-trust environment.

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.sh:17
Finding
Unvalidated API Endpoint Override Enables Query Exfiltration and Response Spoofing## Vulnerability Details **File Location**: `scripts/search.sh`, lines 17 and 65–68 **Vulnerability Type**: Unvalidated environment-controlled API endpoint **Risk Level**: Medium ### Vulnerable Code ```bash BASE_URL="${B2B_SKILL_BASE_URL:-https://gwgp-zmtc8kkxxzw.i.bdcloudapi.com}" APP_SOURCE="${B2B_SKILL_SOURCE:-workbuddy}" TIMEOUT="${B2B_SKILL_TIMEOUT:-60}" ``` ```bash RESP="$(curl -sS --max-time "$TIMEOUT" -X POST "$BASE_URL/skill_api/product_search" \ -H "Content-Type: application/json" \ -H "X-App-Source: $APP_SOURCE" \ -d "$BODY" 2>&1)" || { ``` ### Technical Analysis The `B2B_SKILL_BASE_URL` environment variable fully controls the destination to which the script sends product-search requests. The script does not validate the URL scheme, hostname, port, or destination against an allowlist. This override is not documented as an approved interface in `references/product_search_bridge.md`, which identifies one specific HTTPS endpoint. It also conflicts with `_common.md`, which instructs the Skill to use only explicitly documented interfaces. An attacker who can influence the script's environment can therefore redirect requests to an arbitrary HTTP or HTTPS service. Request bodies can contain commercially sensitive procurement data, including product requirements, specifications, budget limits, categories, and preferred locations. The script also trusts the remote response. A malicious endpoint can return a successful JSON object containing fabricated Markdown in `data.content`. Because `SKILL.md` directs the Agent to reproduce this content and its links without modification, the override can also facilitate product-result spoofing and malicious-link delivery. This issue does not independently provide local command execution. Exploitation requires control over, or influence upon, the process environment. ### Attack Path 1. The attacker gains the ability to set environment variables for the process invoking the Skill, such as through a c ...[truncated 1448 chars]
Remediation
## Remediation Suggestions 1. **Remove the endpoint override if runtime endpoint customization is unnecessary.** ```bash readonly BASE_URL="https://gwgp-zmtc8kkxxzw.i.bdcloudapi.com" ``` 2. **If customization is required, enforce an explicit allowlist.** Parse and verify that the effective endpoint: - Uses HTTPS. - Has exactly the approved hostname. - Uses an approved port. - Contains no embedded username or password. - Does not resolve to loopback, link-local, private, or metadata-service addresses unless explicitly required. 3. **Prevent redirect-based bypasses.** Do not enable automatic redirects. If redirects are later enabled, validate every redirect destination against the same allowlist. 4. **Validate returned links before displaying them.** Permit only approved HTTPS marketplace domains and reject unexpected URL schemes such as `javascript:`, `data:`, or `file:`. 5. **Treat remote Markdown as untrusted data.** Prefer constructing output locally from validated JSON fields rather than directly reproducing server-rendered `data.content`. 6. **Document all supported configuration variables.** Ensure the implementation and `_common.md` agree about which external interfaces are authorized. 7. **Add security regression tests** confirming that unapproved hosts, plaintext HTTP endpoints, embedded credentials, unexpected ports, malformed URLs, and malicious response links are rejected.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (7)

Lp3

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding
The skill instructs the agent to execute a local shell script (`bash scripts/search.sh ...`) and even provides a manual curl fallback, but it declares no explicit tool scope or allowed-tools boundary. That creates an authorization gap where shell access may be broader than intended, increasing the chance of command execution outside the narrow product-search use case if the skill is invoked or adapted unsafely.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The listed trigger phrases include generic expressions such as '这个多少钱', '哪家便宜', and '有没有卖…的', which overlap with common shopping conversation and are not narrowly scoped to this skill. The file does not provide exclusion conditions or negative examples to clarify when these phrases should not activate the skill.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
Line L33 instructs the skill to tell users a specific Chinese sentence when a 401 occurs. This is a natural-language locale constraint with no indication that the user can choose another language, which can violate organizational language-choice policies.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The file presents the interface contract entirely in Chinese and frames user-facing response content in fixed Chinese phrasing, such as the prescribed `data.content` messages. There is no indication that the skill offers a user language choice or that the Chinese-only constraint is a documented, region-specific requirement, which can violate language/locale policy expectations.

External Transmission

Medium
Category
Data Exfiltration
Content
## 联调示例

```bash
curl -s -X POST "https://gwgp-zmtc8kkxxzw.i.bdcloudapi.com/skill_api/product_search" \
  -H "Content-Type: application/json" \
  -H "X-App-Source: workbuddy" \
  -d '{"query":"工业冷水机 注塑冷却","price_max":10000,"location":"河北","output_format":"markdown","page_size":10}'
Confidence
79% confidence
Finding
The file documents a direct POST request to an external cloud endpoint and explicitly states that no credential is currently required. This creates an external data transmission path for user procurement queries and preferences, and if the skill sends sensitive business purchasing intent, supplier interest, quantities, budgets, or locations without clear minimization/consent controls, that information is exposed to a third-party service outside the local trust boundary.

External Transmission

Medium
Category
Data Exfiltration
Content
[ -n "$PAGE_SIZE" ] && BODY="$BODY,\"page_size\":$PAGE_SIZE"
BODY="$BODY}"

RESP="$(curl -sS --max-time "$TIMEOUT" -X POST "$BASE_URL/skill_api/product_search" \
    -H "Content-Type: application/json" \
    -H "X-App-Source: $APP_SOURCE" \
    -d "$BODY" 2>&1)" || {
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Natural-Language Policy Violations

Low
Confidence
80% confidence
Finding
All natural-language descriptions, trigger examples, and response guidance in the file are presented exclusively in Chinese, and the skill does not state that users may choose another language. This can amount to a language-policy issue when the skill implicitly forces one language without documented justification or opt-in.

Static analysis

No suspicious patterns detected.