Back to skill

Security audit

amazon-monitor亚马逊商品监控

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its Amazon monitoring purpose, but its file-writing behavior is under-scoped and ASIN inputs can influence output paths, so it needs review before installation.

Install only if you are comfortable with Amazon scraping and local files being created. Run it in a limited workspace or virtual environment, use only valid 10-character ASINs, avoid untrusted ASIN input, and prefer a patched version that validates ASINs, writes to a dedicated data directory, and pins dependencies.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/amazon_monitor_core.py:108
Finding

Unvalidated ASIN Allows Arbitrary Filesystem Path Writes

Content
View full analysis
2 else None if not asin: print("错误: 请提供ASIN,例如: scrape B0XXXXXXX 10001") return zip_code = sys.argv[3] if len(sys.argv) > 3 else '10001' ``` ### Technical Analysis The `asin` parameter is expected to be a ten-character Amazon identifier, but the application does not enforce that format. Instead, it directly interpolates the supplied value into filesystem paths. Because absolute paths and directory traversal components are accepted, a malicious value can redirect history or chart output outside the intended working directory. For ...[truncated 2360 chars]
Remediation
View remediation
str: normalized = asin.strip().upper() if not ASIN_PATTERN.fullmatch(normalized): raise ValueError("ASIN must contain exactly 10 uppercase letters or digits") return normalized ``` 2. Store generated artifacts under a dedicated application data directory rather than the current working directory: ```python from pathlib import Path DATA_DIR = Path.home() / ".amazon-monitor" / "data" DATA_DIR.mkdir(mode=0o700, parents=True, exist_ok=True) ``` 3. Resolve and verify every generated path before opening it: ```python def safe_output_path(filename: str) -> Path: base = DATA_DIR.resolve() destination = (base / filename).resolve() if destination.parent != base: raise ValueError("Output path escapes the data directory") return destination ``` 4. Use only the validated ASIN when generating filenames: ```python safe_asin = validate_asin(asin) json_file = safe_output_path(f"{safe_asin}_history.json") chart_file = safe_output_path(f"{safe_asin}_trend_chart.png") ``` 5. Protect against symbolic-link attacks where local multi-user threat models apply. Use restrictive directory permissions, reject existing symlinks, and consider operating-system APIs supporting no-follow behavior. 6. Write JSON state atomically through a temporary file created inside the dedicated directory, then replace the destination. This reduces corruption risk if the process terminates during a write. 7. Apply the same validation to `scrape`, `monitor`, `run`, `compare`, scheduler operations, and standalone script entry points so invalid identifiers are rejected before any network or filesystem operation. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:38
Finding

Unpinned Third-Party Dependencies Produce a Mutable Installation Supply Chain

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The documented behavior overclaims analysis features while underdisclosing actual side effects like local persistence and chart/report generation. Description-behavior mismatches are dangerous because users and enforcement layers may authorize the skill for a limited purpose while it performs additional actions, reducing transparency and informed consent.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill documents local file persistence (<ASIN>_history.json, reports, charts, task config) but does not declare any tool scope such as file read/write permissions. Undeclared capabilities weaken least-privilege controls and can mislead users or the hosting agent about what side effects the skill has, especially because it stores monitoring history automatically.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill automatically saves collected product data and monitoring task information to local files, but this is not clearly warned in the main description or at invocation time. Silent persistence can surprise users, leave residual business intelligence on disk, and increase exposure if the host environment is shared or later compromised.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Broad trigger phrases like 'amazon monitor', 'competitor analysis', or 'price tracking' can match ordinary conversation and cause unintended skill activation. In an agent environment, ambiguous activation increases the chance of unexpected browsing, scraping, or file-writing actions without the user deliberately invoking this 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 browser context is explicitly configured with locale 'en-US' and Accept-Language headers set to U.S. English. This is a natural-language/locale policy concern because the skill imposes a specific language and locale on all users without opt-in or explanation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module description, command help, prompts, and status messages are written in Chinese throughout the file, which imposes a specific language on users without offering a choice. This is a natural-language policy concern because the skill does not provide locale selection or document that it is intentionally limited to a Chinese-speaking context.

Content

No source excerpt is available for this finding.

Tainted flow: 'report_file' from input (line 243, user input) → open (file write)

Medium
Category
Data Flow
Confidence
96% confidence
Finding

The output filename is built directly from the user-controlled ASIN value and then passed to open() for writing. An attacker can supply path traversal sequences or absolute/relative path fragments instead of a valid ASIN, causing the program to overwrite arbitrary files writable by the current user rather than only creating a report in the intended location.

Content

Scanner excerpt · scripts/amazon_main.py (reported line 244)May include surrounding context.

python
# 保存报告
        report_file = f"competitor_analysis_{my_asin}.txt"
        with open(report_file, 'w', encoding='utf-8') as f:
            f.write(report)
        print(f"\n报告已保存: {report_file}")

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code file contains user-facing natural-language descriptions and CLI messages entirely in Chinese, beginning with the module description. Under the policy rule, forcing a specific language without user opt-in is a locale/language policy violation when no alternative or selection mechanism is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The document is bilingual overall, but some example interactions are presented with Chinese-first prompts and assistant actions, without explicitly stating that users may choose their preferred language. This can create a mild language-policy concern if the skill defaults behavior or examples toward one locale without opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The inline comment labels the scraped value as 'estimated sales' (预估销量), creating the expectation that sales estimation is part of the collected competitor details. However, the value is never returned in the result object and is not used in the downstream report, so the documentation of intent contradicts the implemented behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest describes Amazon product monitoring features such as tracking, analysis, comparison, and recommendations. This script also persists the generated report to a local text file, which is a behavioral expansion beyond pure monitoring/analysis as described at the manifest level. While related to the workflow, it is still a write side effect not stated in the skill description.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This code writes a competitor analysis report to a local text file, which is a file-creation operation affecting the user's filesystem. Although the save is implicit in the compare workflow, there is no comment, docstring note, or pre-write disclosure near this behavior to warn the user that a file will be created.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The browser context is hard-coded to use locale='en-US' and Accept-Language: en-US,en;q=0.9, which forces English/US localization regardless of user preference. This is a natural-language/locale policy concern because the skill does not offer a language or locale choice or document a justified regional constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and all user-facing CLI output are written only in Chinese, which imposes a specific language on users without any opt-in or indication that the skill is intended solely for a Chinese-language audience. Under the policy, forcing a language or locale without user choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.