Back to skill

Security audit

Shopee-店铺SBS

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to perform Shopee SBS inventory queries, but it also includes sensitive login, API-key, payment, and local data-retention behavior that is broader and less safely scoped than the core purpose.

Install only if you are comfortable giving this skill LinkFox/Shopee account access and using its billing/onboarding helpers. Avoid running the payment/order commands unless you explicitly intend to buy credits, do not store API keys in shell profiles on shared machines, review or restrict LINKFOX_* endpoint environment variables, and treat saved linkfox response files as sensitive business data that may need cleanup.

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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/_shopee_sbs_common.py:217
Finding

Unsanitized SESSION_ID Allows Output 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 returned value is subsequently used directly in a filesystem path: ```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: f.write(serialized) ``` The onboarding implementation repeats the same unsafe pattern: ```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 from the process environment and treated as a trusted directory name. No validation rejects absolute paths, path separators, `.` components, or `..` traversal components. With `os.path.join`, an absolute `SESSION_ID` can discard the previously constructed root and date components. A relative value containing traversal components can escape the intended session hierarchy after path normalization. T ...[truncated 1497 chars]
Remediation
View remediation
str: value = value.strip() if not _SESSION_ID_PATTERN.fullmatch(value): raise ValueError("Invalid SESSION_ID") return value ``` 3. Explicitly reject absolute paths, `/`, `\`, `.` and `..` path components. 4. Resolve the final path and verify containment before creating or writing files: ```python root_path = Path(root).resolve() session_path = (root_path / date_str / validated_sid).resolve() session_path.relative_to(root_path) ``` 5. Apply the same validation in both `_shopee_sbs_common.py` and `onboarding.py`. 6. Add tests for Unix and Windows absolute paths, nested traversal, mixed separators, empty values, and encoded or unusual path characters. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/_shopee_sbs_common.py:185
Finding

Sensitive Inventory Responses May Be Written to Shared Temporary Storage with Default Permissions

Content
View full analysis
str: cached = _LF_SESSION_CACHE.get("_root") if cached: return cached candidates = [] acpx = (os.environ.get("ACPX_WORKSPACES") or "").strip() if acpx: acpx = acpx.split(os.pathsep)[0].strip() if acpx: candidates.append(os.path.join(acpx, "linkfox")) candidates.append(os.path.join(os.getcwd(), "linkfox")) candidates.append(os.path.join(os.path.expanduser("~"), "linkfox")) candidates.append(os.path.join(_lf_tempfile.gettempdir(), "linkfox")) for root in candidates: try: os.makedirs(root, exist_ok=True) probe = os.path.join(root, ".write_probe") with open(probe, "w", encoding="utf-8") as f: f.write("") os.remove(probe) except OSError: continue root = os.path.abspath(root) _LF_SESSION_CACHE["_root"] = root return root fallback = os.path.abspath(candidates[-1]) _LF_SESSION_CACHE["_root"] = fallback return fallback ``` Full API responses are then persisted using default process permissions: ```python 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: f.write(serialized) print(f"Saved full response: {out} ({len(serialized)} bytes)") except OSError as e: print(f"Failed to save to {out}: {e}", file=sys.stderr) ``` ### Technical Ana ...[truncated 1873 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/onboarding.py:163
Finding

Onboarding Recommends Unpinned Runtime Dependency Installation

Content
View full analysis
dict: try: import qrcode except ImportError: err = "缺少 qrcode 依赖,请运行: pip install qrcode pillow" print(f"{TAG} render_qr: {err}", file=sys.stderr) return {"png_path": None, "ascii_qr": None, "error": err} ``` The login dependency uses the same pattern: ```python def _require_requests() -> None: if requests is None: raise RuntimeError("缺少 requests 依赖,请运行: pip install requests") ``` ### Technical Analysis The onboarding script directs users to install `qrcode`, `pillow`, and `requests` dynamically from the active pip package index without specifying versions, hashes, a lockfile, or a trusted package source. Package installation executes package build and installation logic with the privileges of the invoking user. Because the resolved package versions and source can change after the Skill has been audited, the effective runtime dependency set is not reproducible. No evidence was found that the named packages are themselves malicious. The vulnerability is the uncontrolled supply-chain installation process, not a confirmed malicious dependency. ### Attack Path 1. Trigger an onboarding command on a system where one of the optional dependencies is missing. 2. Receive the runtime instruction to execute an unpinned `pip install` command. 3. Run the command in an environment configured to use a compromised, malicious, or unintended package index, or at a later date when a dependency release has changed. 4. pip downloads and installs the resolved package and executes any applicable build or installation hooks. 5. Malicious package code would execute with the privileges of the user performing the installation and could subsequently execute whe ...[truncated 515 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/onboarding.py:486
Finding

Generated API Key Is Exposed in Standard Output and Recommended for Plaintext Shell-Profile Storage

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} 成功获取 API key(来源: {r['source']})", file=sys.stderr) return 0 return 1 ``` The onboarding documentation then recommends permanent plaintext profile storage: ```text - Windows PowerShell(永久):setx LINKFOX_AGENT_API_KEY "" - macOS zsh:echo 'export LINKFOX_AGENT_API_KEY=""' >> ~/.zshrc && source ~/.zshrc - Linux bash:echo 'export LINKFOX_AGENT_API_KEY=""' >> ~/.bashrc && source ~/.bashrc ``` ### Technical Analysis The API key is returned as part of the JSON object and printed without redaction. In an AI Agent environment, standard output may be captured in conversation context, execution logs, terminal scrollback, observability systems, or task artifacts. The documented configuration commands persist the key in plaintext shell startup files. Such files are commonly backed up, copied into support bundles, read by every interactive shell, and occasionally exposed by permissive permissions or accidental repository inclusion. Persisting an API key is necessary for authenticated gateway use, but printing it broadly and recommending shell-profile storage is not the least-exposure approach. ### A ...[truncated 1122 chars]
Remediation
View remediation
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 (32)

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

Critical
Category
Data Flow
Confidence
94% confidence
Finding

The code sends authentication material and user data to a URL derived from environment-controlled base URLs via requests.post. If an attacker can influence LINKFOX_LOGIN_API_URL or LINKFOX_AGENT_USER_API_URL, they can redirect login, refresh tokens, SMS codes, and generated API tokens to attacker-controlled infrastructure, causing credential exfiltration and account compromise. The mismatch between the Shopee SBS inventory skill description and this onboarding/login logic makes the behavior more suspicious and less justified.

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

The gateway request path uses urllib.request.urlopen against a URL built from environment-derived base configuration while attaching the Authorization API key header. An attacker who can tamper with LINKFOX_AGENT_API_URL or LINKFOX_TOOL_GATEWAY can force authenticated requests to an attacker server and capture the API key, account data, order details, and related responses. In this skill context, this is especially risky because the file performs account and billing operations unrelated to the declared Shopee SBS function.

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

If a skill presented as Shopee SBS inventory access actually performs login, API key management, account retrieval, and payment/order operations, that is a severe scope deception issue. In an agent ecosystem, misleading packaging can trick users or orchestrators into invoking a skill with much broader and more sensitive side effects than expected.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If a skill presented as Shopee SBS inventory access actually performs login, API key management, account retrieval, and payment/order operations, that is a severe scope deception issue. In an agent ecosystem, misleading packaging can trick users or orchestrators into invoking a skill with much broader and more sensitive side effects than expected.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If a skill presented as Shopee SBS inventory access actually performs login, API key management, account retrieval, and payment/order operations, that is a severe scope deception issue. In an agent ecosystem, misleading packaging can trick users or orchestrators into invoking a skill with much broader and more sensitive side effects than expected.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If a skill presented as Shopee SBS inventory access actually performs login, API key management, account retrieval, and payment/order operations, that is a severe scope deception issue. In an agent ecosystem, misleading packaging can trick users or orchestrators into invoking a skill with much broader and more sensitive side effects than expected.

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
证码后:`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 a full onboarding and monetization CLI—SMS login, API key retrieval, plan listing, ordering, and payment handling—even though the skill is described as a Shopee SBS warehouse/inventory query proxy. That scope mismatch is dangerous because it introduces unnecessary credential collection and payment capabilities that expand the attack surface and could be used to harvest user accounts or drive unauthorized purchases under the guise of an unrelated business function.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code creates orders and renders payment QR codes, enabling billing actions that are not justified by a Shopee SBS inventory-query skill. This can pressure users into payments or facilitate unauthorized commercial transactions, especially when embedded in an agent skill where users may trust the declared purpose and not expect purchase workflows.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
78% confidence
Finding

The skill advertises capabilities that require environment access, file writes, network access, and shell execution, but it declares no explicit tool scope or permission boundaries. In an agent setting, this weakens least-privilege controls and can let a broadly-triggered skill access sensitive local state or perform side effects beyond what users expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger language is broad enough to activate on general Shopee inventory discussions, even when SBS-specific intent is unclear. Overbroad routing increases the chance of unnecessary access to authorized store data or unintended API calls, especially when combined with network and file-write behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

L14 says the tool consumes points and warns against repeated probing because of extra cost, while L89 states '不消耗积分' ('does not consume points'). These statements actively conflict about a user-relevant operational effect, creating an intent/documentation divergence within the skill file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill states that full API responses are automatically written to project files by default, but it does not provide a clear privacy warning or data-handling notice. Since SBS responses can contain sensitive authorized-store inventory and operational data, silent persistence materially increases exposure beyond the immediate task.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Persisting every full API response to session-scoped local files creates unnecessary data retention and broadens the attack surface for sensitive store information. Even if intended for debugging or convenience, local files can be read later by other tools, users, or processes unrelated to the original request.

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


curl 示例

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

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file's operational instructions and field descriptions are written entirely in Chinese, which can constitute a language/locale policy violation when no user opt-in or alternative language path is offered. The document does not indicate that the skill is region-specific or that Chinese is a required locale for compliance or API behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

All user-facing guidance in this file is in Chinese and includes Chinese-language interaction patterns, but the skill does not say that Chinese is optional or that the skill is intentionally limited to a Chinese-speaking context. Under SQP-3, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The instructions explicitly tell operators to collect a user's phone number and submit it to a registration flow, but they provide no consent language, retention limits, masking guidance, or handling requirements for personally identifiable information. This creates avoidable privacy and compliance risk because an agent following the skill may solicit and process sensitive contact data without clear user authorization or safeguards.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code performs a network call via developerProxy and may send query parameters, identifiers, and POST bodies derived from user-supplied params. While the module docstring states its purpose at a high level, there is no confirmation prompt, user-facing log/print, or explicit warning here that request data will be transmitted externally.

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_sbs_common.py (reported line 41)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,

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file contains a generic session archival framework that discovers writable directories, creates session indexes, and stores metadata and data files unrelated to the narrow SBS query purpose. That broad persistence capability expands the attack surface and enables silent accumulation of business data across sessions, making the skill more dangerous because it handles authorized Shopee store information.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The helper persists full SBS API responses to local disk, including potentially sensitive warehouse, inventory, stock movement, and token-adjacent business data, even though the skill description only implies querying and forwarding API data. Local archival increases data exposure through filesystem access, backups, shared workspaces, and later collection by unrelated processes, especially because this happens by default without minimization.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill writes complete API responses to disk automatically and only prints a 'Saved full response' message after persistence, without any prior warning, consent, or configuration gate. For a skill processing inventory and warehouse data from authorized stores, silent local storage creates privacy and confidentiality risk because users may reasonably expect transient query behavior rather than persistent retention.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The QR rendering function writes payment QR images to disk in session directories without any clear user-facing notice in this file. Persisting payment artifacts on disk can leak transaction URLs or sensitive business context to other local users/processes, especially in shared or temporary environments.

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

Static analysis

No suspicious patterns detected.