Back to skill

Security audit

Shopee店铺-关注有礼

Security checks for vulnerabilities and agentic risk

Overview

The skill can manage Shopee Follow Prize campaigns, but it also handles LinkFox login, API keys, billing orders, and persistent local response storage with weak scoping.

Install only if you are comfortable letting this skill call LinkFox/Shopee APIs with your LinkFox API key, create/update/end/delete Follow Prize campaigns, guide account login with phone/SMS codes, and initiate billing orders. Prefer setting credentials per session instead of shell startup files, verify gateway environment variables before use, and require explicit user confirmation before any update, end, delete, or payment action.

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/_shopee_follow_prize_common.py:218
Finding

Unsanitized SESSION_ID Allows Filesystem Path Traversal

Content
View full analysis
str: env = os.environ.get("SESSION_ID") if env: return env.strip() if "_auto" not in _LF_SESSION_CACHE: _LF_SESSION_CACHE["_auto"] = ( _lf_time.strftime("%H%M%S", _lf_time.localtime(ts)) + "-" + _lf_secrets.token_hex(3) ) return _LF_SESSION_CACHE["_auto"] ``` The value reaches filesystem operations at `scripts/_shopee_follow_prize_common.py:321-329`: ```python sid = _lf_session_id(ts) root = _lf_root() session_dir = os.path.join(root, date_str, sid) os.makedirs(session_dir, exist_ok=True) _lf_ensure_meta(root, session_dir, date_str, sid, ts) data_dir = os.path.join(session_dir, "data") os.makedirs(data_dir, exist_ok=True) out = os.path.join(data_dir, f"{slug}-{int(ts * 1_000_000)}.json") try: with open(out, "w", encoding="utf-8") as f: ``` The onboarding workflow contains the same issue at `scripts/onboarding.py:153-158`: ```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 read directly from the process environment and used as a path component without validation or canonical containment checks. If `SESSION_ID` is an absolute path, `os.path.join()` discards the preceding root and date components. If it contains traversal components such as `../`, path n ...[truncated 2101 chars]
Remediation
View remediation
str: value = value.strip() if not _SESSION_ID_PATTERN.fullmatch(value): raise ValueError("Invalid SESSION_ID") return value ``` Apply this validation in both `_lf_session_id()` and `session_dir()`. 2. **Enforce canonical path containment** Resolve the intended root and final path before creating directories: ```python root_path = Path(root).resolve() session_path = (root_path / date_str / sid).resolve() if session_path != root_path and root_path not in session_path.parents: raise ValueError("Session path escapes the configured output root") ``` Perform the same check for onboarding output paths. 3. **Reject path syntax explicitly** Reject session identifiers containing: - `/` or `\` - `.` or `..` path components - Absolute paths - Null bytes - Platform-specific drive or UNC prefixes Strict allowlisting is preferable to attempting to remove dangerous characters. 4. **Use restrictive filesystem permissions** Create directories and response files with permissions limited to the current user where supported. API responses and payment data should not be broadly readable. 5. **Harden against symbolic-link attacks** For predictable metadata files, avoid following symbolic links where supported. Use secure file-opening flags such as `O_NOFOLLOW`, verify the destination is a regular file, and write updates atomically through a securely created temporary file followed by a controlled replacement. 6. **Remove the undocumented temporary-directory fallback or document it accurately** The implementation can fall back to the system temporary directory even though `SKILL.md` states that writing to `/tmp` is prohibited. Prefer failing closed when approved out ...[truncated 32 chars]
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
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (29)

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

Critical
Category
Data Flow
Confidence
90% confidence
Finding

The code sends sensitive environment-derived values, including the API key and session/application metadata, to a remote endpoint whose base URL is itself overridable via environment variables. In a hostile or multi-tenant runtime, an attacker who can influence environment configuration can redirect requests and exfiltrate credentials and contextual identifiers to an attacker-controlled server.

Content

Scanner excerpt · scripts/_shopee_follow_prize_common.py (reported line 88)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 ""

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

Critical
Category
Data Flow
Confidence
97% confidence
Finding

The script allows environment variables such as LINKFOX_LOGIN_API_URL and LINKFOX_AGENT_USER_API_URL to control outbound request destinations, then sends highly sensitive data including phone numbers, SMS codes, access tokens, refresh tokens, and generated API keys to those endpoints. In a skill context, environment variables are deployment-controlled rather than user-controlled, but this still creates a powerful credential exfiltration path if the skill or runtime is misconfigured or intentionally backdoored.

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
95% confidence
Finding

The gateway base URL is also taken from environment variables and used to construct urllib requests carrying the Authorization header with LINKFOX_AGENT_API_KEY, plus order, package, and account data. If an attacker can influence deployment configuration, all authenticated gateway traffic can be redirected to an attacker-controlled server, causing API key disclosure and unauthorized account actions.

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

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A second description-behavior mismatch indicates the skill may interact with login, account, API key, subscription, payment, and order APIs rather than only Shopee Follow Prize endpoints. That is security-relevant because payment and account-management actions are much more sensitive than campaign management, and hidden access to them could expose users to account takeover, billing abuse, or unauthorized purchases.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A second description-behavior mismatch indicates the skill may interact with login, account, API key, subscription, payment, and order APIs rather than only Shopee Follow Prize endpoints. That is security-relevant because payment and account-management actions are much more sensitive than campaign management, and hidden access to them could expose users to account takeover, billing abuse, or unauthorized purchases.

Content

No source excerpt is available for this finding.

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
示 JSON 里的 phone/agreements
   - 收到验证码后:`python scripts/onboarding.py login <phone> <code>`
   - 拿到 `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

The file implements LinkFox onboarding, SMS login, API-token generation, package listing, ordering, and payment QR rendering, which is unrelated to the declared Shopee Follow Prize functionality. This scope mismatch is dangerous because it asks users for authentication material and performs billing/account operations under the cover of an unrelated skill, indicating deceptive capability expansion.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The operational code path is wholly devoted to login, token acquisition, plan purchase, order creation, and payment status queries, none of which match the manifest's Shopee store campaign management purpose. In context, this makes the skill more dangerous because users invoking Shopee campaign management would not reasonably expect to be routed into credential collection and commercial purchase flows.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill advertises capabilities that involve environment access, shell execution, network access, and file writes, but it does not declare any explicit tool scope or allowed-tools boundary. In an agent setting, this weakens least-privilege protections and can allow the skill to invoke more powerful operations than a reviewer or orchestrator would expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger conditions are very broad, including cases where the user does not explicitly mention Follow Prize, which increases the chance of unintended invocation. In a skill with destructive operations like update, end, and delete, overbroad routing can cause accidental campaign changes or expose store data in the wrong conversational context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill exposes destructive Follow Prize operations such as update, end, and delete without a clear warning in the description that these actions can modify or terminate live campaigns. Without explicit warning and confirmation requirements, users or upstream agents may invoke the skill assuming it is informational only, leading to accidental business-impacting changes.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill documentation warns that using the tool 'will consume compute' and instructs users not to retry automatically due to extra cost, but later states '不消耗算力' (does not consume compute). These statements directly contradict each other and could mislead users about operational cost and usage constraints.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs the agent to always write full API responses to session-linked local files and sometimes print full JSON to stdout. API responses may contain shop identifiers, campaign data, user-supplied content, or other sensitive operational metadata, so unconditional persistence and broad output increase the risk of local data leakage, over-retention, and exposure through logs or shared workspaces.

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 43)May include surrounding context.


curl 示例

bash
curl -X POST ${LINKFOX_TOOL_GATEWAY}/shopee/developerProxy \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation exposes a destructive delete operation but does not warn users that invoking it can permanently remove a Follow Prize campaign. In an agent skill context, sparse safety guidance increases the chance that an LLM or user triggers deletion unintentionally, especially because the skill is designed to route requests to a live Shopee API for authorized stores.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The document exposes an operation that ends a Follow Prize campaign early but does not clearly warn that the action is destructive, may be irreversible, and can disrupt an active store promotion. In an agent context, this omission increases the chance that the model or user triggers the endpoint without adequate confirmation, causing unintended business impact such as prematurely terminating customer incentives.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file repeatedly states that get_follow_prize_detail retrieves Follow Prize detail by campaign_id, including in the purpose and registry notes. However, the documented JSON inputs only list shopId and merchantId, which are explicitly described as gateway routing fields rather than Shopee business parameters, so the documented behavior cannot be achieved as described from this file alone.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs an operator to collect and process a user's phone number and one-time verification code through a local script, but provides no privacy notice, consent guidance, retention limits, or warning not to log/store the OTP. That creates avoidable risk of credential interception, account takeover, and mishandling of personal data, especially because OTPs are authentication secrets and the workflow normalizes sharing them with the agent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The guidance tells users to persist an API key in shell startup files and environment variables without warning about credential exposure. Shell rc files may be readable by other local users, copied into backups, leaked through support bundles, inherited by subprocesses, or accidentally committed, so this increases the chance of long-term secret compromise.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/_shopee_follow_prize_common.py (reported line 37)May include surrounding context.

python
print(f"DEPENDENCY_MISSING: {json.dumps(payload, ensure_ascii=False)}", file=sys.stderr)
        sys.exit(DEPENDENCY_EXIT_CODE)
    try:
        result = subprocess.run(
            [sys.executable, str(checker)],
            capture_output=True,
            text=True,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The network layer transmits SESSION_ID, MESSAGE_ID, MODE_ID, and APP_NAME headers in addition to the authorization credential, but this file provides no indication of necessity, minimization, or disclosure. These metadata fields can enable correlation of user activity and increase privacy impact if the gateway is compromised, misconfigured, or redirected.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The code creates local session directories and an index of activity under multiple possible filesystem roots without a clear need for Follow Prize management. Even if intended for observability, this broad persistence can expose usage patterns, session identifiers, and references to stored result files to other local users or processes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The helper persists full API responses to local disk, which can include access tokens, campaign details, shop identifiers, or other sensitive business data returned through the developer proxy. This creates a secondary data exposure surface unrelated to the core Follow Prize API action and increases risk from local file disclosure, backup leakage, or cross-session access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Writing complete API responses to disk without explicit warning or opt-in can silently retain sensitive operational data beyond the immediate request lifecycle. In this skill context, Follow Prize and store-management responses may contain merchant/shop details and other data a user would not expect to be persistently stored locally.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and all CLI help text are written only in Chinese, and there is no indication that users can choose another language or locale. This creates a natural-language locale constraint without opt-in, which matches the policy category for forced language usage.

Content

No source excerpt is available for this finding.