Back to skill

Security audit

TikTok Shop-商品详情

Security checks for vulnerabilities and agentic risk

Overview

The skill performs the advertised TikTok Shop lookup, but it also handles account credentials, billing flows, persistent response storage, and automatic feedback reporting with several under-scoped safety controls.

Install only if you are comfortable giving this skill a LinkFox API key, letting it contact LinkFox services, storing full product responses locally, and using its account/billing helper. Avoid setting custom LinkFox endpoint environment variables unless you fully trust the destination, treat generated API keys as secrets, and review any payment or feedback submission before allowing it.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/tiktok_shop_product_detail.py:36
Finding

Credential Exfiltration Through Unvalidated Endpoint Overrides

Content
View full analysis
str: """Gateway base address: LINKFOX_TOOL_GATEWAY takes precedence.""" return (os.environ.get("LINKFOX_TOOL_GATEWAY") or "https://tool-gateway.linkfox.com").rstrip("/") def get_api_url(): sys.path.insert( 0, os.path.join( os.path.dirname(os.path.abspath(__file__)), "..", "..", "_shared", ), ) return get_api_base() + API_PATH def call_api(params): api_url = get_api_url() api_key = get_api_key() data = json.dumps(params).encode("utf-8") headers = { "Authorization": api_key, "Content-Type": "application/json", "User-Agent": "LinkFox-Skill/2.0", "SESSION_ID": os.environ.get("SESSION_ID", ""), "MODE_ID": os.environ.get("MODE_ID", ""), "APP_NAME": os.environ.get("APP_NAME", ""), } req = Request( api_url, data=data, headers=headers, method="POST", ) try: with urlopen(req, timeout=150) as response: return json.loads(response.read().decode("utf-8")) ``` The onboarding implementation similarly permits all authentication-related origins to be replaced: ```python def _agent_base() -> str: return _env_base( "LINKFOX_AGENT_API_URL", "https://tool-gateway.linkfox.com", "LINKFOX_TOOL_GATEWAY", ) def _login_base() -> str: return _env_base("LINKFOX_LOGIN_API_URL", "https://api.linkfox.com") def _agent_user_base() -> str: return _env_base( "LINKFOX_AGENT_USER_API_URL", "https://agent-api.linkfox.com", ) ``` Those configurable destinations receive sensitive requests: ```p ...[truncated 3774 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/onboarding.py:484
Finding

Generated API Keys Are Exposed Through Standard Output and Plaintext Shell Configuration

Content
View full analysis
int: r = login_and_get_key( args.phone.strip(), args.code.strip(), args.channel, ) _emit(r) if "api_key" in r: print( f"{TAG} Successfully obtained API key " f"(source: {r['source']})", file=sys.stderr, ) return 0 return 1 ``` The onboarding instructions recommend placing the secret directly in shell commands and plaintext startup files: ```bash setx LINKFOX_AGENT_API_KEY "" echo 'export LINKFOX_AGENT_API_KEY=""' >> ~/.zshrc && source ~/.zshrc echo 'export LINKFOX_AGENT_API_KEY=""' >> ~/.bashrc && source ~/.bashrc ``` ### Technical Analysis The complete API key is emitted as structured JSON to stdout. In an Agent environment, stdout may be copied into model context, conversation transcripts, execution logs, terminal capture, or observability systems. The documented setup commands further expose the key in chat content, shell history, process command-line records, and plaintext shell startup files. Although the user needs a way to configure the generated ke ...[truncated 1156 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/tiktok_shop_product_detail.py:247
Finding

Unsanitized Session Identifier Allows Output-Path Traversal

Content
View full analysis
str: """Prefer env SESSION_ID; otherwise generate HHMMSS-<6 hex>.""" env = os.environ.get("SESSION_ID") if env: return env.strip() if "_auto" not in _SESSION_CACHE: _SESSION_CACHE["_auto"] = ( time.strftime("%H%M%S", time.localtime(ts)) + "-" + secrets.token_hex(3) ) return _SESSION_CACHE["_auto"] def _ensure_session(ts: float) -> tuple[str, str]: """Return (linkfox_root, session_dir); session_dir exists.""" date_str = time.strftime("%Y-%m-%d", time.localtime(ts)) sid = _session_id(ts) root = _linkfox_root() session_dir = os.path.join(root, date_str, sid) os.makedirs(session_dir, exist_ok=True) _ensure_meta(root, session_dir, date_str, sid, ts) return root, session_dir ``` The onboarding script has the same issue: ```python def session_dir() -> str: ts = time.time() sid = (os.environ.get("SESSION_ID") or "").strip() or ( time.strftime("%H%M%S", time.localtime(ts)) + "-" + secrets.token_hex(3) ) path = os.path.join( _linkfox_root(), time.strftime("%Y-%m-%d", time.localtime(ts)), sid, ) os.makedirs(path, exist_ok=True) return path ``` ### Technical Analysis `SESSION_ID` is treated as a filesystem path component but is not restricted to a safe identifier format. It may contain `..` components, path separators, or an absolute path. In Python, if the final argument to `os.path.join` is absolute, the earlier root components are discarded. Relative traversal components can likewise escape the intended session roo ...[truncated 1146 chars]
Remediation
View remediation

other

Warning
Location
SKILL.md:128
Finding

Automatic Feedback Telemetry Can Transmit Conversation-Derived Information Without Consent

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
scripts/onboarding.py:163
Finding

Onboarding Recommends Installation of Unpinned Runtime Dependencies

Content
View full analysis
dict: try: import qrcode except ImportError: err = ( "Missing qrcode dependency; please run: " "pip install qrcode pillow" ) print(f"{TAG} render_qr: {err}", file=sys.stderr) return { "png_path": None, "ascii_qr": None, "error": err, } ``` ```python def _require_requests() -> None: if requests is None: raise RuntimeError( "Missing requests dependency; please run: pip install requests" ) ``` ### Technical Analysis The onboarding code instructs users to install packages by mutable package name without exact versions, hashes, a lockfile, or a trusted-index requirement. Package resolution therefore depends on the current pip configuration and the latest package versions available at installation time. The referenced package names are not themselves shown to be malicious. The risk is non-reproducible and potentially unsafe dependency acquisition, particularly in environments configured to use an untrusted package mirror. ### Attack Path 1. The environment lacks `requests`, `qrcode`, or Pillow. 2. The onboarding flow displays the installation command. 3. The user executes the unpinned `pip install` command. 4. pip resolves packages and transitive dependencies from the configured index. 5. A compromised release, unsafe mirror, or substituted dependency executes package installation or runtime code with the user’s privileges. ### Impact Assessment A malicious or compromised dependency can execute code with the privileges of the user performing the installation or running the Skill. This could expose environment variables, including the LinkFox API key, as well as ...[truncated 169 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (26)

Tainted flow: 'url' from os.environ.get (line 235, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
93% confidence
Finding

The POST target is built from environment-controlled base URLs and then used to transmit sensitive data such as phone numbers, SMS codes, access tokens, refresh tokens, generated API keys, and team identifiers. In a skill execution environment, attackers who can influence environment variables or packaging can redirect these requests to attacker-controlled infrastructure, causing credential exfiltration and account compromise.

Content

Scanner excerpt · scripts/onboarding.py (reported line 196)May include surrounding context.

python
except RuntimeError as e:
        return {"_error": str(e)}
    try:
        r = requests.post(url, json=body or {}, headers=headers, timeout=timeout)
        return r.json()
    except Exception as e:
        body_text = ""

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

Critical
Category
Data Flow
Confidence
93% confidence
Finding

The gateway URL is likewise derived from environment variables and used with an Authorization header containing the agent API key. If an attacker can set LINKFOX_AGENT_API_URL or related variables, the CLI will send authenticated requests and secrets to an arbitrary server, enabling API-key theft and misuse.

Content

Scanner excerpt · scripts/onboarding.py (reported line 246)May include surrounding context.

python
headers["Content-Type"] = "application/json"
        req = Request(url, method=method, data=body_bytes, headers=headers)
        try:
            with urlopen(req, timeout=30) as resp:
                return json.loads(resp.read().decode())
        except urllib.error.HTTPError as e:
            status = e.code

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

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/tiktok_shop_product_detail.py (reported line 77)May include surrounding context.

python
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 ""

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented purpose omits material data-handling behavior: persistent storage of full API responses, 24-hour local caching, session/index tracking, and actual fallback writes to home or temp locations contrary to the stated write policy. This creates undisclosed retention and broader filesystem exposure than users would reasonably expect from a read-only lookup skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The documented purpose omits material data-handling behavior: persistent storage of full API responses, 24-hour local caching, session/index tracking, and actual fallback writes to home or temp locations contrary to the stated write policy. This creates undisclosed retention and broader filesystem exposure than users would reasonably expect from a read-only lookup skill.

Content

No source excerpt is available for this finding.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

python scripts/tiktok_shop_product_detail.py '{"productInput":"1729937400435937604","region":"GB"}'

text

## Display Rules

1. Lead with the product title, product ID, requested region, category, and returned status.
2. Show sale/original price with the returned currency; never convert currencies unless the user asks separately.

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · references/onboarding.md (reported line 14)May include surrounding context.

md
证码后:`python scripts/onboarding.py login <phone> <code>`(workbuddy 宿主加 `--channel workbuddy`)
   - 拿到 `api_key` 后把下面三平台配置转发给用户,提示重启会话生效:
     - Windows PowerShell(永久):`setx LINKFOX_AGENT_API_KEY "<key>"`
     - macOS zsh:`echo 'export LINKFOX_AGENT_API_KEY="<key>"' >> ~/.zshrc && source ~/.zshrc`
     - Linux bash:`echo 'export LINKFOX_AGENT_API_KEY="<key>"' >> ~/.bashrc && source ~/.bashrc`
     - 变量名 `LINKFOX_AGENT_API_KEY`(主推)或 `LINKFOXAGENT_API_KEY`(老规范)任一即可

**billing 场景**:`errcode=402` 或消息含 `积分/余额/quota/insufficient/充值/套餐到期`。
- `python scripts/onboarding.py list-plans` → 有 AskUserQuestion 就弹菜单,否则输出编号清单让用户选
- 校验 `plan_id` ∈ 清单、支付方式 ∈ 该套餐 `available_methods`(通常 `wechat/alipay`)
- `python scripts/onboarding.py order <plan_id> <method>` → 展示优先级 PNG

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

This file implements account onboarding, SMS login, API-key issuance, plan discovery, order creation, and payment QR rendering, which is materially unrelated to a TikTok Shop product-detail lookup skill. Such scope divergence is dangerous because it introduces credential collection and monetization flows into a public-data skill, expanding the attack surface and increasing the chance of user deception or unauthorized secret handling.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code can create orders and render payment QR codes, enabling billing operations that are not justified by the stated skill purpose of reading public product details. In this context, hidden payment capability is especially risky because users or hosts may not expect the skill to initiate purchases, and a compromised or misleading integration could trigger unwanted financial actions.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file performs SMS-based login, token exchange, team enumeration, and API-token retrieval/generation, all unrelated to public product-detail retrieval. In this skill context that makes the behavior more dangerous, because it silently expands from data lookup into credential handling and secret minting, creating opportunities for account takeover, unauthorized API access, and user confusion.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill declares no explicit tool scope even though its documented behavior requires environment access, network calls, and persistent file writes. This weakens least-privilege controls and makes it harder for operators and users to understand or constrain what the skill can do, especially given the additional onboarding and persistence behaviors referenced elsewhere.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger logic activates whenever a user mentions a TikTok Shop URL or 19-digit product ID, even if the user did not ask for a product-detail lookup. Over-broad triggering increases the chance of unintended network calls, billing, data persistence, and activation in contexts where the user did not consent to using this skill.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill mandates saving full API responses to persistent local storage for every call, regardless of whether that data is needed for the reply. Even public product data can be coupled with user-supplied inputs, session identifiers, operational metadata, or other contextual information, creating unnecessary retention and possible leakage across sessions or users.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Automatically sending user feedback or inferred satisfaction signals to a separate Feedback API is unrelated to the core function of fetching product details. It can exfiltrate user content, intent, or sentiment to another endpoint without a clear need or explicit consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation instructs callers to forward SESSION_ID, MODE_ID, and APP_NAME from environment variables to an external service without any privacy warning, minimization guidance, or statement of necessity. This can cause unnecessary disclosure of session or contextual identifiers to a third-party endpoint, increasing privacy and correlation risk if those values contain user- or tenant-specific data.

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 · references/api.md (reported line 123)May include surrounding context.

返回字段可能因商品、卖家、地区和页面上下文而缺失。即使商品下架或库存为 0,也可能返回结构化详情。

curl 示例

bash
API_KEY="${LINKFOX_AGENT_API_KEY:-$LINKFOXAGENT_API_KEY}"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The Feedback API asks clients to send free-form content to an external public endpoint but does not warn that user-provided text will leave the local system. Because feedback content may include user intent, errors, or copied product data, this omission creates a risk of unintentional data exfiltration and privacy violations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The onboarding instructions direct operators to collect a user's phone number and use it in registration/login flows, but they provide no guidance on consent, minimization, masking, retention, or safe handling of verification data. In an agent setting, this creates a real privacy and account-security risk because operators may unnecessarily handle sensitive personal data and OTP-linked account access without safeguards.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file instructs users to persist API keys in shell startup files and environment variables without warning that these credentials are long-lived secrets that may be exposed through dotfiles, backups, terminal history, screenshots, or multi-user systems. While common operationally, omitting secret-handling guidance makes credential leakage materially more likely.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% 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 · scripts/onboarding.py (reported line 196)May include surrounding context.

python
except RuntimeError as e:
        return {"_error": str(e)}
    try:
        r = requests.post(url, json=body or {}, headers=headers, timeout=timeout)
        return r.json()
    except Exception as e:
        body_text = ""

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The login flow emits the full API key to stdout JSON, which may be captured by logs, orchestration layers, transcripts, or downstream tools. Because this skill already exceeds its stated scope, exposing a freshly issued credential in normal output further increases the risk of accidental leakage and unauthorized reuse.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The docstring promises writes only under the current workspace and explicitly says /tmp is forbidden, but the implementation silently falls back to the home directory and temporary directory. This discrepancy can cause sensitive response data and session metadata to be written to less controlled locations than operators or users expect, increasing disclosure risk on shared systems.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The script transmits request parameters plus SESSION_ID, MODE_ID, and APP_NAME to a remote service without any runtime notice or consent mechanism. In contexts where users may supply URLs, product IDs, or session-linked workflow data, this can create an unexpected privacy leak and metadata exposure, especially because the gateway is environment-configurable.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script caches full API responses on disk and later marks cache hits, but does not clearly warn users that returned content will be stored locally. If API responses contain commercially sensitive product data, operational metadata, or account-linked information, local persistence can expose that data to other users or processes on the same machine.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

Several core usage and behavior descriptions are written only in Chinese, while other messages are in English. This mixed but partially untranslated presentation can effectively force a specific language for some users without opt-in or an offered alternative.

Content

No source excerpt is available for this finding.