Back to skill

Security audit

亚马逊-店铺FBA

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real LinkFox Amazon FBA integration, but it stores sensitive Amazon operation data in plaintext and includes under-disclosed phone login and payment flows.

Review before installing. Use only with a trusted LinkFox account and trusted environment variables, avoid entering phone numbers or SMS codes unless you intentionally want LinkFox onboarding, do not approve payment QR flows casually, and treat the local linkfox output folder as sensitive because it may contain full Amazon seller/customer operation data.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/_spapi_fba_common.py:304
Finding

Amazon FBA Requests and Responses Are Persisted in Plaintext

Content
View full analysis

Vulnerability Details

File Locations:

  • scripts/_spapi_fba_common.py:304-317
  • scripts/_fba_runner.py:128-136

Vulnerability Type: Unprotected storage of sensitive operational and customer data
Risk Level: Medium

Vulnerable Code

The operation result includes the full gateway response, query string, and request body:

python
out: dict[str, Any] = {
    "api": amazon_op,
    "developerProxy": proxy,
    "resolvedPath": path,
    "method": op["method"],
    "queryString": qs,
}
if rb is not None:
    out["requestBody"] = rb
merge_json_body(out, proxy, "payload")
return out

The complete result is then written to a plaintext JSON file:

python
def emit_result(result, slug=SLUG, inline=False):
    serialized = json.dumps(result, ensure_ascii=False, indent=2)
    ts = time.time()
    date_str = time.strftime("%Y-%m-%d", 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)

Technical Analysis

Every operation builds an output object containing the full developer-proxy response. For write operations, the object also contains the submitted requestBody; for all operations, it can contain the complete query string and parsed payload.

emit_result() unconditionally serializes this object and writes it to a local JSON file. The inline option only controls terminal output and does not disable file persistence.

Amazon FBA and multi-channel fulfillment payloads may contain recipient names, addresses, telephone numbers, seller ide ...[truncated 2238 chars]

Remediation
View remediation

Remediation Suggestions

  1. Make persistence opt-in

    • Return results to standard output by default.
    • Require an explicit option such as --save-full-response before writing complete responses.
  2. Redact sensitive data

    • Remove customer names, addresses, phone numbers, authorization values, tokens, and other sensitive fields before serialization.
    • Use an allowlist of fields that are safe to retain rather than attempting to enumerate every sensitive field.
  3. Do not persist request bodies by default

    • Remove requestBody from the result object used for logging.
    • If diagnostic retention is explicitly enabled, redact sensitive fields and warn the user before saving.
  4. Enforce restrictive permissions

    • Create output directories with mode 0700.
    • Create response files with mode 0600.
    • Verify permissions after creation on supported platforms.
  5. Implement retention controls

    • Provide a configurable expiration period.
    • Automatically remove expired response files.
    • Offer a command that securely clears retained session data.
  6. Minimize stored response content

    • Persist only status codes, operation IDs, timestamps, and non-sensitive summaries unless the user explicitly requests full retention.
    • Avoid storing duplicate copies of the raw proxy response and parsed payload.
  7. Document the storage behavior

    • Clearly disclose what is stored, where it is stored, how long it remains, and how users can disable or delete it.
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
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (65)

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

Critical
Category
Data Flow
Confidence
94% confidence
Finding

The request destination is derived from environment-controlled base URLs (LINKFOX_TOOL_GATEWAY, STORE_API_BASE_URL, SPAPI_BASE_URL) and the request includes sensitive headers such as the API key plus session metadata. If an attacker can influence the environment, they can redirect this POST to an arbitrary host and exfiltrate credentials and business data; in a skill that brokers Amazon FBA operations, that increases the sensitivity of the leaked information and reachable actions.

Content

Scanner excerpt · scripts/_spapi_fba_common.py (reported line 85)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
92% confidence
Finding

The script builds request destinations from environment variables such as LINKFOX_LOGIN_API_URL and LINKFOX_AGENT_USER_API_URL, then sends sensitive data including phone numbers, SMS codes, access tokens, refresh tokens, and derived API tokens to those endpoints. If an attacker can influence the runtime environment, they can redirect authentication traffic to attacker-controlled infrastructure and harvest credentials or tokens; this is especially dangerous because this file is an onboarding/login flow rather than the declared Amazon FBA business logic.

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

The gateway URL is also sourced from environment variables and used in urllib requests with the Authorization header populated from LINKFOX_AGENT_API_KEY. An attacker who can set LINKFOX_AGENT_API_URL or LINKFOX_TOOL_GATEWAY can exfiltrate the API key and all subsequent account, package, and order operations to a malicious server, creating credential theft and unauthorized billing risk.

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

主要不匹配点不在于代码超出 FBA 主题范围,而在于描述中的路由/边界声明与实际能力边界冲突。代码明确注册了大量 inbound/fba/2024-03-20 端点,这正是描述里说应优先交给 linkfox-amazon-store-fulfillment-inbound 的专门流程。也就是说,该技能实际不仅能处理传统 FBA/旧版 MCF,还实质覆盖了 Fulfillment Inbound v2024-03-20 的核心功能。虽然其余描述(入仓资格、库存、标签、提单、旧版 MCF 订单/退货/跟踪)与代码基本一致,但对 v2024-03-20 inbound 的定位存在实质性描述-行为不一致,因此应判定为 mismatch。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

该代码块的功能非常单一且明确:检查认证依赖技能是否已安装,并报告查找结果。这属于技能运行前的支持性依赖检测逻辑,而不是声明中描述的核心业务能力实现。由于当前提供的代码没有任何与亚马逊 FBA、库存、入仓、货件、MCF 订单等相关的 API 调用、数据处理或触发逻辑,因此就“所提供代码块实际做什么”而言,与声明用途存在明显不匹配。尽管这类脚本可能是该技能的配套组件,但单看此代码块,其实际行为与声明的主要功能 materially different,应判定为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的是一个覆盖 FBA 入仓、库存摘要、货件与旧版 MCF 的综合管理技能,并给出了对应触发场景;但提供的代码块只实现了单一的 createInventoryItem 调用。该能力既未在描述中明确列出,也不属于描述中重点强调的那些 API/流程名称。虽然它仍与 Amazon FBA 领域相关,但其主要功能与声明内容存在实质偏差,因此应判定为描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的是一个宽泛的 FBA 综合技能,但列举的触发词和能力重点集中在入仓、库存以及旧版 MCF 订单处理;没有提到 deliveryOffers 或配送报价/配送方案能力。代码实际只做一件事:调用 Amazon 的 fba/outbound/2020-07-01/deliveryOffers 接口,这是 outbound 配送相关功能,不属于所列核心触发项。更重要的是,描述明确说若涉及新版 Fulfillment Outbound 应使用另一技能,虽然该接口路径不一定就是所述 2026-07-04 新版 MCF,但它显然是 outbound 资源域,与当前技能宣称的边界存在明显张力。因此应判定为描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

虽然声明整体上是“亚马逊 FBA 综合管理”,与 FBA 领域相关,但这段代码的实际能力非常具体:查询 outbound feature inventory。声明列举了大量具体触发场景和 API(如 getItemEligibilityPreview、getInventorySummaries、createInboundPlan、createFulfillmentOrder),却没有提到 feature inventory 或 getFeatureInventory。根据评估标准,当代码执行了未声明的具体能力,或访问了与声明不一致的资源时,应判定为不匹配。这里代码并非实现所述的入仓/库存摘要/旧版 MCF 订单等能力,而是一个未被明确声明的 outbound feature inventory 查询接口,因此应视为描述与行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

该代码块非常具体:main_for('getFeatures') 对应 Amazon FBA Outbound 2020-07-01 的 getFeatures 接口,只是查询 outbound 功能特性。相比之下,声明描述的是一个覆盖 FBA 入仓、库存、货件、标签、提单以及旧版 MCF 订单等大量跨域能力的综合技能,并未明确包含 getFeatures 或 outbound features 查询。更重要的是,声明中还指出若涉及新版 Fulfillment Outbound 应使用另一个技能,说明当前技能边界并不应以 outbound 能力为主。虽然旧版 MCF/outbound 与 FBA 领域存在一定关联,但此代码的实际能力与描述的主要用途不匹配,因此应判定为描述与行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

根据代码,唯一实际功能是调用 main_for('getFulfillmentPreview'),对应 Amazon FBA Outbound 2020-07-01 的 getFulfillmentPreview。声明虽然提到“旧版 MCF 多渠道履约订单、退货和跟踪”等较宽泛的出库相关能力,但没有明确提到“履约预览/fulfillment preview”,触发词中也未包含该接口名或同义表达。由于评估标准要求在代码执行了未声明能力或主用途存在实质差异时标记不匹配,这里应视为描述未准确覆盖该实际能力。

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 52)May include surrounding context.

md
**机器可读注册表**:`scripts/_fba_endpoints.py`、`references/operations.json`

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 89)May include surrounding context.

md
**机器可读注册表**:`scripts/_fba_endpoints.py`、`references/operations.json`

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 52)May include surrounding context.

md
**机器可读注册表**:`scripts/_fba_endpoints.py`、`references/operations.json`

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
共享模块:`_spapi_fba_common.py`、`_fba_endpoints.py`、`_fba_runner.py`(非独立 CLI)。

## Display Rules

1. 先看 `developerProxy.errcode` / `httpStatus`,再看解析字段 **`payload`**
2. 202/204 可能无 body;以状态码判断成功

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, subscription purchase, and payment QR generation, but the skill is declared as an Amazon FBA management integration. This scope mismatch is dangerous because users invoking an FBA skill would not reasonably expect to be asked for phone-based platform login or payment actions, increasing the chance of credential collection and deceptive behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code can create commercial orders and render payment QR codes for LinkFox plans, which is unrelated to Amazon FBA inventory and inbound/shipping management. In a mislabeled operational skill, purchase and payment capabilities create financial abuse and social-engineering risk because a user may be induced to authorize charges under the guise of FBA support.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This section performs SMS verification, login, token exchange, team selection, and API key generation for LinkFox accounts, none of which are part of the stated FBA workflow scope. Collecting login factors and outputting fresh API credentials inside an unrelated skill materially increases the chance of credential theft, unauthorized access, and misuse of the user's LinkFox account.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill advertises executable commands using shell, network, environment variables, and file output, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, that increases the chance of over-broad execution, unintended network access, and sensitive data exposure because the runtime cannot enforce least privilege from the manifest alone.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest description is entirely framed in Chinese and instructs behavior through Chinese-language trigger and routing text, but it does not offer a language choice or state that the skill is restricted to Chinese-speaking users. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The API reference exposes Fulfillment Inbound v2024-03-20 operations even though the skill metadata explicitly says requests specifically for that inbound flow should use a different skill. This creates scope confusion: an agent may invoke newer inbound plan, packing, placement, transportation, or shipment workflows through the wrong skill, bypassing intended routing boundaries and potentially causing unintended write actions in a cross-domain fulfillment process.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation advertises broad Fulfillment Outbound 2020-07-01 capabilities, while the skill description states the skill should only handle legacy MCF scenarios and that requests for the newer Fulfillment Outbound flow should use another skill. This mismatch can cause an agent to overreach into outbound order, return, or tracking actions outside the intended scope, increasing the risk of unauthorized or mistaken fulfillment operations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest describes inventory usage primarily as querying FBA inventory, but the capabilities also include create, delete, and add inventory mutation endpoints. This mismatch can cause an agent or user to assume read-only behavior while the skill can perform write operations, increasing the risk of unauthorized or unintended inventory changes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The capability file exposes Fulfillment Inbound v2024-03-20 operations inside this skill even though the manifest explicitly says requests for that workflow should be routed to a different skill. This creates scope confusion and weakens policy boundaries, making it easier for an agent or caller to invoke higher-impact inbound planning and shipment-management actions through the wrong skill.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The instructions direct the agent to collect a user's phone number and use it in registration/login flows, but they provide no privacy notice, consent language, data-handling boundaries, or warning that the phone number and verification code will be transmitted to an external service. This creates a real privacy and social-engineering risk because users may disclose sensitive identifiers and one-time codes without understanding where they go or how they are used.

Content

No source excerpt is available for this finding.