Back to skill

Security audit

Shopee 电商视频生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly fits Shopee video creation, but an unvalidated API endpoint setting can redirect the user's AI Hive key and selected media to another server.

Review this skill before installing. Use only the default AI Hive endpoint unless you fully trust a custom deployment, and do not let another agent, environment variable, or config file set --base-url or AI_HIVE_BASE_URL to an untrusted host. Treat the API key in ~/.ai-hive/config.json as sensitive, and expect user-selected media to be uploaded for generation and results to be downloaded locally.

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/videogen.py:89
Finding

Bearer API Credentials Can Be Redirected to an Arbitrary Server

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py:89-101, scripts/videogen.py:129-145, and scripts/videogen.py:898-913
Vulnerability Type: Unrestricted service endpoint override causing credential disclosure
Risk Level: High

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
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
p.add_argument("--base-url", help=f"API Base URL (default {DEFAULT_BASE_URL})")

Technical Analysis

The Skill permits the API base URL to be replaced through the --base-url argument, the AI_HIVE_BASE_URL environment variable, or the persistent configuration file. The supplied value is accepted without validating its scheme or hostname.

The same HTTP client unconditionally attaches the AI Hive bearer credential to requests constructed from this configurable URL. Consequently, anyone who can influence the invocation arguments, environment, or configuration can cause the credential to be transmitted to a server outside the intended AI Hive trust boundary.

The issue exceeds the minimum privileges required for the declared functionality. A Sh ...[truncated 2034 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove --base-url and AI_HIVE_BASE_URL overrides from this specialized Skill unless custom deployments are an explicit requirement.
  2. Allowlist the documented origin, such as https://ai-hive.iclip.cn, and reject all other hosts.
  3. Require HTTPS and reject URLs containing user information, fragments, unexpected ports, or non-HTTP schemes.
  4. Bind credentials to an expected origin. Do not attach the bearer token when the destination origin differs from the approved API origin.
  5. Validate upload URLs returned by the service against an approved set of HTTPS object-storage domains before transmitting media.
  6. If custom endpoints must remain supported, require a separate endpoint-specific credential instead of reusing the AI Hive key.
  7. Display the destination origin and require explicit confirmation before sending credentials or media to a non-default service.
  8. Add tests confirming that hostile schemes and hosts are rejected and that credentials are never sent outside the approved origin.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:75
Finding

Unpinned Runtime Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:75 and scripts/videogen.py:7,19-23
Vulnerability Type: Unconstrained third-party dependency installation
Risk Level: Medium

Vulnerable Code

bash
pip3 install requests

The executable subsequently imports the dependency directly:

python
try:
    import requests
except ImportError:
    print("Missing dependency: requests. Run pip3 install requests", file=sys.stderr)
    sys.exit(1)

Technical Analysis

The setup documentation instructs users to install requests without specifying a reviewed version, lockfile, package hash, trusted index, or isolated environment. Dependency resolution therefore depends on the package index and configuration active at installation time.

Although requests is a legitimate and widely used package, an unconstrained installation is not reproducible. A future compromised release, compromised package index, malicious mirror, or unsafe local package-index configuration could cause installation of code that was not reviewed with this Skill.

Python package installation may execute build backend or installation-related code. The resulting package is then imported into the Skill process and obtains the same operating-system privileges as the user running the Skill.

Attack Path

  1. The user follows the documented pip3 install requests setup instruction.
  2. pip consults the user's configured package indexes and resolves an unspecified current version.
  3. A compromised index, malicious mirror, or compromised dependency release supplies attacker-controlled package content.
  4. Installation or subsequent import executes that content with the user's privileges.
  5. The malicious dependency can access data available to the process, including the AI Hive API key, prompts, selected media, and generated output.

Impact Assessment

Exploitation could result in arbitrary code execution under the ac ...[truncated 490 chars]

Remediation
View remediation

Remediation Suggestions

  1. Provide a locked dependency file containing an audited version of requests and its transitive dependencies.
  2. Use exact version constraints rather than an unconstrained package name.
  3. Supply verified hashes and install with hash checking, for example through pip install --require-hashes -r requirements.txt.
  4. Recommend installation in a dedicated virtual environment rather than the global Python environment.
  5. Use python3 -m pip to ensure installation targets the interpreter used to execute the Skill.
  6. Document the expected trusted package index and warn against untrusted mirrors or additional indexes.
  7. Add automated dependency vulnerability scanning and a controlled process for updating pinned versions.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file is presented as a Shopee video-generation/editing skill, but the implementation is a broad AI Hive API client supporting unrelated capabilities such as text chat, model enumeration, account info access, media upload, and generic image/video generation. This scope expansion violates least privilege and increases the attack surface, enabling callers to use the skill as a general-purpose API broker rather than a narrowly constrained ecommerce-video tool.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill includes executable shell commands and references a Python script that can perform network access, file I/O, environment access, and downloads, but the manifest declares no explicit tool scope or permissions. This creates an authorization gap where an agent may execute broader capabilities than a reviewer or runtime policy expects, increasing the risk of unintended file access, data exposure, or external network calls.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The client includes a user-info endpoint that retrieves account information and wallet balance, which is unrelated to Shopee video generation/editing. In a delegated-agent environment this creates unnecessary access to potentially sensitive billing/account metadata and can aid reconnaissance or unauthorized cost visibility.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill exposes generic text-chat and image-generation subcommands even though its declared purpose is Shopee product video generation/editing. In an agent setting, these extra capabilities let the skill be invoked for unintended tasks, including prompt-based data handling or arbitrary image generation, which broadens misuse paths beyond the approved business context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file contains user-facing natural-language content entirely in Chinese, but it does not indicate that the skill is region-specific or give users an option to use another language. Under the policy rule for language or locale constraints, forcing a specific language without opt-in can be a policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The example API key value includes Chinese text ("请替换为你的APIKey"), which imposes a specific language in user-facing configuration content. The policy requires avoiding forced language or locale unless the skill offers a choice or clearly documents a justified locale constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module docstring and user-facing descriptions are written only in Chinese, and the file does not indicate that users may choose another language or locale. This can conflict with a language/locale policy that requires user opt-in before forcing a specific language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The embedded SKILL_CONFIG hard-codes Chinese-language title, search terms, example, and keywords focused on a Shopee market context. While this may be business-relevant, the file does not explicitly document that the skill is region/language-specific or offer an alternative locale choice.

Content

No source excerpt is available for this finding.