Back to skill

Security audit

APIClaw Amazon Analysis

Security checks for vulnerabilities and agentic risk

Overview

The skill performs disclosed Amazon product research, but it should go to Review because it stores API keys in plaintext and includes weak nationality-inference workflows.

Review before installing. Prefer setting APICLAW_API_KEY as an environment variable and do not paste the key into the agent unless you intentionally want a local plaintext config.json created. If you install, verify the package/source version rather than relying on an unpinned npx command. Avoid using the Chinese-seller case-study workflow for identity inference; rely only on explicit sellerLocation data or use neutral competitor analysis instead.

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

Warning
Location
SKILL.md:23
Finding

API Key Persisted in an Unprotected Plaintext Configuration File

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 23-37
Vulnerability Type: Plaintext credential storage and unsafe secret persistence
Risk Level: Medium

Vulnerable Code Snippet

markdown
## Credentials

- Required: `APICLAW_API_KEY`
- Scope: used only for `https://api.apiclaw.io`
- Resolution order:
  1. **Environment variable** `APICLAW_API_KEY` (preferred, most secure)
  2. **Config file** `config.json` in the skill root directory (fallback)

```json
{ "api_key": "hms_live_xxxxxx" }

When user provides a Key, write it to config.json. New keys may need 3-5 seconds to activate — if first call returns 403, wait 3 seconds and retry (max 2 retries).

⚠️ Data persistence notice: When you provide an API Key, the skill saves it to config.json in the skill directory for persistent access across sessions. This file is local-only and listed in .gitignore to prevent accidental commits.

text

The corresponding credential-loading implementation is located in `scripts/apiclaw.py`, lines 70-86:

```python
key = os.environ.get("APICLAW_API_KEY", "").strip()
if key:
    return key

script_dir = os.path.dirname(os.path.abspath(__file__))
skill_dir = os.path.dirname(script_dir)
config_path = os.path.join(skill_dir, "config.json")
if os.path.exists(config_path):
    try:
        with open(config_path, "r", encoding="utf-8") as f:
            config = json.load(f)
            key = config.get("api_key", "").strip()
            if key:
                return key
    except (json.JSONDecodeError, IOError) as e:
        print(f"WARNING: Failed to read config file: {e}", file=sys.stderr)

Technical Analysis

The Skill explicitly directs the agent to write user-provided API keys into config.json in plaintext. No file-permission requirement, encryption, operating-system credential-store integration, or automatic deletion mechanism is specifie ...[truncated 2584 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the instruction that automatically writes user-provided credentials into the Skill directory.

  2. Use APICLAW_API_KEY as the default and preferred credential source without creating a file.

  3. If persistent storage is essential, use an operating-system credential store or a platform-provided secret manager.

  4. If file-based storage must remain:

    • require explicit informed user consent before persistence;
    • store the file outside the project or repository tree;
    • create it atomically with owner-only permissions, such as mode 0600 on POSIX systems;
    • reject files owned by another user or files with unsafe permissions;
    • document rotation and deletion procedures;
    • avoid displaying the key in commands, logs, exceptions, or generated output.
  5. Include an actual .gitignore containing at least:

    gitignore
    config.json
    *.key
    .env
    

    This should be treated only as defense in depth, not as the primary secret-protection mechanism.

  6. Add secret scanning to CI and release workflows to detect hms_live_ tokens and other credential patterns.

  7. Provide a command to delete stored credentials and advise users to rotate any key that may have entered version control or backups.

T08 · Insecure Dependencies

Note
Location
README.md:35
Finding

Unpinned npx-Based Installation Exposes Users to Mutable Supply-Chain Code

Content
View full analysis

Vulnerability Details

File Location: README.md, lines 35-41
Vulnerability Type: Unpinned executable package and Skill installation
Risk Level: Low

Vulnerable Code Snippet

markdown
## Installation

### Option 1: ClawHub (recommended for OpenClaw users)

```bash
npx clawhub install Amazon-analysis-skill
text

### Technical Analysis

The recommended installation command invokes `clawhub` through `npx` without pinning a specific installer version or verifying an artifact digest or signature. Depending on the local npm environment, `npx` may download and execute the currently published package version. The effective installer code can therefore change after this Skill version has been audited.

The requested Skill is also identified only by a mutable name. The instructions do not require a fixed Skill version, cryptographic checksum, provenance attestation, or signature validation. A compromised registry account, installer package, ClawHub account, or upstream release could cause future users to receive code different from the audited artifact.

This is a supply-chain hardening weakness rather than evidence that the current `clawhub` package or current Skill artifact is malicious.

### Attack Path

1. An attacker compromises a publishing account, registry entry, installer release process, or the mutable Skill distribution entry.
2. The attacker publishes a malicious version under the expected package or Skill name.
3. A user follows the documented unpinned `npx clawhub install Amazon-analysis-skill` command.
4. `npx` retrieves and executes the current installer package, or the installer retrieves the current mutable Skill release.
5. The malicious installer or Skill executes with the permissions of the invoking user.
6. It can read files accessible to that user, modify the OpenClaw workspace, steal environment credentials, or install additional malicious components.

### 
...[truncated 538 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin the clawhub installer to a reviewed, exact version rather than relying on the latest mutable release.
  2. Pin the installed Skill to an immutable version or content digest where the platform supports it.
  3. Publish SHA-256 checksums or signed provenance for release artifacts and instruct users to verify them before loading the Skill.
  4. Use npm lockfiles and integrity metadata when distributing the installer through npm.
  5. Prefer a non-executing download-and-verify workflow over immediately executing remotely retrieved installer code.
  6. Document the expected publisher identity, package name, version, artifact digest, and official distribution URL.
  7. Recommend installation as an unprivileged user and explicitly warn against running the command with sudo or administrative privileges.
  8. Add release signing and protected publishing controls, including multifactor authentication and narrowly scoped publishing tokens.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (32)

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
70% confidence
Finding

Skill instructs the agent to never refuse or to always comply. Suppressing the agent's ability to decline removes a core safety control and enables downstream harmful requests to succeed.

Content

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

md
> AI-powered Amazon product research. From market discovery to daily operations.
>
> **Language rule**: Always respond in the user's language. If the user asks in Chinese, reply in Chinese. If in English, reply in English. The language of this skill document does not affect output language.
> All API calls go through `scripts/apiclaw.py` — one script, 5 endpoints, built-in error handling.

## Credentials

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `SKILL.md` (this file) | Start here — covers 80% of tasks |

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill hard-codes a workflow centered on a specific nationality, including counting, ranking, and extracting 'success strategies' for that group. In the context of an Amazon product-research skill, this is not a necessary capability and materially increases the risk of discriminatory profiling, unfair targeting, and policy or compliance violations.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/apiclaw.py (reported line 63)May include surrounding context.

python
def get_api_key():
    """
    Get API key from environment variable or config file.

    Priority:
    1. Environment variable APICLAW_API_KEY

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding

The README instructs users to run npx clawhub install Amazon-analysis-skill without pinning a specific package version. This creates a supply-chain risk because the latest published package will be fetched and executed at install time, so a compromised or malicious package update could run arbitrary code on the user's machine.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README tells users to give their API key to the AI agent so it can save the credential automatically to config.json, but it provides no warning about storage location, file permissions, retention, or whether the key could be exposed in logs or conversation history. In an agent-skill context, this is especially risky because secrets passed through the model or stored in plaintext config files may be unintentionally disclosed to other tools, prompts, or users.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill declares capabilities that imply environment access, file reads, and network use, but it does not constrain them with an explicit permission or allowed-tools policy. That creates an unnecessary trust gap: an agent may exercise broader runtime capabilities than the manifest communicates, making review and containment harder.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger scope includes broad catch-all language such as handling essentially any Amazon seller data need. Overbroad activation criteria can cause the skill to engage in contexts the user did not clearly intend, increasing the chance of unnecessary secret use, network calls, and data handling.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill instructs the agent to take a user-supplied API key and persist it to a local config file for reuse across sessions. Persisting secrets to disk increases the risk of credential leakage through later file access, backups, logs, workspace sharing, or unintended reuse beyond the original user interaction.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill explicitly directs persistence of a user-provided API key to local disk for future sessions. Cross-session secret retention materially raises the risk of unauthorized reuse, accidental disclosure to other tools or users, and compromise if the workspace is exposed.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The intent-routing table uses vague natural-language triggers that could match ordinary conversation without sufficient constraints. In an agent setting, ambiguous routing can lead to unneeded external requests or data processing, especially when the skill can read secrets and access the network.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list includes very generic phrases such as "help me choose" and "most suitable for me," which overlap with common everyday requests and are not narrowly scoped to product recommendation tasks. The file does not provide exclusion conditions or negative examples to clarify when this scenario should not activate.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The broad trigger phrase for the Chinese-seller scenario can invoke a sensitive nationality-focused workflow based on minimal user text. Because the triggered path contains profiling logic, overbroad activation increases the chance of generating biased or inappropriate analyses without clear necessity or user qualification.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This guidance instructs the agent to profile sellers by nationality-style indicators and city-name heuristics that are not necessary for core product research. It creates a discriminatory analysis path and encourages sensitive-attribute inference from weak signals, which can produce biased, harmful, or non-compliant outputs.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The fallback tells the agent to infer seller origin from pinyin-like names, suffixes, gibberish patterns, and category stereotypes when structured location data is missing. This is dangerous because it substitutes unreliable proxies for factual data, amplifies bias, and can lead to false accusations or discriminatory treatment in downstream recommendations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The review-insights trigger phrases include generic terms like "review insights" and especially "pain points," which are common across many unrelated domains. In an agent setting, such generic activation criteria can route normal conversation into this skill unexpectedly, increasing the chance of irrelevant tool use or unintended data access.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The risk-assessment trigger list includes very broad phrases such as "What are the risks" and "can I do this," which can match ordinary user conversation unrelated to Amazon product analysis. This can cause unintended skill activation and inappropriate use of external product-analysis workflows or data sources when the user did not intend that scope.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger phrases for competitive listing analysis are broad natural-language prompts that could match common user requests without strong scoping to Amazon seller analysis. This can cause unintended skill activation, leading the agent to fetch external product and competitor data when the user did not explicitly intend to use this capability.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Phrases like 'write listing' or 'help me write product page' are generic and may overlap with ordinary copywriting tasks outside the intended Amazon APIClaw workflow. In an agent environment, this increases the risk of over-invocation, unnecessary external API usage, and context drift into data-backed claims the user did not request.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The optimization diagnosis triggers are ambiguous and could activate on vague requests about improving a 'listing' in other marketplaces or contexts. Because this skill can initiate multiple external lookups and comparative analysis, ambiguous activation can expose unnecessary data processing and produce actions beyond user intent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The instruction 'Load when handling pricing strategy, profit estimation, or listing reference tasks' describes activation in broad, high-level terms without specific trigger phrases, scope boundaries, or exclusion conditions. Because these topics overlap with common commerce-related requests, the skill could be invoked in situations where it is not actually needed.

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/reference.md (reported line 20)May include surrounding context.

md
# ─── Configuration ───────────────────────────────────────────────────────────

BASE_URL = "https://api.apiclaw.io/openapi/v2"  # APIClaw API base URL
API_DOCS = "https://api.apiclaw.io/api-docs"   # API documentation URL
MAX_RETRIES = 2       # Maximum number of retry attempts for failed requests
RETRY_DELAY = 2       # Initial retry delay in seconds; doubles on 429 (rate limit)

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 · scripts/apiclaw.py (reported line 31)May include surrounding context.

python
# ─── Configuration ───────────────────────────────────────────────────────────

BASE_URL = "https://api.apiclaw.io/openapi/v2"  # APIClaw API base URL
API_DOCS = "https://api.apiclaw.io/api-docs"   # API documentation URL
MAX_RETRIES = 2       # Maximum number of retry attempts for failed requests
RETRY_DELAY = 2       # Initial retry delay in seconds; doubles on 429 (rate limit)

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 · scripts/apiclaw.py (reported line 32)May include surrounding context.

python
# ─── Configuration ───────────────────────────────────────────────────────────

BASE_URL = "https://api.apiclaw.io/openapi/v2"  # APIClaw API base URL
API_DOCS = "https://api.apiclaw.io/api-docs"   # API documentation URL
MAX_RETRIES = 2       # Maximum number of retry attempts for failed requests
RETRY_DELAY = 2       # Initial retry delay in seconds; doubles on 429 (rate limit)

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The get_api_key documentation states the fallback config file is 'config.json in the skill directory (next to scripts/)', and get_api_key implements that behavior. But cmd_check separately checks ~/.apiclaw/config.json, introducing a different credential source than the documented one for this script's API key handling. That creates contradictory intent between the documented configuration model and actual behavior in one command.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.