Back to skill

Security audit

TikTok Shop 电商视频生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does the advertised video-generation workflow, but it can send the user's AI Hive API key to an arbitrary configured API host without validation or warning.

Review before installing. Use only the default AI Hive endpoint or a host you fully trust, avoid setting `--base-url` or `AI_HIVE_BASE_URL` from untrusted instructions, and assume prompts and selected media files are uploaded to an external service. Rotate the API key if it may have been used with an untrusted base URL.

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

Unrestricted API Base URL Can Expose the Bearer API Key

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py, lines 71-82, 118-130, and 586-587
Vulnerability Type: User-controlled authenticated API endpoint
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
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 {DEFAULT_BASE_URL})")
    parser.add_argument("--verbose", action="store_true", help="Verbose logging")

Technical Analysis

The API base URL can be supplied through the --base-url command-line option, the AI_HIVE_BASE_URL environment variable, or the base_url property in the configuration file. The value is accepted without validating its scheme or hostname.

AiHiveClient subsequently attaches the AI Hive API key as a bearer token to every request sent through this base URL. Consequently, an attacker-controlled endpoint can receive the production credential. The implementation does not require HTTPS, restrict authenticated requ ...[truncated 1711 chars]

Remediation
View remediation

Remediation Suggestions

  1. Parse the endpoint with urllib.parse.urlparse and reject malformed URLs, embedded credentials, fragments, and non-HTTPS schemes.
  2. Allow bearer-authenticated requests only to an explicit allowlist of trusted AI Hive hostnames.
  3. If custom endpoints are a required development feature, require an explicit opt-in flag and a separately supplied credential rather than automatically reusing the production API key.
  4. Display the normalized destination hostname and require interactive confirmation before sending credentials to any non-default endpoint.
  5. Protect redirects by disabling them for authenticated API requests or validating every redirect target before forwarding the Authorization header.
  6. Treat environment and configuration values as untrusted input, applying the same validation regardless of their source.
  7. Add automated tests confirming rejection of HTTP URLs, deceptive subdomains, user-information components, alternate ports where inappropriate, and redirects to untrusted hosts.
  8. Document the custom-endpoint trust implications and advise affected users to revoke and rotate credentials if they may have used an untrusted base URL.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
Findings (10)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The natural-language content of the file is presented only in Chinese, which can constitute a language policy issue if the organization expects language neutrality or user opt-in for locale constraints. The file does not indicate that the skill is China-specific, nor does it offer an English alternative or note that the language choice is intentional and limited to a specific audience.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill invokes a Python script and explicitly instructs installation of a network-capable dependency, while the manifest declares no explicit tool restrictions or permissions. In an agent environment, this can lead to broader-than-expected access to shell, filesystem, environment variables, and network resources, increasing the blast radius if the script is misused or compromised.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file is marketed as a TikTok Shop video-generation/editing skill, but it actually ships a broad AI Hive client supporting unrelated capabilities such as text chat, image generation, model enumeration, user-info retrieval, and generic media operations. This scope mismatch expands the available attack surface and violates least-privilege expectations for a narrowly scoped skill, making it easier to repurpose the skill for unintended data access or off-purpose API use.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The module docstring and all user-facing CLI guidance are written exclusively in Chinese, and the skill presents itself as a general-purpose tool rather than a region-specific or Chinese-only skill. Under the policy, forcing a specific language or locale without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The standalone text chat capability is unrelated to a TikTok Shop video-generation/editing skill and enables arbitrary prompt forwarding to a general-purpose model. In context, this makes the skill materially more dangerous because an agent or user expecting a constrained video tool can instead use it as a broad LLM proxy, potentially sending sensitive prompts or consuming the bound API credentials for unintended purposes.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill includes general image-generation functionality outside its declared purpose, allowing it to be used as a broader media-generation client rather than a constrained TikTok Shop video tool. This increases attack surface and weakens trust boundaries by enabling off-scope API consumption and prompt/data flows that callers would not reasonably expect from the skill description.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This markdown file states that the skill automatically uploads media, polls tasks, and downloads results, which implies network transmission and local file handling. There is no accompanying warning here about potential privacy, bandwidth, or filesystem effects, so users may not be adequately informed of these safety-relevant behaviors.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The section titled 'Localize for Indonesia' instructs the skill to adapt output specifically for Indonesia and to reserve areas for approved Bahasa Indonesia captions. This is a natural-language locale constraint presented as a default workflow example without any user-choice language option or explicit justification that the skill is only for that regional market.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The example API key placeholder uses Chinese text ('请替换为你的APIKey'), which imposes a specific language in user-facing configuration content. There is no indication that the skill is region-specific or that users may choose their preferred language/locale.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

Exposing account information and model discovery is not required for the declared video-editing workflow, yet the skill provides direct access to user-info and model-listing endpoints. While not immediately exploitable on their own, these features leak environment/account metadata and facilitate reconnaissance about available backend capabilities that can support misuse of the API key.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.