Back to skill

Security audit

亚马逊-店铺上传

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly an Amazon upload helper, but it also has broad file upload, credential, account/billing, and local persistence behavior that needs review before installation.

Install only if you trust LinkFox and are comfortable with a skill that can read local files for upload, use LinkFox API credentials, guide phone/SMS account setup, and initiate payment-order flows. Verify upload URLs come from Amazon/LinkFox, avoid running with untrusted environment variables, and rotate any API key that appears in logs, transcripts, or shell history.

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/upload_to_destination.py:28
Finding

Unrestricted upload destination permits arbitrary local file exfiltration

Content
View full analysis
tuple[str, dict]: dest = params.get("uploadDestination") if isinstance(dest, dict): url = dest.get("url") or params.get("uploadUrl") headers = dest.get("headers") or params.get("headers") or {} else: url = params.get("uploadUrl") headers = params.get("headers") or {} if not url: print("Missing uploadUrl or uploadDestination.url", file=sys.stderr) sys.exit(1) if not isinstance(headers, dict): print("headers must be a JSON object", file=sys.stderr) sys.exit(1) return str(url).strip(), {str(k): str(v) for k, v in headers.items()} upload_url, hdrs = _resolve_upload_target(params) payload = load_file_bytes(params) if not payload: print("Provide filePath, content, or contentBase64", file=sys.stderr) sys.exit(1) req = Request(upload_url, data=payload, headers=hdrs, method="PUT") ... with urlopen(req, timeout=300) as resp: ``` ### Technical Analysis The declared workflow is to upload data to an Amazon-issued presigned destination. The implementation nevertheless accepts an arbitrary caller-supplied URL, arbitrary HTTP headers, and an arbitrary local `filePath`. It performs no validation of: - The URL scheme - The destination hostname - Whether the address resolves to a loopback, private, or link-local network - Whether the destination was issued by the preceding upload-destination operation - Which request headers may be forwarded - Redirect behavior `urllib.request.urlopen` uses redirect handlers by default. Consequently, an apparently acceptable endpoint could redirect the request to an unintended recipient. This behavior exceeds the minimum privileges needed for the declared func ...[truncated 1267 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/_spapi_uploads_common.py:27
Finding

Environment-controlled endpoints can receive API keys and authentication tokens

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", ) with urlopen(req, timeout=timeout) as response: return json.loads(response.read().decode("utf-8")) ``` ```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", ) def _http_post(url: str, body: dict, headers: dict, timeout: int = 30) -> dict: ... r = requests.post(url, json=body or {}, headers=headers, timeout=timeout) return r.json() def _headers(source: str, ...[truncated 2683 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/_spapi_uploads_common.py:258
Finding

Unsafe response persistence exposes presigned URLs and permits path escape through SESSION_ID

Content
View full analysis
str: ... 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 ``` ```python def _lf_session_id(ts: float) -> 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"] ``` ```python def emit_result(result, slug=SLUG, inline=False): 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(dat ...[truncated 2533 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/onboarding.py:486
Finding

Generated API keys are exposed through stdout and plaintext shell configuration guidance

Content
View full analysis
None: print(json.dumps(obj, ensure_ascii=False, indent=2)) ``` The onboarding documentation then instructs users to persist the returned secret as follows: ```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 onboarding command returns a generated or existing API key as part of ordinary JSON output. In an Agent environment, stdout may be copied into conversation transcripts, execution logs, terminal scrollback, or automation records. The documentation then tells users to place the secret directly in persistent shell startup files. Shell configuration files are often included in backups and diagnostic collections and may have broader read access than a dedicated secret store. Commands containing the key can also be retained by shell history or surrounding automation. Returning the complete key is operationally convenient, but it is not the least-exposure method of configuring a credential. ### Attack Path 1. A user completes SMS login through the onboarding command. 2. The service returns or generates an API key. 3. `_emit` prints the complete key to stdout. 4. The Agent platform, terminal, logging system, or transcript retains the output. 5. The user follows the documentation and embeds the key in a shell command and s ...[truncated 578 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 = "缺少 qrcode 依赖,请运行: 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("缺少 requests 依赖,请运行: pip install requests") ``` ### Technical Analysis When required modules are absent, the script recommends installing packages by name without specifying exact versions, hashes, a lockfile, an isolated environment, or a trusted package index. The code does not automatically execute the installation command, so exploitation requires a user or Agent to follow the recommendation. Nevertheless, installing unconstrained current package versions makes the effective dependency set change over time and exposes the environment to package-index compromise, dependency takeover, or a future malicious release. The referenced package names are not demonstrated to be typosquatted in the audited material. The risk is therefore unsafe and non-reproducible dependency acquisition rather than evidence of an intentionally malicious dependency. ### Attack Path 1. The onboarding script runs in an environment where `requests`, `qrcode`, or `Pillow` is absent. 2. The script prints an installation recommendation. 3. A user or Agent executes the suggested `pip install` command. 4. Pip downloads the currently resolved package versions from its configured package index. 5. If the index, account, network configuration, or selected package version is compromised, package installation executes attacker-controlled build or installation code under the user's privileges. ### ...[truncated 353 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
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (31)

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

Critical
Category
Data Flow
Confidence
94% confidence
Finding

The request target is derived from environment-controlled API_BASE_URL and the code also forwards sensitive headers including the API key and session metadata. If an attacker can influence environment variables, requests and credentials can be redirected to an attacker-controlled endpoint, causing credential exfiltration and unauthorized data disclosure.

Content

Scanner excerpt · scripts/_spapi_uploads_common.py (reported line 100)May include surrounding context.

python
method="POST",
    )
    try:
        with urlopen(req, timeout=timeout) 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
95% confidence
Finding

The code allows service base URLs to be overridden via environment variables and then sends sensitive data, including SMS login data, access tokens, refresh tokens, and generated API tokens, to those URLs with requests.post. In an agent/skill environment, attacker-controlled or poisoned environment configuration can redirect these credential-bearing requests to an arbitrary host, 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
94% confidence
Finding

The gateway request path uses an environment-controlled base URL and attaches the LinkFox API key in the Authorization header before calling urlopen. If the environment is manipulated, the skill can be induced to transmit the API key and related account/order data to an attacker-controlled endpoint, creating a straightforward secret exfiltration channel.

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 file-upload skill should not also handle SMS login, account authentication, subscription browsing, payment order creation, QR-code generation, or payment-status polling unless that functionality is clearly separated and declared. Mixing commerce/account flows with upload automation expands access to sensitive identity and payment data and creates a serious trust-boundary violation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A file-upload skill should not also handle SMS login, account authentication, subscription browsing, payment order creation, QR-code generation, or payment-status polling unless that functionality is clearly separated and declared. Mixing commerce/account flows with upload automation expands access to sensitive identity and payment data and creates a serious trust-boundary violation.

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

md
---

## Display Rules

1. 成功创建目的地常为 **HTTP 201**;先看 **`developerProxy`**,再看 **`uploadDestination`**。
2. **`resource`** 传未编码的下游资源路径;可带或不带前导 `/`,生成 path 时保留内部 `/`(greedy path),不得预编码成 `%2F`。

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file adds authentication recovery, account registration, and billing/payment remediation flows to a skill whose stated purpose is Amazon SP-API upload handling. This unnecessary expansion of scope increases the chance that an upload-triggered workflow could solicit credentials, API keys, phone numbers, or payment actions unrelated to the user’s original task, creating a social-engineering and unauthorized capability risk.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documented ability to register accounts by phone verification and initiate plan purchases is not justified by the Amazon file-upload use case. Embedding these flows in the skill enables collection of sensitive personal data and can steer users into account creation or payment activity under the guise of resolving operational errors, which is dangerous even if not overtly malicious.

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 account onboarding, SMS login, API key retrieval, package listing, and payment/order operations, which are unrelated to the declared Amazon SP-API upload purpose. This mismatch is dangerous because users invoking an Amazon upload skill would not reasonably expect credential collection and commerce flows for a separate platform, indicating deceptive scope and elevated risk of secret harvesting.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code can create purchase orders, query them, and render payment QR codes, none of which are justified by an Amazon file-upload skill. Embedding payment capabilities in an unrelated skill creates risk of unauthorized charges, social engineering, and abuse of user trust under false pretenses.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill performs SMS-based login, token exchange, user/team enumeration, and API token generation for LinkFox, which is outside the declared Amazon upload workflow. In context, this is especially dangerous because it can harvest a user's phone number and SMS code and then disclose a reusable API key, enabling broader account takeover or misuse.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill declares shell, network, environment, and file read/write capabilities but does not scope or constrain them via explicit permissions. In practice, this creates unnecessary ambient authority for a workflow that handles API keys, local files, and presigned upload URLs, increasing the blast radius if the skill is invoked in an unexpected context or modified later.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description says the skill should trigger not only for explicit upload requests but also whenever 'other Amazon SP-API operations need an upload resource address first.' That condition is broad and lacks concrete boundaries or negative examples, making it unclear when this skill should activate versus a more specific downstream skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The natural-language instructions throughout the skill are presented in Chinese, which effectively forces a specific language for users and operators. The file does not offer an opt-in language choice or explain that the skill is intentionally limited to a Chinese-speaking environment.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs that complete API responses must always be written to project/session files, which can include seller identifiers, upload destinations, headers, URLs, and other potentially sensitive business data. Persistent storage in the working directory creates avoidable retention and cross-task exposure risks, especially in shared repositories or multi-session environments.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The instructions tell the operator to request and pass a user’s phone number to a registration script without any privacy warning, minimization guidance, or explanation of how the data is stored and used. In the context of an Amazon upload skill, this data collection is unexpected and can expose users to privacy harm or unauthorized account linkage.

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/_spapi_uploads_common.py (reported line 49)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,

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The docstring for get_api_key is written only in Chinese, and several user-facing stderr messages nearby are also Chinese-only. This imposes a locale/language requirement without user opt-in or an alternative language path, which matches the language-policy violation criteria.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

API requests include seller-related identifiers and session metadata headers, but this file provides no notice, consent, or minimization around that transmission. In a skill handling marketplace uploads, these identifiers can be sensitive operational metadata, and silent forwarding increases privacy and traceability risk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The shared upload helper contains a generic persistent logging layer that saves full API responses and session-linked metadata to local disk, which exceeds the narrow upload purpose of the skill. In this context, upload and token workflows may return presigned URLs, identifiers, or business data that become exposed through unnecessary local retention.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The code probes and writes to several candidate directories, including the current working directory, home directory, and temp directory, to establish generic session storage unrelated to core upload behavior. This broad write surface increases the chance of sensitive data being placed in weakly protected or shared locations where other users or processes may read it.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The emitter writes full serialized API responses to disk and announces the path, without any redaction or warning. In this skill context, responses may contain presigned upload URLs, seller/account identifiers, or other sensitive API output that can later be harvested from local storage.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The result emitter persistently stores complete API responses together with session identifiers and metadata, creating a durable local data-retention channel. Because this upload skill can process sensitive marketplace artifacts and return presigned destinations or related metadata, the retained files materially increase the blast radius of host compromise, accidental sharing, or forensic recovery.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring openly describes a LinkFox onboarding CLI, which directly contradicts the skill metadata claiming Amazon SP-API file upload behavior. This discrepancy is a strong indicator of deceptive packaging or supply-chain substitution, increasing the likelihood that users will run code outside the intended trust boundary.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.