Back to skill

Security audit

TikTok官方-店铺商品

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent TikTok Shop product-management integration, but it needs Review because it can make live store changes and has weak safeguards around gateway trust, broad proxying, and sensitive output.

Install only if you intend to let the agent operate a real TikTok Shop ERP catalog. Verify product IDs, SKU IDs, prices, inventory quantities, listing platforms, and shop context before running mutating commands, and do not use untrusted gateway environment overrides. Treat command output as sensitive because it may contain shop cipher and business data.

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

Error
Location
scripts/_shop_product_common.py:15
Finding
Credential-Bearing Requests Can Be Redirected to an Untrusted or Plaintext Gateway<![CDATA[ ## Vulnerability Details **File Location**: `scripts/_shop_product_common.py`, lines 15–20 and 59–89 **Vulnerability Type**: Unrestricted security-sensitive endpoint configuration **Risk Level**: High ### Vulnerable Code ```python API_BASE_URL = ( os.environ.get("LINKFOX_TOOL_GATEWAY") or os.environ.get("TIKTOK_SHOP_API_BASE_URL") or "https://tool-gateway.linkfox.com" ).rstrip("/") DEVELOPER_PROXY_ENDPOINT = f"{API_BASE_URL}/tiktokShop/developerProxy" ``` ```python def get_api_key() -> str: key = os.environ.get("LINKFOX_AGENT_API_KEY") or os.environ.get("LINKFOXAGENT_API_KEY") if not key: print("API Key 未配置", file=sys.stderr) sys.exit(1) return key def call_api(endpoint: str, params: dict) -> dict: api_key = get_api_key() data = json.dumps(params).encode("utf-8") req = Request( endpoint, data=data, headers={ "Authorization": api_key, "Content-Type": "application/json", "User-Agent": "LinkFox-Skill/1.0", "SESSION_ID": os.environ.get("SESSION_ID", ""), "MODE_ID": os.environ.get("MODE_ID", ""), "APP_NAME": os.environ.get("APP_NAME", ""), }, method="POST", ) try: with urlopen(req, timeout=150) as response: return json.loads(response.read().decode("utf-8")) except HTTPError as e: body = e.read().decode("utf-8") if e.fp else "" return {"error": f"HTTP {e.code}: {e.reason}", "details": body} except URLError as e: return {"error": f"Connection failed: {e.reason}"} ``` ### Technical Analysis The Skill permits the developer-proxy destination to be replaced through either `LINKFOX_TOOL_GATEWAY` or `TIKTOK_SHOP_API_BASE_URL`. The selected URL is used without enforcing HTTPS, validating the hostname, or restricting the port and URL components. Every API request then transmits the following information to the selected destination: - The ...[truncated 2243 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require the gateway URL to use `https`. 2. Allowlist the documented production hostname, such as `tool-gateway.linkfox.com`. 3. Reject URLs containing user information, fragments, query strings, unexpected ports, or non-HTTPS schemes. 4. Prefer a fixed production endpoint rather than a general environment-controlled destination. 5. If custom gateways are required for development, require an explicit development-mode opt-in and prevent production credentials from being forwarded in that mode. 6. Validate the endpoint before retrieving the API key or constructing the request. 7. Use separate, narrowly scoped credentials for development and production environments. 8. Document the trust boundary for endpoint-related environment variables. Example validation approach: ```python from urllib.parse import urlparse ALLOWED_GATEWAY_HOSTS = {"tool-gateway.linkfox.com"} def validate_gateway_url(value: str) -> str: parsed = urlparse(value) if parsed.scheme != "https": raise ValueError("The LinkFox gateway must use HTTPS") if parsed.hostname not in ALLOWED_GATEWAY_HOSTS: raise ValueError("Untrusted LinkFox gateway host") if parsed.username or parsed.password or parsed.query or parsed.fragment: raise ValueError("Invalid gateway URL components") if parsed.port not in (None, 443): raise ValueError("Unexpected gateway port") return value.rstrip("/") ``` ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/_product_api_runner.py:224
Finding
Full Shop Cipher and Product Request Data Are Echoed to Standard Output<![CDATA[ ## Vulnerability Details **File Location**: `scripts/_product_api_runner.py`, lines 224–234 and 288–298 **Vulnerability Type**: Sensitive data exposure through command output and logs **Risk Level**: Medium ### Vulnerable Code ```python out: dict = { "api": api_name, "appType": "erp", "developerProxy": proxy, "resolvedPath": path, } if shop_cipher: out["shop_cipher"] = shop_cipher if query_string: out["queryString"] = query_string if body is not None: try: out["requestBody"] = json.loads(body) if body else None except json.JSONDecodeError: out["requestBody"] = body ``` ```python out = { "developerProxy": proxy, "resolvedPath": str(path).lstrip("/"), "appType": "erp", } if shop_cipher: out["shop_cipher"] = shop_cipher if query_string: out["queryString"] = query_string merge_upstream_body(out, proxy, "data") return out ``` The user-facing launchers serialize these returned objects directly: ```python print(json.dumps(run_product_proxy(params), indent=2, ensure_ascii=False)) ``` ### Technical Analysis Both the named API runner and the generic proxy runner place the complete shop cipher into their output. The cipher is exposed twice in many cases: directly through `out["shop_cipher"]` and indirectly through `out["queryString"]`. The named runner also reproduces the complete outbound request body as `requestBody`. Depending on the selected operation, that body can contain product descriptions, images, SKU identifiers, prices, inventory, external identifiers, certification records, manufacturer identifiers, and responsible-person identifiers. Because command-line launchers print the complete returned object, these values can enter: - Terminal scrollback - Shell or orchestration logs - CI/CD job output - Agent transcripts - Monitoring and debugging platforms - Stored command resul ...[truncated 1640 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `shop_cipher`, `queryString`, and `requestBody` from default command output. 2. Return only the resolved API name, path, status, and parsed business response needed by the caller. 3. If diagnostics are necessary, add an explicit debug option that is disabled by default. 4. Redact the shop cipher in debug output, preserving only a short prefix and suffix. 5. Recursively redact sensitive request fields, including identifiers and certification or responsible-person information. 6. Do not print raw query strings because they may contain current or future sensitive parameters. 7. Review `developerProxy` responses before printing and redact any credentials or security-sensitive metadata returned by the gateway. 8. Add automated tests confirming that stdout never includes the complete shop cipher or sensitive request values. A safer output pattern would be: ```python out = { "api": api_name, "appType": "erp", "resolvedPath": path, "developerProxy": sanitize_proxy_response(proxy), } ``` If debug output is explicitly requested, use masking rather than returning the original value: ```python def mask_secret(value: str) -> str: if len(value) <= 8: return "********" return f"{value[:4]}...{value[-4:]}" ``` ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (41)

Tainted flow: 'req' from os.environ.get (line 70, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Content
method="POST",
    )
    try:
        with urlopen(req, timeout=150) as response:
            return json.loads(response.read().decode("utf-8"))
    except HTTPError as e:
        body = e.read().decode("utf-8") if e.fp else ""
Confidence
92% confidence
Finding
The request destination is influenced by environment variables, allowing LINKFOX_TOOL_GATEWAY or TIKTOK_SHOP_API_BASE_URL to redirect authenticated traffic to an arbitrary host. Because the request includes the API key and session metadata headers, a poisoned environment or compromised runtime could exfiltrate credentials and sensitive business data to an attacker-controlled endpoint.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared description presents a business skill for TikTok Shop ERP product management via proxied Product Open API endpoints. However, the provided code chunk only checks whether a required dependency skill (linkfox-tiktok-shop-auth) is installed by scanning environment-derived directories for its SKILL.md file. This is merely a supporting dependency check and does not implement any of the declared product capabilities. Because the actual code's primary behavior is materially different from the declared purpose, this chunk is a mismatch.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Content
python scripts/create_product.py '{"openId":"...","requestBody":{...}}'
```

## Display Rules

1. 勿输出完整 `accessToken` / 完整 `shop_cipher` 以外的敏感信息时可掩码 token。
2. 展示 `check_results` 时逐条说明 `check_item` + `fail_reasons`。
Confidence
85% confidence
Finding
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Content
**- Brand selection rules**: You can only select the following types of brands during product creation/editing.
   * Authorized brands which contain the desired category (`authorized_status=AUTHORIZED` and `brand_status=AVAILABLE`)
   * Unauthorized non-T1 brands (`authorized_status=UNAUTHORIZED` and `is_t1_brand=false`)
      **- Brand display rules**: Note however that brands will only appear on the product display page if the brand is authorized (`authorized_status=AUTHORIZED`) and available in the desired category (`brand_status=AVAILABLE`). This means that you need to obtain brand authorization for unauthorized non-T1 brands before they can be displayed. Obtain brand authorization or add categories to an authorized brand through TikTok Shop Seller Center > Qualification Center > Brand qualification.
      **For Tokopedia sellers**: You can select and display any returned brand on Tokopedia regardless of these rules.
Confidence
85% confidence
Finding
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Description-Behavior Mismatch

High
Confidence
96% confidence
Finding
The generic run_product_proxy function accepts arbitrary path and method values and forwards them to developer_proxy_call with only minimal validation. This bypasses the allowlisted PRODUCT_ENDPOINTS model used elsewhere, enabling callers to reach undocumented or unintended ERP developerProxy endpoints, potentially including non-product operations or future-added sensitive APIs with the current user's openId context.

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill documentation describes use of Python scripts, shell execution, environment access, and network calls, but it does not declare any explicit tool scope or permissions boundaries. This creates an overbroad execution surface where an agent may invoke shell/network capabilities without clear least-privilege constraints, increasing the chance of unintended command execution or data exposure.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill advertises destructive product-management operations such as delete, restore, unlist, price change, and inventory updates without an explicit warning or confirmation requirement. In an agent setting, this raises the risk of accidental live-commerce changes that can disrupt listings, pricing, stock, or availability across a real shop.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The usage flow encourages operational scripts for search, create, activate, delete, recover, price, and inventory updates without a safety checkpoint before executing live mutations. In the context of an ERP product skill connected to real store APIs, missing confirmation and environment warnings can lead to unintended catalog deletion, listing status changes, or pricing/inventory corruption.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The documented API set includes destructive and business-critical actions such as deactivate, delete, recover, price update, and inventory update, but the reference does not instruct the agent to require explicit user confirmation or warn about irreversible or operational impact. In an agent context, this increases the risk of accidental mass changes, product delisting, stock corruption, or unintended deletions from ambiguous or misinterpreted user requests.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The skill's own wrapper/documentation content is written in Chinese while the embedded upstream API content is in English, and there is no indication that Chinese is optional or that the skill is intended only for a Chinese-speaking audience. This creates a language/locale policy concern because users are implicitly forced into a specific language without opt-in or documented justification.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The skill's core usage and mapping documentation is written in Chinese, which effectively imposes a language requirement on users of this file. Under the policy, language constraints should either offer user opt-in/choice or be clearly justified as region-specific; neither is present here.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The document says product content must align with the target market language and explicitly gives "don't use Chinese" as an example. This is a natural-language locale policy constraint presented as a hard rule, without offering user opt-in, language selection guidance, or clarifying that the restriction is purely an upstream platform requirement for a specific market context.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The text states that product content 'must align with the target market's language' and explicitly says not to use Chinese. This is a natural-language locale policy constraint presented as a mandatory rule, but the document does not frame it as a user choice or clearly justify it as an organizational policy exception beyond platform behavior.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
This documentation describes a destructive operational action—deactivating live products and hiding them from buyers—without an explicit warning, confirmation requirement, or guardrail guidance. In an ERP/product-management skill, that omission can lead an agent or user to perform bulk product takedowns that immediately affect storefront availability, sales, and merchant operations.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
This markdown file documents an API and script for deleting products, which is a destructive operation affecting user data/system state. While the purpose is clear from the title and method, the document does not include any explicit caution, confirmation requirement, or warning about irreversibility before showing how to invoke it.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
This is a real safety issue because the skill-specific section presents a full-edit endpoint while not prominently warning that omitted fields can overwrite existing product data and omitted SKU IDs can delete SKUs. In an agentic workflow, a model or user may reasonably treat an edit as partial, causing irreversible catalog corruption, delisting, inventory loss, or cross-market visibility changes when constructing minimal payloads.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The file documents an authorization-adjacent API inside a skill whose manifest explicitly says it is product-only and does not include authorization. Even though the API is read-only, it exposes the ability to enumerate a user's authorized shops and obtain shop ciphers, which broadens the skill's effective capability beyond its declared scope and can enable unintended cross-shop access flows in downstream product operations.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The skill-specific mapping section introduces a mutating product edit endpoint but does not prominently warn that partial updates can still be destructive when top-level nested objects or SKU arrays are supplied incompletely. Because the API semantics can delete omitted SKUs or blank omitted nested fields, an agent or user relying on the skill-local summary could unintentionally cause data loss or listing corruption.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The documentation states that `listing_platforms` controls product visibility and that omitting a platform can deactivate and hide the product there, but this appears deep in the API reference rather than as an upfront operational warning. In an agent skill, this creates a meaningful risk of unintended delisting across TikTok Shop or Tokopedia from a seemingly routine edit request.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The file states that text fields must align with the target market's language and gives a prescriptive example such as "don't use Chinese." This is a natural-language locale policy constraint presented without offering user opt-in or clarifying that the restriction is merely inherited from a region-specific upstream API requirement within the skill's own guidance.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
This markdown file documents an operation that restores deleted products and changes their status to `Seller_deactivated`, which affects merchant data/state. The description explains what the API does but does not include any caution, confirmation note, or user-facing warning about the impact of invoking it.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
This .md file describes an operation that updates prices for multiple SKUs in an active product, which can directly affect user data and business operations. The document explains how to perform the action but does not include any caution, confirmation expectation, or warning about irreversible marketplace-side changes.

Description-Behavior Mismatch

Medium
Confidence
93% confidence
Finding
The file introduces a product file-upload capability that is not clearly reflected in the skill's declared scope, which weakens transparency and policy enforcement around what the skill can cause a user or agent to send externally. Because this endpoint can transmit arbitrary local PDF/video files to TikTok Shop and return reusable hosted URLs/IDs, an agent may invoke it without the stronger scrutiny typically applied to exfiltration-capable features.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The documentation describes uploading local files to an external TikTok Shop endpoint but provides no warning that user-controlled local content will leave the environment. In an agent setting, this omission is dangerous because users may ask to 'attach' or 'upload' a file without understanding that sensitive certifications, reports, or videos will be transmitted to a third-party service and persisted there.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest explicitly states '**不含授权**(用 linkfox-tiktok-shop-auth)', indicating authorization is out of scope for this skill. However, this file exposes `get_authorized_shops` against `authorization/202309/shops`, which is an authorization-domain capability for retrieving authorized shops and `shop_cipher`, creating a semantic mismatch between declared scope and implemented API surface.

Static analysis

No suspicious patterns detected.