Back to skill

Security audit

亚马逊-店铺数据上传

Security checks for vulnerabilities and agentic risk

Overview

The skill has real Amazon feed functions, but it also handles login, API keys, payments, file uploads, and persistent local storage with loose controls.

Install only after reviewing the login, billing, upload, and storage behavior. Use it with a least-privilege LinkFox key, avoid endpoint override environment variables unless you control them, only upload explicit feed files to fresh Amazon presigned URLs, and clean up saved linkfox response files that may contain seller data or presigned URLs.

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/upload_feed_document.py:32
Finding

Arbitrary Local File Exfiltration Through an Unrestricted Upload Destination

Content
View full analysis
bytes: if params.get("filePath"): p = Path(str(params["filePath"]).expanduser()) if not p.is_file(): print(f"filePath not found: {p}", file=sys.stderr) sys.exit(1) return p.read_bytes() if params.get("contentBase64"): try: return base64.b64decode(str(params["contentBase64"])) except Exception as e: print(f"Invalid contentBase64: {e}", file=sys.stderr) sys.exit(1) if "content" in params: raw = params["content"] if isinstance(raw, str): return raw.encode("utf-8") print("content must be a string", file=sys.stderr) sys.exit(1) print("Provide one of: filePath, content, contentBase64", file=sys.stderr) sys.exit(1) def main() -> None: if len(sys.argv) < 2: print( "Usage: upload_feed_document.py ''\n" "Required: uploadUrl, contentType, and filePath | content | contentBase64", file=sys.stderr, ) sys.exit(1) try: params = json.loads(sys.argv[1]) except json.JSONDecodeError as e: print(f"Invalid JSON: {e}", file=sys.stderr) sys.exit(1) for f in ("uploadUrl", "contentType"): if f not in params: print(f"Missing required field: {f}", file=sys.stderr) sys.exit(1) upload_url = str(params["uploadUrl"]).strip() content_type = str(params["contentType"]).strip() payload = _load_bytes(params) req = Request( upload_url, data=payload, headers={"Content-Type": content_type}, method="PUT", ) out: dict = {"uploadUrl": upload_url, "bytesUploaded": len(payload)} try: ...[truncated 2425 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/_spapi_feeds_common.py:253
Finding

Unsanitized SESSION_ID Enables 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"] ``` ```python def emit_result(result, slug=SLUG, inline=False): """落盘完整响应到 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 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) _lf_update_meta(session_dir, skill=slug, file_rel=os.path.relpath(out, session_dir), ts=ts) if inline or len(serialized.encode("utf-8")) <= LF_SMALL_THRESHOLD: print(serialized) else: _lf_summarize(result) ``` ### Technical Analysis `SESSION_ID` is accepted verbatim from the environment and used as a filesystem path component. The implementation does not reject: - Absolute paths. - `..` parent-directory components. - Forward or backward path separato ...[truncated 1952 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/_spapi_feeds_common.py:219
Finding

Full Sensitive API Responses Are Persisted in Plaintext and May Fall Back to Temporary Storage

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): """落盘完整响应到 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 open(out ...[truncated 2693 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
scripts/onboarding.py:162
Finding

Onboarding Recommends Installing 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} os.makedirs(out_dir, exist_ok=True) png_path = os.path.join(out_dir, f"qr-{int(time.time() * 1_000_000)}.png") qr = qrcode.QRCode(border=1) qr.add_data(content) qr.make(fit=True) qr.make_image(fill_color="black", back_color="white").save(png_path) buf = io.StringIO() qr.print_ascii(out=buf, invert=True) return {"png_path": png_path, "ascii_qr": buf.getvalue()} def _require_requests() -> None: if requests is None: raise RuntimeError("缺少 requests 依赖,请运行: pip install requests") ``` ### Technical Analysis The onboarding utility recommends direct installation of `qrcode`, `pillow`, and `requests` without: - Exact version pins. - Package hashes. - A reviewed lockfile. - A trusted package index declaration. - An isolated environment requirement. - Provenance or signature verification. The code does not automatically execute pip, which substantially reduces immediate severity. Nevertheless, following the displayed instructions delegates code selection to the currently configured Python package index and installs whatever versions are current at that time. Python package installation and import can execute package-controlled code. A compromised upstream release, malicious mirror, dependency confusion condition, or modified package index could therefore introduce code beyond what was audited in this Skill. ### Attack Path 1. A user invokes onboarding functionality that requires `requests`, QR generation, or image rend ...[truncated 1113 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 (33)

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

Critical
Category
Data Flow
Confidence
91% confidence
Finding

The request destination is derived from environment-controlled base URLs, and the code sends the API key plus session metadata headers to that endpoint without validating that it is a trusted LinkFox host. If an attacker can influence environment variables such as LINKFOX_TOOL_GATEWAY, STORE_API_BASE_URL, or SPAPI_BASE_URL, they can redirect authenticated traffic and exfiltrate credentials and seller data to an arbitrary server.

Content

Scanner excerpt · scripts/_spapi_feeds_common.py (reported line 98)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
97% confidence
Finding

The script allows base URLs for login and agent-user API calls to be overridden via environment variables, then sends sensitive data such as phone numbers, SMS codes, access tokens, refresh tokens, generated API keys, and authorization headers to those URLs using requests.post. In a skill/onboarding context, this creates a credential exfiltration and SSRF-style risk if an attacker can influence the runtime environment or package configuration, because the script will trust and transmit secrets to arbitrary endpoints.

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

The gateway request path constructs a URL from environment-controlled base values and then sends authenticated requests with the API key in the Authorization header via urlopen. If an attacker controls those environment variables, they can redirect privileged requests and capture the API key or force the process to contact internal or malicious hosts, making this both a secret-leak and SSRF vector.

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

声明的核心能力是亚马逊店铺 Feed 批量提交与处理状态管理,属于远程 API 交互型功能。但提供的代码没有任何 Amazon SP-API 调用、网络请求、Feed 数据处理、文档上传或状态查询逻辑。它的实际唯一目的,是检查另一个认证技能是否已安装,通过读取环境变量、遍历常见本地目录并查找 SKILL.md 文件来判断依赖是否满足。这不是对 Feed 功能的辅助细节实现,而是一个明显不同的主要功能模块,因此描述与代码行为存在实质性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明的用途聚焦于亚马逊 SP-API Feeds 的批量商品/库存数据提交与处理管理,但代码中没有任何亚马逊、SP-API、feedType、feedDocumentId、feedId、上传预签名 URL、Feed 状态查询、结果文档获取或取消 Feed 的实现。相反,代码调用的是 LinkFox 自身的登录、用户、套餐、订单和支付相关接口,核心功能是账号 onboarding 与付费开通流程。这不是对声明功能的辅助实现,而是完全不同的主要目的与能力,因此属于明显的不匹配。

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

md
---

## Display Rules

1. 先看 **`developerProxy.errcode` / `httpStatus`**;createFeedDocument 常为 **201**,createFeed 常为 **202**。
2. **getFeeds** 分页:仅用上一页 **`nextToken`** 作为下一请求的 **`paginationToken` 参数名在 Amazon 侧为 `nextToken`**(脚本字段名 `nextToken`)。

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This onboarding guide is unrelated to the stated Amazon Feed-management purpose and introduces account recovery, registration, and billing workflows through a local script. In a skill that should handle SP-API feed submission, adding out-of-scope auth and payment flows expands the attack surface and can steer operators into collecting credentials, phone numbers, and payment actions that are unnecessary for the core function.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document instructs the operator to collect a user's phone number, run registration/login commands, and initiate paid plan purchases even though those capabilities are not justified by the Amazon Feed skill's purpose. That mismatch is dangerous because adversarial or compromised skill content can abuse user trust to harvest personal data and trigger external account or payment actions outside the expected workflow.

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, API key acquisition, package purchase, and payment workflows, which are unrelated to the declared Amazon Feed bulk submission purpose. Such capability mismatch is dangerous because it can trick users or operators into running code that collects credentials and performs account or billing actions outside the advertised skill scope.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code includes package enumeration, order creation, payment URL/QR generation, and payment-state querying, none of which are justified by an Amazon Feed management skill. Embedding payment functionality in an unrelated automation skill expands the attack surface for fraud, unauthorized purchases, and deceptive monetization behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script performs SMS-based login, token exchange, team selection, and API key retrieval/generation for LinkFox accounts, which is outside the stated Amazon Feed scope. This is dangerous because it directly handles authentication factors and account tokens, enabling credential harvesting or unauthorized account provisioning under the guise of a different skill.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill documents use of environment variables, filesystem reads/writes, network access, and shell-invoked scripts, but it does not declare an explicit tool scope or permission boundary. In an agent setting, missing scope declarations can cause over-broad execution rights and make it harder to constrain or audit what the skill is allowed to access.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger text says the skill should activate even when the user does not explicitly mention feeds, as long as they want structured bulk product or inventory submission. Overly broad invocation criteria can cause unintended activation of a high-capability skill that performs network, file, and shell actions on ambiguous requests.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The skill metadata and operating instructions are written entirely in Chinese and do not indicate that language choice is optional or user-selectable. This can amount to a locale/language policy violation if the skill effectively requires Chinese responses without explicit user opt-in or documented justification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill states both that tool use consumes compute and may require quota/billing handling, and later that it does not consume compute. Contradictory operational guidance can mislead an agent into taking actions the user did not expect, including continued calls during quota-sensitive situations or mishandling billing-related errors.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill directs collection and transmission of a user's phone number and one-time code without any privacy warning, data-handling guidance, or minimization requirements. This creates a risk of unnecessary exposure of personal data and authentication factors, especially because the collection occurs in an out-of-scope workflow not tied to Amazon Feed processing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The guide tells users to persist an API key in shell startup files and environment variables without warning that the key is a sensitive secret. Persisting credentials in common shell profiles can expose them to other local processes, accidental disclosure, command-history leakage, or syncing into backups and dotfile repositories.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill's stated purpose is managing Amazon Feed workflows, but this module spawns a separate Python process to run check_auth_dependency.py before operation. Launching subprocesses is not an obvious requirement of feed submission/status management and introduces capability beyond direct API interaction.

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_feeds_common.py (reported line 47)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
92% confidence
Finding

The docstring and related user-facing error text are written in Chinese, including instructions that direct handling via SKILL.md, but the file does not provide any language opt-in or indicate that the skill is intentionally Chinese-only. Under the stated policy, forcing a specific language without user choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Beyond single-response logging, this helper creates a persistent session archive with metadata, index entries, skill usage history, and data files in multiple candidate directories including the working directory, home directory, or temp directory. For a feeds-management skill, that broadens the retention and leakage surface because Amazon seller operations data may remain accessible long after use, especially in shared hosts or loosely protected temp/workspace locations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The helper writes full API responses to local disk under predictable session directories. In the context of Amazon SP-API feeds, responses can contain seller identifiers, feed metadata, processing results, and possibly document references or error details, so undisclosed persistence increases the risk of local data exposure, over-retention, and unintended secondary use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Sensitive API responses are saved to disk without any in-file disclosure, warning, or consent gate. In a skill handling store feeds and results, this creates a quiet data retention channel that may surprise operators and expose commercially sensitive data to other local users, backups, logs, or later compromise.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code contains natural-language content in Chinese in the module docstring and in the emitted failure reason, while suggested actions are in English. Under the stated policy, forcing a specific language or mixed locale behavior without user opt-in can be a language/locale policy violation because users are not given a choice or warned about the expected language.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.