Back to skill

Security audit

Etsy 电商图片生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it says, but it handles API credentials in a way that can send them to an arbitrary configured server, so it should be reviewed before installation.

Install only if you trust the AI Hive endpoint and your local environment. Do not set --base-url or AI_HIVE_BASE_URL to an untrusted host, keep ~/.ai-hive/config.json protected, avoid uploading sensitive product/customer images unless intended, and prefer installing dependencies in an isolated environment.

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
scripts/imagegen.py:113
Finding

API Credential Disclosure Through an Unrestricted Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:63-73, scripts/imagegen.py:113-137, scripts/imagegen.py:579-580, scripts/imagegen.py:827-831
Vulnerability Type: Bearer credential exposure to a user-configurable network origin
Risk Level: Medium

Vulnerable Code

python
def _resolve_base_url(self, cli_url):
    if cli_url:
        return cli_url.rstrip("/")
    env_url = os.environ.get("AI_HIVE_BASE_URL")
    if env_url:
        return env_url.rstrip("/")
    file_config = self._read_config_file()
    if file_config.get("base_url"):
        return file_config["base_url"].rstrip("/")
    return DEFAULT_BASE_URL
python
class AiHiveClient:
    """封装 AI Hive OpenAPI HTTP 调用。"""

    def __init__(self, config):
        self.config = config
        self.base = config.base_url
        self.headers = {
            "Authorization": f"Bearer {config.api_key}",
            "Content-Type": "application/json",
        }

    def _url(self, path):
        return f"{self.base}/openapi/v1/{path}"

    def _request(self, method, url, **kwargs):
        self.config.log(f"{method} {url}")
        try:
            resp = requests.request(
                method, url, headers=self.headers, timeout=DEFAULT_TIMEOUT, **kwargs
            )
python
def add_common_args(parser):
    parser.add_argument("--api-key", help="AI Hive API Key (sk-api-*)")
    parser.add_argument("--base-url", help=f"API Base URL (默认 {DEFAULT_BASE_URL})")
    parser.add_argument("--verbose", action="store_true", help="详细日志")
python
config = Config(
    api_key=getattr(args, "api_key", None),
    base_url=getattr(args, "base_url", None),
    verbose=getattr(args, "verbose", False),
)

Technical Analysis

The API base URL can be selected through the --base-url command-line option, the AI_HIVE_BASE_URL environment variable, or the local configur ...[truncated 2514 chars]

Remediation
View remediation

Remediation Suggestions

  1. Enforce HTTPS for every API base URL and reject plaintext HTTP destinations.
  2. Restrict authenticated requests to an explicit allowlist, preferably only ai-hive.iclip.cn.
  3. If custom API endpoints are a required feature, require an explicit high-friction opt-in and display the exact destination before transmitting credentials.
  4. Do not automatically reuse the production AI Hive key for custom origins. Require a separate credential scoped to the selected origin.
  5. Normalize and validate URLs using a URL parser rather than string operations. Reject embedded credentials, unexpected ports, malformed hosts, and non-HTTP schemes.
  6. Validate redirects or disable cross-origin redirects for authenticated requests so the bearer header cannot reach another origin.
  7. Validate upload and result URL schemes and, where feasible, restrict them to approved object-storage domains.
  8. Document that environment variables and configuration files are security-sensitive inputs.
  9. After suspected exploitation, revoke and rotate the affected API key and review service activity for unauthorized use.

T08 · Insecure Dependencies

Note
Location
SKILL.md:67
Finding

Unpinned Runtime Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:67
Vulnerability Type: Mutable and non-reproducible third-party dependency installation
Risk Level: Low

Vulnerable Code

bash
pip3 install requests

Technical Analysis

The setup instructions install requests without a version constraint, lock file, or package hash. The exact package and transitive dependency versions therefore depend on package-index state at installation time.

Although requests is a legitimate dependency and no malicious package is identified in the project, this installation method does not provide reproducible or cryptographically verified dependency resolution. A future compromised release, compromised package index, unsafe index configuration, or unexpectedly incompatible transitive dependency could introduce attacker-controlled code into the Python environment.

Python package installation may execute package build logic during installation, and imported dependency code executes when scripts/imagegen.py starts. The exposure is therefore not limited to application logic after startup.

Attack Path

  1. A user follows the documented setup command.
  2. pip3 resolves requests and its transitive dependencies from the currently configured package index.
  3. Because no versions or hashes are specified, mutable package-index state determines the installed artifacts.
  4. If an index, selected release, or transitive package is compromised, malicious installation or runtime code is installed.
  5. That code executes with the privileges of the user running pip3 or the Skill.
  6. It may access data available to that account, including the AI Hive API key stored in the user profile.

Impact Assessment

Successful supply-chain compromise could execute code with the privileges of the installing or invoking user. Potential scope includes reading or modifying files available to that account, stealing API credentials, altering ...[truncated 335 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace the mutable installation command with a reviewed, pinned dependency specification.
  2. Provide a lock file or requirements file containing exact direct and transitive versions.
  3. Use hash verification, such as pip install --require-hashes -r requirements.txt.
  4. Install dependencies in an isolated virtual environment rather than the system Python environment.
  5. Review and update pinned dependencies through a controlled process with vulnerability scanning and automated tests.
  6. Document the expected package index and warn against untrusted mirrors or additional package indexes.
  7. Avoid running dependency installation as root or through sudo.
Vulnerability Patterns
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (9)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file contains substantive skill documentation in Chinese, including feature descriptions and operational notes, but does not provide an alternative language option or indicate that the locale is user-selectable. Under the policy for natural-language violations, forcing a specific language without user opt-in can be a locale-policy issue.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill invokes shell commands, installs packages, performs networked task execution, and reads/writes files, but it does not declare any explicit tool scope or permission boundaries. That creates an authorization gap where an agent may grant broader execution than a user expects, increasing the risk of unintended command execution, filesystem access, or external data transfer.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest description lists many general use cases in both English and Chinese, but it does not define specific trigger phrases, scope limits, or negative examples for when the skill should not activate. This ambiguity could cause unintended invocation for common ecommerce-image requests that only partially match the listed scenarios.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

Most instructional content and headings are written only in Chinese, while the file does not state that the skill is region-specific or provide an opt-in language choice. This can violate language/locale policy expectations when users have not requested Chinese output.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file implements a broad general-purpose AI client with text chat, model listing, user-info retrieval, media upload, and video generation, while the declared skill is narrowly for Etsy image generation/editing. This scope mismatch increases attack surface and enables capabilities unrelated to the advertised function, creating opportunities for unauthorized data access, unintended billing actions, or policy bypass through hidden features.

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 docstring and user-facing guidance are written entirely in Chinese, and the script's prompts, errors, and CLI help continue this language requirement throughout the file. There is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-only region or compliance context.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Video generation is unrelated to the stated Etsy image-generation/editing purpose, yet the client exposes full video task creation with media uploads and parameter forwarding. In skill context, this is dangerous because users and orchestrators may trust the skill as image-only while it can consume additional resources, process extra media types, and perform undisclosed operations outside expected scope.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code exposes a user-info endpoint that returns account information and wallet balance, which is unnecessary for Etsy image generation/editing. Even if not directly exfiltrating data by itself, it broadens access to sensitive account metadata and can reveal billing-related information to callers that only need image generation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

Model enumeration allows callers to discover general AI capabilities beyond the fixed Etsy image-generation workflow. In this context, that undermines scope restriction by exposing alternative model types and routing options that can be used to pivot into unsupported or higher-risk operations.

Content

No source excerpt is available for this finding.