Back to skill

Security audit

Amazon Listing Analyzer

Security checks for vulnerabilities and agentic risk

Overview

This is an offline Amazon listing analysis skill with visible Chinese-localized output and some input-validation weakness, but no hidden data access, network calls, persistence, or destructive behavior.

Install only if Chinese-localized reports are acceptable and you are comfortable pasting listing content into an offline rule-based analyzer. Do not provide Amazon account credentials, personal information, or confidential business data beyond the listing text needed for analysis; malformed inputs may fail instead of returning a clean error.

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
handler.py:475
Finding

Malformed Input Types Cause Unhandled Exceptions and Denial of Service

Content
View full analysis

Vulnerability Details

File Location: handler.py:475-516, with vulnerable type assumptions at handler.py:226-230 and handler.py:273-290
Vulnerability Type: Improper input validation and uncaught exceptions
Risk Level: Medium

Vulnerable Code

handler.py:475-516:

python
def analyze(input_data: Dict[str, Any]) -> Dict[str, Any]:
    """
    Main analysis entry point, dispatching according to intent.
    """
    # Input length validation
    raw_str = json.dumps(input_data, ensure_ascii=False)
    if len(raw_str) > 10000:
        return {
            "status": "error",
            "module": "input_validation",
            "result": {},
            "errors": [f"Input data is too long ({len(raw_str)} characters), exceeding the 10000-character limit"],
        }

    intent = input_data.get("intent", "")

    if intent == "health_score":
        module = "health_score"
        result = {"health_score": health_score(input_data)}
    elif intent == "keyword_analysis":
        module = "keyword_analysis"
        result = {"keyword_analysis": keyword_analysis(input_data)}
    elif intent == "competitor_benchmark":
        module = "competitor_benchmark"
        result = {"competitor_benchmark": competitor_benchmark(input_data)}
    elif intent == "full_optimization":
        module = "full_optimization"
        result = {
            "health_score": health_score(input_data),
            "keyword_analysis": keyword_analysis(input_data),
            "competitor_benchmark": competitor_benchmark(input_data),
            "optimization_package": full_optimization(input_data),
        }
    else:
        # Default to health-score analysis
        module = "health_score"
        result = {"health_score": health_score(input_data)}

    return {
        "status": "success",
        "module": module,
        "result": result,
    }

Representative downstr ...[truncated 3402 chars]

Remediation
View remediation

Remediation Suggestions

  1. Validate the top-level value before calling json.dumps() or .get():

    python
    if not isinstance(input_data, dict):
        return {
            "status": "error",
            "module": "input_validation",
            "result": {},
            "errors": ["Input must be a JSON object"],
        }
    
  2. Define and enforce a strict schema:

    • intent, product_title, product_description, search_terms, backend_keywords, competitor_asin, and product_category must be strings.
    • bullet_points and product_features must be lists of strings.
    • Reject null, objects, numbers, booleans, and nested lists where strings are expected.
    • Restrict list lengths and individual string lengths in addition to the total serialized-size limit.
    • Reject unsupported intents instead of silently routing them to health scoring.
  3. Return validation failures through the documented error structure. For example:

    python
    def validation_error(message: str) -> Dict[str, Any]:
        return {
            "status": "error",
            "module": "input_validation",
            "result": {},
            "errors": [message],
        }
    
  4. Add a narrow exception boundary at the external handler interface as defense in depth. Log internal diagnostic details securely, but return a generic structured error to callers. Schema validation should remain the primary control rather than relying solely on broad exception handling.

  5. Add negative tests covering:

    • Non-dictionary top-level inputs
    • null fields
    • Numeric, boolean, object, and list substitutions
    • Mixed-type bullet_points and product_features
    • Excessive list sizes and oversized individual fields
    • Unsupported intent values
  6. If the handler is exposed through a service, also apply request-size limits, rate limiting, worker isolation, and exception monitoring at the service bo ...[truncated 7 chars]

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file’s operational description is presented in Chinese, and no section states that users may choose another language or that the skill is intentionally restricted to Chinese-language interactions. Under the language/locale policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The trigger phrases are broad, natural-language requests like '分析这个 Listing' and '给我一个 Amazon Listing 优化建议', which can easily overlap with ordinary conversation and cause accidental invocation or scope confusion. In an agent environment, ambiguous activation increases the chance that unrelated user content is interpreted as permission to run the skill on supplied text, leading to unintended processing of business-sensitive listing data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language descriptions and user-facing messages in Chinese, beginning with the module docstring stating the behavior in Chinese. Throughout the file, returned summaries, issue messages, and CLI output are also fixed to Chinese, with no opt-in or language-selection mechanism, which violates the language/locale policy criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest description is written as a Chinese-only product description for the skill and gives no indication that users may choose another language or locale. Under the policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The module docstring states '所有数据来自内置规则库和模板' ('all data comes from built-in rule libraries and templates'), which suggests outputs are derived solely from embedded data. In reality, multiple functions score and transform caller-provided fields such as product_title, bullet_points, product_description, and search terms, so the documentation is directionally inaccurate about what the analyzer operates on.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The natural-language instruction '至少3个测试用例,验证核心功能正确性。' is written in Chinese and implicitly fixes the expected language/locale for this file without any user opt-in or documented justification. Under the policy, forcing a specific language without choice is a locale/language policy concern.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.