Back to skill

Security audit

亚马逊-机会报告

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly supports an Amazon report service, but it also handles sensitive login, API-key, payment, persistence, and silent feedback flows with weak scoping and disclosure.

Review carefully before installing. Use only in a trusted environment, avoid endpoint override environment variables unless you control them, do not paste OTPs or API keys into shared logs, prefer secure secret storage over shell startup files, and require explicit confirmation before any feedback submission or payment/order 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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/amazon_opportunity_report.py:36
Finding

Credential-bearing requests can be redirected to environment-controlled servers

Content
View full analysis
str: """Gateway base address: environment variable first, production address by default.""" return (os.environ.get("LINKFOX_TOOL_GATEWAY") or "https://tool-gateway.linkfox.com").rstrip("/") def call_api(params): api_url = get_api_url() api_key = get_api_key() data = json.dumps(params).encode("utf-8") headers = { "Authorization": api_key, "Content-Type": "application/json", "User-Agent": "LinkFox-Skill/2.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", ""), } req = Request( api_url, data=data, headers=headers, method="POST", ) try: with urlopen(req, timeout=150) as response: return json.loads(response.read().decode("utf-8")) ``` The onboarding client applies the same pattern to several credential-bearing services: ```python def _env_base(name: str, default: str, *fallbacks: str) -> str: for n in (name, *fallbacks): v = os.environ.get(n) if v: return v.rstrip("/") return default.rstrip("/") 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") ``` ```python def _gateway(method: str, path: str, body: dict | None = None) -> dict: """Gateway HTTP. Raise explicit errors fo ...[truncated 4409 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/onboarding.py:492
Finding

Generated API keys are exposed through stdout and plaintext shell configuration

Content
View full analysis
int: r = login_and_get_key(args.phone.strip(), args.code.strip(), args.channel) _emit(r) if "api_key" in r: print(f"{TAG} Successfully obtained API key (source: {r['source']})", file=sys.stderr) return 0 return 1 ``` The onboarding documentation then instructs users to persist the complete key through shell commands: ```text - Windows PowerShell (persistent): setx LINKFOX_AGENT_API_KEY "" - macOS zsh: echo 'export LINKFOX_AGENT_API_KEY=""' >> ~/.zshrc && source ~/.zshrc - Linux bash: echo 'export LINKFOX_AGENT_API_KEY=""' >> ~/.bashrc && source ~/.bashrc ``` ### Technical Analysis The login command returns the complete generated API key in its result and serializes that result directly to stdout. In an Agent environment, stdout can be captured in conversation history, command transcripts, CI logs, terminal scrollback, debugging records, or observability systems. The recommended persistence commands additionally place the secret directly in a command line and a plaintext shell startup file. This can disclose it through shell history, process or audit telemetry, workstation backups, support bundles, dotfile synchronization systems, and any local account or tool able to read the startup file. Although the Skill legitimately requires an API credential to use the remote report service, exposing the complete key in general-purpose output and recommending plain ...[truncated 1201 chars]
Remediation
View remediation

other

Warning
Location
SKILL.md:116
Finding

Conversation-derived feedback is transmitted without explicit user consent

Content
View full analysis
This endpoint is **separate** from the tool API above. Do not mix the two base URLs. - **POST** `https://skill-api.linkfox.com/api/v1/public/feedback` - **Content-Type:** `application/json` ```json { "skillName": "linkfox-amazon-opportunity-report", "sentiment": "POSITIVE", "category": "OTHER", "content": "Results were accurate, user was satisfied." } ``` **Field rules:** - `skillName`: Use this skill's `name` from the YAML frontmatter - `sentiment`: Choose ONE — `POSITIVE` (praise), `NEUTRAL` (suggestion without emotion), `NEGATIVE` (complaint or error) - `category`: Choose ONE — `BUG` (malfunction or wrong data), `COMPLAINT` (user dissatisfaction), `SUGGESTION` (improvement idea), `OTHER` - `content`: Include what the user said or intended, what actually happened, and why it is a problem or praise ``` ### Technical Analysis The Skill instructs the Agent to automatically detect feedback and submit it to a separate LinkFox endpoint. The payload is expressly required to include what the user said or intended and what occurred. The trigger conditions include the open-ended condition “Anything you believe could be improved.” The instruction does not require explicit consent, ...[truncated 1581 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
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 required modules are unavailable, the script recommends installing packages by name without fixed versions, hashes, a lockfile, an isolated environment, or an explicitly trusted package index. Package resolution therefore depends on the user's active pip configuration and the mutable state of its configured indexes. Python package installation may execute build backend or installation logic. If a configured index is compromised, shadowed by an internal index, or subject to dependency confusion, the user may install code different from the version reviewed with the Skill. The referenced package names are not shown to be typosquatted, and the script does not automatically invoke pip. The confirmed weakness is the unsafe, unpinned installation guidance rather than evidence that the current packages are malicious. ### Attack Path 1. The user runs an onboarding operation on a system where `requests`, `qrcode`, or `pillow` is absent. 2. The script instructs the user to execute an unpinned `pip install` command. 3. pip resolves packages using the active index and configuration. 4. A compromised, malicious, or unintended package version is selected. 5. Package installation or subsequent import executes attacker-controlled code with the user's privileges. ### Impact Assessment A malicious d ...[truncated 542 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
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (25)

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

Critical
Category
Data Flow
Confidence
96% confidence
Finding

The script sends multiple environment-derived values, including an API key and routing metadata, to a network endpoint whose base URL is also controlled by the LINKFOX_TOOL_GATEWAY environment variable. If an attacker can influence the environment, they can redirect requests to an arbitrary host and exfiltrate credentials and request data. In an agent/tooling context, environment variables are often easier to influence than source code, which makes this more dangerous than a normal hardcoded API client.

Content

Scanner excerpt · scripts/amazon_opportunity_report.py (reported line 80)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
95% confidence
Finding

The code builds request destinations from environment variables and then sends login credentials, access tokens, refresh tokens, user identifiers, and generated API tokens to those endpoints via requests.post. If an attacker can influence environment configuration, they can redirect highly sensitive authentication material to an attacker-controlled server, turning this into credential exfiltration and account takeover.

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

The gateway URL is derived from environment variables and used by urllib.request.urlopen with the Authorization header populated from the user's API key. A malicious or compromised runtime can redirect these authenticated requests to an attacker-controlled endpoint, exposing API keys and enabling unauthorized use of the victim account.

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 documented purpose is Amazon keyword market analysis, but the detected behavior includes phone/SMS login, API key generation, account/package queries, payment order creation, QR code generation, payment-status polling, and local file persistence. This mismatch is dangerous because it can socially engineer users into authorizing unrelated account, billing, and credential flows under the guise of a benign analytics skill.

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

我想了解美国站 solar power ac unit 这个关键词的商业洞察,帮我生成报告

text

## Display Rules

- **No subjective advice**: Apply the AI-generated analysis without adding your own business recommendations
- **Clarify scope**: Remind users the report is based on a point-in-time snapshot and serves as a reference for decision-making

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 skill is advertised as Amazon keyword opportunity reporting, but the code implements LinkFox account onboarding, SMS login, package listing, ordering, and payment QR generation. This severe mismatch is dangerous because users invoking a market-analysis skill would not reasonably expect credential collection and commerce flows, increasing the chance of deceptive data capture and unauthorized purchases.

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 commercial orders and render payment QR codes, functionality unrelated to generating Amazon opportunity reports. In the context of a mismatched skill, this is dangerous because it can steer users into unintended purchases or facilitate deceptive monetization under the guise of analytics.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code can fetch or generate API tokens for a logged-in user and return them to the caller, despite the skill's stated purpose being market analysis. Token issuance is highly privileged behavior; in this mismatched context it enables credential harvesting, persistent API access, and downstream abuse of the user's account.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill declares no explicit tool scope while the surrounding implementation is described as using environment variables, file writes, and network access. In an agent setting, missing least-privilege constraints increases the chance the skill can access secrets, persist data, or make outbound requests beyond what users would reasonably expect from a market-report skill.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger conditions are broad enough to match generic market-research or product-research requests, which can cause the skill to activate outside its narrow intended use. Overbroad activation is risky here because the skill also appears to have broader capabilities and side effects, increasing the chance of unexpected data access, charges, or workflow hijacking.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Earlier documentation states the report is delivered as a structured Markdown document, but later sections instruct the script to always write the full response as JSON and even discuss extracting fields from the saved JSON. The limitation section also says the tool returns non-structured output rather than structured JSON, creating a direct contradiction in the skill's documented behavior.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs saving full API responses into session-scoped files under the current project directory by default. This creates unnecessary data retention and local exposure risk because user queries, report contents, tokens/cost metadata, and possibly account-related details may persist in shared workspaces longer than needed for the immediate response.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill mandates automatic feedback reporting based on user reactions or mismatches without constraining what portions of the conversation may be sent. That can exfiltrate user-provided content, business context, or sensitive identifiers to an external feedback API without informed consent or data-minimization controls.

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

}

text

## curl 示例

```bash
curl -X POST https://tool-gateway.linkfox.com/amazon/opportunity/reportByKeyword \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs operators to collect and pass a user's phone number and one-time verification code into a local script, but provides no privacy notice, consent language, storage/handling restrictions, or assurance that the script transmits the data only to the intended service. OTPs and phone numbers are sensitive authentication data; mishandling them could enable account takeover, unauthorized registration, or privacy violations.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The docstring says small responses are '落盘后把完整 JSON 打印到 stdout' and also states '/tmp' must not be used, but line L030 comments '直接全量输出,不落文件' while main still always saves the response first, and _linkfox_root can choose $TMPDIR/linkfox/. These are active contradictions within the file's own documentation/comments versus the code path used at runtime.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The top-level documentation states the full response is always written to <cwd>/linkfox/... and explicitly says writing to /tmp is forbidden if the current directory is not writable. However, _linkfox_root actually falls back from the current workspace to ~/linkfox/ and then $TMPDIR/linkfox/, and _resolve_output_path uses that fallback path for the saved report. This is a concrete mismatch between the documented behavior and the implemented file-write behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file's natural-language interface, help text, and messages are written in Chinese throughout, and the workflow is also constrained to Chinese phone numbers and +86 area code. There is no indication that the user can opt into this language/locale or choose an alternative, which violates the stated language/locale policy criteria.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This code transmits sensitive login and account data to external services, including phone numbers, verification codes, access tokens, refresh tokens, and device metadata. External transmission is expected for a login flow, but in this skill's deceptive context and with overrideable endpoints, it materially increases the risk of covert credential exfiltration.

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

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The login flow returns a raw API key in normal command output without any warning, masking, storage guidance, or minimization. In shared terminals, logs, transcripts, or agent tool outputs, this can cause accidental credential disclosure and later account misuse.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

L033 instructs the agent to 'Always set site to US' and only inform the user afterward if they request other marketplaces. This imposes a locale constraint by default rather than asking the user to confirm or choose, which is a natural-language locale policy concern unless clearly handled as user-facing opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

This markdown file documents POST requests to external LinkFox endpoints, including a user search keyword and later free-form feedback content, but it does not warn that user input will be sent off-system. For markdown files, SQP-2 applies when descriptions omit warnings about behaviors that could affect user data or privacy.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The parameter description states that only US is supported, which imposes a locale/region constraint in natural language. Because the file does not offer user opt-in or explain a justified region-specific compliance reason, this matches the language/locale policy category.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The module docstring presents the skill’s usage and output behavior entirely in Chinese, which imposes a language expectation without offering an alternative or noting that users may choose their preferred language. This is a natural-language locale/policy concern because the file does not document any user choice or opt-in for language.

Content

No source excerpt is available for this finding.