Back to skill

Security audit

Shopee-店铺折扣

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real Shopee discount-management integration, but it also handles credentials, billing, live store-changing actions, and local response persistence with insufficient scoping and safety controls.

Install only if you trust LinkFox with your Shopee promotion authority, API key, phone-based login flow, and payment flow. Before use, pin the gateway to the official HTTPS LinkFox host, avoid putting API keys in shell history or shared profiles, keep saved response files out of repositories, and require explicit human confirmation before any create, update, end, or delete discount action.

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/_shopee_discount_common.py:18
Finding

Credentials can be transmitted to an attacker-controlled gateway

Content
View full analysis
str: """ Get the API key configured in an environment variable. """ key = os.environ.get("LINKFOX_AGENT_API_KEY") or os.environ.get("LINKFOXAGENT_API_KEY") if not key: print( "API Key not configured", 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", ""), "MESSAGE_ID": os.environ.get("MESSAGE_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 destination receiving the LinkFox API key is selected from environment variables without validating the URL scheme or hostname. T ...[truncated 1662 chars]
Remediation
View remediation
str: parsed = urlparse(raw_url) if parsed.scheme != "https" or parsed.hostname not in ALLOWED_HOSTS: raise RuntimeError("Untrusted LinkFox gateway URL") return raw_url.rstrip("/") ``` 2. Do not support custom credential-bearing endpoints in normal production mode. 3. If custom endpoints are required for development, require an explicit development flag and display a clear warning before sending any credential. 4. Resolve and validate the destination immediately before each request so redirects or altered endpoints cannot bypass validation. 5. Disable automatic redirects to different origins, or remove the authorization header whenever the origin changes. 6. Add automated tests covering HTTP URLs, user-info URLs, unexpected ports, subdomain confusion, and redirect-based credential leakage. 7. Rotate any API key that may have been used while untrusted gateway environment variables were present. ]]>

other

Warning
Location
scripts/_shopee_discount_common.py:70
Finding

Agent and message metadata is disclosed beyond the minimum required scope

Content
View full analysis
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", ""), "MESSAGE_ID": os.environ.get("MESSAGE_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")) ``` ### Technical Analysis Every gateway request includes `SESSION_ID`, `MESSAGE_ID`, `MODE_ID`, and `APP_NAME` from the process environment. These identifiers are not required to select a Shopee store or perform a Discount API operation. The declared behavior in `SKILL.md` describes transmission of the store or merchant identifier through `/shopee/developerProxy`, but it does not disclose that agent-session and message-level identifiers are transmitted with every request. This exceeds the minimum privileges and data necessary for Discount management. It allows the receiving service to correlate individual messages, agent sessions, execution modes, applications, API credentials, and commerce operations. Because the gateway destination is also configurable, these identifiers can be disclosed to an unintended server if the environment is manipulated. ### Attack Path 1. The agent runtime populates session, message, mode, and application identifiers in environment variables. 2. The user executes any API wrapper. 3. `call_api()` reads all four id ...[truncated 801 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/_shopee_discount_common.py:180
Finding

Complete API responses can be stored in undocumented and insecure fallback locations

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 ``` ```python def emit_result(result, slug=SLUG, inline=False): """Write the complete response under linkfox///data/-.json.""" serialized = json.dumps(result, ensure_ascii=False, indent=2) ts = _lf_time.time() date_str = _lf_time.strftime("%Y-%m-%d", _lf_time.localtime(ts)) 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 op ...[truncated 2739 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/onboarding.py:486
Finding

Onboarding prints the complete API key to standard output

Content
View full analysis
None: print(json.dumps(obj, ensure_ascii=False, indent=2)) ``` ```python def _cmd_login(args) -> 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 (source: {r['source']})", file=sys.stderr) return 0 return 1 ``` ### Technical Analysis A successful SMS login obtains or generates an API key, places the complete key in the returned dictionary, and serializes that dictionary to standard output. In an agent environment, stdout can be captured in conversation transcripts, tool-call records, terminal logging, CI logs, shell redirection, or debugging systems. The associated onboarding documentation encourages users to place the key directly in shell-profile commands. This can further expose it through shell history, plaintext profile files, backups, and process-monitoring or support logs. The network exchange used to obtain team information and generate the API token is related to the explicit onboarding workflow. The primary issue is not that these calls exist, but that the resulting long-lived credential is returned through an insecure output channel without masking or secure storage. ### Attack Path 1. A user supplies a phone number and SMS code to ...[truncated 953 chars]
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; 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; run: pip install requests") ``` ### Technical Analysis When dependencies are absent, the script recommends installing `qrcode`, `pillow`, and `requests` without version constraints, hashes, a lockfile, an isolated environment, or a specified trusted package index. The package names are established public packages, and the Skill does not automatically execute the installation commands. Nevertheless, following these instructions retrieves whatever versions are current at installation time. This makes the environment non-reproducible and increases exposure to a compromised package release, compromised package index, dependency takeover, or incompatible future version. ### Attack Path 1. The runtime does not contain one of the optional dependencies. 2. The script emits a command such as `pip install requests`. 3. The user follows the recommendation in an environment configured to use the default or a potentially untrusted package index. 4. Pip resolves the current mutable package release and its transitive dependencies. 5. Installation or import executes package-controlled code. 6. If the selected package artifact or dependency is compromised, that code executes with the privileges of the user running pip or the Skill. ### Impact Assessment The direct Skill code does not automatically install or execute a remote payload. ...[truncated 330 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
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
Findings (45)

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 request sends multiple environment-derived headers, and the destination base URL is also environment-controlled via LINKFOX_TOOL_GATEWAY/SHOPEE_API_BASE_URL. In an untrusted runtime, this can exfiltrate API keys, session identifiers, and request data to an attacker-chosen endpoint or leak internal context through outbound headers.

Content

Scanner excerpt · scripts/_shopee_discount_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
93% confidence
Finding

The code builds request destinations from environment-controlled base URLs and then sends sensitive data, including phone numbers, SMS codes, access tokens, refresh tokens, and generated API keys, to those endpoints. If an attacker can influence the runtime environment, they can redirect authentication and token-provisioning traffic to attacker-controlled servers, 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
92% confidence
Finding

The gateway URL is also derived from environment variables and used for authenticated requests with the LinkFox API key in the Authorization header. An attacker who can set those variables can redirect paid account, order, and user-info requests to a malicious endpoint and harvest API credentials or manipulate responses.

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

The declared purpose describes a functional Shopee Discount management skill handling discount-related user intents and forwarding Discount API operations. The actual code chunk does not implement any discount API behavior at all. Instead, it checks local environment variables and filesystem paths to determine whether a prerequisite auth skill is installed, then emits status output and exit codes. While dependency checking could be a supporting implementation detail for such a skill, this chunk by itself materially differs from the declared purpose and exposes capabilities/resources not mentioned in the description (filesystem and environment inspection). Therefore this code chunk does not accurately represent the declared discount-management behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The code clearly belongs to the Shopee Discount domain, so the general product area matches. However, the declared description says it forwards '全部 12 个接口' but then enumerates supported examples that do not include delete_discount, while the provided code exclusively performs delete_discount. Since endpoint deletion is a distinct capability and the supplied chunk's primary purpose is that undeclared operation, this is a description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is about Shopee discount campaign management for authorized Shopee stores through Shopee Open API Discount endpoints. The supplied code does nothing related to Shopee, store discounts, promotion creation, discount IDs, or /shopee/developerProxy. Instead, it is an onboarding and billing CLI for LinkFox infrastructure, interacting with LinkFox login/account/order/package APIs. Its primary purpose, external services, triggers, and capabilities are materially different from the declaration, so this is a clear mismatch.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger conditions are explicitly broadened to activate even when the user does not mention discounts, as long as the request is loosely related to an authorized Shopee store. Over-broad activation raises the chance of this skill intercepting unrelated commerce workflows and performing sensitive store-management actions under ambiguous intent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file embeds an unrelated onboarding and monetization workflow inside a Shopee discount-management skill, including account registration, API key acquisition, and billing recovery steps. This expands the skill’s effective scope far beyond discount operations and can steer users into credential/payment handling flows that are not justified by the stated purpose, increasing phishing, account-abuse, and social-engineering risk.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documentation instructs operators to collect a phone number, send verification codes, log in through a script, and guide users through plan purchase flows, none of which are necessary for managing Shopee discounts. In this context, these capabilities are dangerous because they normalize collection of personal data and payment interactions under the cover of an unrelated commerce skill.

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

This file implements LinkFox account onboarding, SMS login, plan listing, billing, and payment QR generation, which is unrelated to the declared Shopee discount-management skill. That mismatch is dangerous because users invoking a commerce-discount skill would not reasonably expect account enrollment and payment behavior, increasing the risk of deceptive credential collection and unauthorized monetization.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code contains package lookup, order creation, payment URL retrieval, and QR-code rendering for LinkFox billing, none of which are justified by a Shopee discount skill. In this context, the hidden billing capability is especially dangerous because it can steer users into unintended purchases under the guise of store-discount management.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script performs SMS verification, account login, team lookup, and API token retrieval/generation for LinkFox, which is unrelated to Shopee discount management. In the context of a mismatched skill, this is highly suspicious because it enables credential capture and secret provisioning that users would not expect when requesting Shopee promotional actions.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill declares capabilities that include environment access, file writes, network access, and shell execution, but it does not declare any explicit tool scope or permission boundaries. This increases the risk of unintended or overly broad execution because reviewers and runtime policy layers cannot easily verify whether the documented behavior matches the actual operational privileges.

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 that complete API responses must always be written to project-local files, but it does not warn that these responses may include sensitive commercial data such as pricing, campaign configuration, item identifiers, and shop metadata. Persisting such data in the working directory increases the risk of later exposure through repository commits, shared workspaces, or other tools reading local files.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The instruction to always persist full responses into session-linked local files creates a durable record of potentially sensitive user/store data that can be accessed by later prompts, other tools, or accidental disclosure channels. Because the files are organized by session and date in the current working directory, the leakage risk is amplified in shared or source-controlled environments.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation says the tool consumes compute and warns against repeated probing, but later states '不消耗算力' ('does not consume compute'). This contradiction can mislead users or agents into taking repeated actions they would otherwise avoid, potentially causing unintended costs, quota exhaustion, or repeated writes/network calls.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file describes operations such as creating, updating, ending, and deleting discount activities/items, which can directly affect merchant pricing and active promotions. The description lists these capabilities plainly but does not include any warning about business impact, irreversibility, or the need to verify target shop/activity before execution.

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


curl 示例

bash
curl -X POST https://tool-gateway.linkfox.com/shopee/developerProxy \

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file's instructional content and field descriptions are written in Chinese throughout, while also containing some English API labels, but it does not offer a language choice or state that the skill is intended only for a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation exposes a write-capable API that creates Shopee discount promotions and explicitly says to 'pass full body', but it does not warn that this is a data-modifying, business-impacting action requiring explicit user confirmation. In an agent setting, that omission increases the chance of unintended promotion creation, pricing mistakes, or unauthorized campaign changes if the skill is triggered from ambiguous user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This documentation exposes a destructive API operation that removes items from a discount campaign, but it does not include any warning, confirmation requirement, or guardrails about irreversible business impact. In an agent skill context, terse action-oriented docs can cause an automated system or operator to invoke deletion with insufficient friction, increasing the risk of accidental or unauthorized promotional changes affecting live storefront pricing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This documentation exposes a destructive API operation that deletes discount campaigns but provides no warning, confirmation requirement, or operator-safety guidance. In an agentic context, sparse docs for destructive actions increase the chance that an LLM or user will invoke deletion accidentally or with insufficient validation, causing unintended loss of active promotions and business disruption.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This documentation exposes a destructive delete operation for SIP discounts and provides direct invocation examples, but it does not include any warning, confirmation requirement, or guidance about irreversible business impact. In an agent skill context, that omission increases the chance of accidental or unauthorized promotional deletion, especially because the action is routed through a generic developer proxy and may be triggered from natural-language requests.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation exposes an irreversible business operation ('end discount early') but provides no warning, confirmation requirement, or mention of business impact such as prematurely stopping promotions and affecting sales. In an agent context, this omission increases the chance that a user request is translated directly into a destructive API call without explicit user acknowledgment.

Content

No source excerpt is available for this finding.