Back to skill

Security audit

Apiclaw Analysis

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Amazon research integration, but it needs Review because it stores API keys in plaintext and includes nationality-based seller profiling guidance.

Review this skill before installing if you are comfortable sending Amazon research queries to APIClaw. Prefer APICLAW_API_KEY as an environment variable and do not give the agent an API key to save automatically. Avoid using the Chinese seller workflow for decisions based on nationality or inferred origin.

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:29
Finding
Plaintext API Key Persistence Without File Permission Protection<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:29-35` **Vulnerability Type**: Plaintext credential storage **Risk Level**: Medium ### Vulnerable Code ```markdown 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). ``` The corresponding credential-loading logic appears at `scripts/apiclaw.py:78-85`: ```python 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 ``` `SECURITY.md:31` states that `config.json` is listed in `.gitignore`, but the audited project directory contains no `.gitignore`. ### Technical Analysis The Skill instructs the agent to persist a user-provided API key in a plaintext JSON file in the project root. It does not require explicit confirmation immediately before persistence, create the file with restrictive permissions, verify existing file permissions, or provide secure secret-storage integration. Although the executable only reads this fallback file, an agent following `SKILL.md` is expected to create it. A file created using ordinary defaults may inherit a permissive process umask and become readable by other local users or processes. Storing it in the project root also increases exposure through source-control commits, workspace synchronization, backups, archives, and project sharing. The documented `.gitignore` protection is not present in the audited package, so the stated mitigation does not apply to this artifact. ### Attack Path 1. A user provides an `APICLAW_API_KEY` to the agent. 2. Following `SKILL.md`, the agent writes the key to `config.json` ...[truncated 974 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the instruction to automatically save user-provided keys. 2. Prefer environment-only credential resolution through `APICLAW_API_KEY`. 3. Require explicit user consent immediately before any persistent credential storage. 4. If file-based storage remains necessary: - Create the file atomically with mode `0600`. - Reject or warn about group-readable or world-readable permissions. - Store the credential outside the project tree in a dedicated user configuration directory. - Use an operating-system keychain or secret manager where available. 5. Include a `.gitignore` containing `/config.json` in the distributed package. 6. Add startup checks that warn if `config.json` is tracked by Git or has unsafe permissions. 7. Document credential revocation and rotation procedures. 8. Avoid printing the key in logs, error messages, command histories, or generated reports. ]]>

T08 · Insecure Dependencies

Warning
Location
README.md:39
Finding
Unpinned Third-Party CLI Execution During Installation<![CDATA[ ## Vulnerability Details **File Location**: `README.md:39` **Vulnerability Type**: Unpinned package execution and supply-chain exposure **Risk Level**: Medium ### Vulnerable Code ```bash npx clawhub install Amazon-analysis-skill ``` ### Technical Analysis The documented installation command invokes `npx` without pinning the `clawhub` package to a reviewed version or integrity value. `npx` can retrieve and execute package content resolved from the configured npm registry at installation time. Because the resolved package is mutable and is not tied to an immutable version, commit, or cryptographic digest, future users may execute code that differs from the code reviewed in this audit. Compromise of the package publisher, registry account, dependency chain, or name resolution could therefore turn the installation step into an arbitrary code-execution channel. This issue concerns the installation instructions rather than the audited `scripts/apiclaw.py`. No malicious dependency or remote payload was found in the current project artifact. ### Attack Path 1. An attacker compromises the publishing account, package, or dependency chain used by the unpinned `clawhub` CLI. 2. The attacker publishes a malicious version under the package name resolved by `npx`. 3. A user follows the README and runs the unpinned installation command. 4. `npx` downloads and executes the current package content. 5. Malicious installation code runs with the privileges of the user who invoked the command. 6. The malicious package may access files, environment variables, credentials, or agent workspace data available to that user. ### Impact Assessment A successful supply-chain compromise could execute arbitrary code with the installing user's privileges. This could expose local files, environment variables, API credentials, and agent workspace contents or modify the user's environment. The potential scope is broader than the APIClaw Skill itself because installation-time cod ...[truncated 206 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin the installer to a specific audited version, for example using an explicit `package@version` reference. 2. Publish and document the expected package name, publisher identity, version, and integrity digest. 3. Prefer installation from a signed, immutable release archive or a verified commit. 4. Use lockfiles and npm integrity metadata where the installation workflow supports them. 5. Recommend inspecting the resolved package and avoiding interactive approval of unexpected packages. 6. Document how users can verify package signatures, checksums, and release provenance. 7. Consider providing a manual installation method that copies the reviewed Skill files without executing a remotely resolved CLI. ]]>
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
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (25)

Anti-Refusal Statement

High
Category
Anti-Refusal
Content
> 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
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.

Missing User Warnings

High
Confidence
98% confidence
Finding
The skill tells the agent to store user-provided API keys in config.json but provides no meaningful user-facing warning about persistence, retention, or exposure risks. This is especially dangerous because users may assume a provided key is used only for the current task, while the skill silently creates a durable secret on disk.

Ae1

High
Category
analysis-evasion
Content
| `SKILL.md` (this file) | Start here — covers 80% of tasks |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Natural-Language Policy Violations

High
Confidence
95% confidence
Finding
The skill embeds a dedicated workflow for analyzing and ranking a nationality-based seller segment, including counting, filtering, and deriving strategy insights from 'Chinese sellers' as a class. In the context of an Amazon product-research skill, this is more dangerous because it operationalizes sensitive-group profiling as a built-in feature rather than an incidental edge case, enabling discriminatory segmentation and business decisions based on nationality.

Credential Access

High
Category
Privilege Escalation
Content
def get_api_key():
    """
    Get API key from environment variable or config file.

    Priority:
    1. Environment variable APICLAW_API_KEY
Confidence
95% confidence
Finding
The script accesses a bearer API key from the environment or a local config file and then uses it for outbound requests. In an agent skill setting, local credential harvesting and use are sensitive because they expand the trust boundary, and reading secrets from a plaintext file in the skill directory increases the chance of accidental exposure, misuse, or inclusion in shared artifacts.

Rp1

Medium
Category
MCP Rug Pull
Confidence
87% confidence
Finding
The README tells users to run `npx clawhub install Amazon-analysis-skill` without pinning a specific package version. This creates a supply-chain risk because `npx` may fetch the latest package at execution time, so a compromised or malicious upstream release could run arbitrary code on the user's machine during install.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The README instructs users to either export an API key or tell the AI agent the key so it can save it to `config.json` automatically, but it gives no warning about secret exposure, storage location, file permissions, or agent access scope. In this skill context, that is especially risky because the skill is designed for use by AI agents, increasing the chance that credentials are stored insecurely, echoed in logs, written to shared workspaces, or exposed to other tools.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill declares access to environment variables, local files, and networked API use, but does not constrain those capabilities with an explicit tool scope such as allowed-tools or permissions. That increases the attack surface because the agent may use broader-than-necessary capabilities when handling untrusted prompts or skill content.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger description includes broad catch-all phrasing such as handling 'any Amazon seller data needs,' which can cause the skill to activate for loosely related requests. Over-broad activation increases the chance of unnecessary credential use, unnecessary network calls, and the model following skill instructions in contexts the user did not intend.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
The skill explicitly instructs the agent to persist a user-provided API key into a local config.json file, even though transient in-memory use or environment-based configuration would satisfy the stated functionality. Persisting credentials to disk creates unnecessary exposure through later reads, logs, backups, workspace sharing, or cross-task leakage.

Vague Triggers

Medium
Confidence
91% confidence
Finding
The intent-routing table uses vague phrases like 'what should I sell' and 'find products,' which are common natural-language queries that may overlap with broader business, marketing, or creative advice requests. This raises the risk of the skill engaging tools and data flows without sufficiently clear user intent or scope boundaries.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The trigger phrases for comprehensive recommendations are broad enough to activate on common shopping or advice requests, increasing the chance the skill is invoked outside its intended Amazon-seller-research context. Over-broad activation expands data handling and recommendation behavior in contexts where users may not expect specialized market analysis, which can produce inappropriate or overreaching outputs.

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
This guidance explicitly directs the agent to infer seller nationality from location metadata, brand names, pinyin-style names, and naming patterns, which introduces sensitive-attribute profiling unrelated to the core product-research function. The fallback heuristics are especially risky because they encourage unreliable ethnic or nationality inference from names and linguistic patterns, which can lead to discriminatory analysis and harmful targeting.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The Chinese seller case-study trigger includes a very broad phrase ('Chinese sellers') that can activate nationality-focused analysis with minimal user specificity. Because the downstream workflow profiles a nationality-based seller segment, broad triggering makes sensitive analysis easier to invoke accidentally or opportunistically, amplifying the risk of discriminatory use.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The trigger phrase set for risk assessment includes very generic language such as 'can I do this' and 'what are the risks', which overlaps heavily with ordinary user conversation. In an agent system, this can cause the skill to activate unintentionally on unrelated prompts, pulling in product-analysis behavior and external API usage when the user did not clearly request Amazon seller analysis.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The category consumer insights trigger list contains broad phrases like 'who is buying' and 'what do users want', which are common in many non-Amazon contexts. This increases the chance of accidental skill invocation and unintended use of external analysis logic for unrelated user requests.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger phrases for listing copy generation are broad enough to match generic writing requests like 'write listing' or 'help me write product page' without strong Amazon-specific scoping. In an agent system, this can cause the skill to activate on loosely related user prompts and pull external competitive or product data unexpectedly, creating overreach and increasing the chance of irrelevant or unauthorized tool use.

Vague Triggers

Medium
Confidence
91% confidence
Finding
The diagnosis triggers such as 'optimize my listing' or 'improve my listing' are ambiguous and can apply to many non-Amazon or non-commerce contexts. Because the associated workflow initiates competitor lookups and review analysis, an overly permissive match may invoke this skill for requests outside its intended scope, leading to unnecessary external calls and unintended data processing.

External Transmission

Medium
Category
Data Exfiltration
Content
# ─── 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)
Confidence
92% confidence
Finding
This skill is explicitly designed to transmit user-supplied product research inputs and authentication credentials to a third-party service at api.apiclaw.io. In a skill context, that external data flow is security-relevant because queries, category selections, ASINs, and API usage metadata leave the local environment and are sent off-platform.

External Transmission

Medium
Category
Data Exfiltration
Content
# ─── 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)
REQUEST_TIMEOUT = 60  # Request timeout in seconds; realtime/product can be slow (up to 30s)
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
# ─── 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)
REQUEST_TIMEOUT = 60  # Request timeout in seconds; realtime/product can be slow (up to 30s)
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Session Persistence

Medium
Category
Rogue Agent
Content
print("    export APICLAW_API_KEY='hms_live_yourkey'", file=sys.stderr)
    print("", file=sys.stderr)
    print("  Method 2: Config file", file=sys.stderr)
    print(f"    Create config.json in the skill directory: {skill_dir}", file=sys.stderr)
    print('    Content: {"api_key": "hms_live_yourkey"}', file=sys.stderr)
    print("", file=sys.stderr)
    print("Get a free key at https://apiclaw.io/api-keys", file=sys.stderr)
Confidence
94% confidence
Finding
The script explicitly instructs users to persist the API key in a plaintext config.json under the skill directory, creating durable local credential storage. In shared agent/workspace environments this is dangerous because the file may be committed, copied, read by other tools, or exposed through logs, backups, or artifact packaging.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The file-level credential documentation and `get_api_key()` describe config lookup in a skill-local `config.json`, but `cmd_check()` instead looks in `~/.apiclaw/config.json`. This is an active contradiction in the skill's own documented configuration model, which can mislead operators about where secrets are read from during execution.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Content
"priceMin", "priceMax", "ratingMin", "ratingMax", "bsrMin", "bsrMax",
                 "salesGrowthRateMin", "salesGrowthRateMax", "sellerCountMin", "sellerCountMax",
                 "variantCountMin", "variantCountMax"):
        val = getattr(args, attr.replace("Min", "_min").replace("Max", "_max")
                      .replace("monthly", "monthly_").replace("review", "review_")
                      .replace("sales", "sales_").replace("Growth", "_growth_")
                      .replace("Rate", "rate_").replace("price", "price_")
Confidence
50% confidence
Finding
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Intent-Code Divergence

Low
Confidence
98% confidence
Finding
The CLI help for the `check` subcommand says it will 'Fetch latest OpenAPI spec to verify available endpoints', but `cmd_check()` never requests the OpenAPI spec or API docs. It only tests a hardcoded list of endpoints with sample API calls, so the inline documentation overstates and misdescribes the implemented behavior.

Static analysis

No suspicious patterns detected.