Back to skill

Security audit

Token Hub 成本路由中心|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill largely matches an AI-HIVE media and routing workflow, but it handles persistent API credentials and can send them to a user-configurable endpoint, so it should be reviewed before installation.

Install only if you trust this publisher and intend to use AI-HIVE. Use a limited API key, keep the base URL at the documented AI-HIVE endpoint, avoid inherited or untrusted AI_HIVE_BASE_URL values, and review generated download locations before running task polling or downloads.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/imagegen.py:94
Finding

Bearer API Key Can Be Forwarded to an Arbitrary Server

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:94-99, 128-143, 579-580; equivalent implementation in scripts/videogen.py:94-99, 128-143, 579-580
Vulnerability Type: Unrestricted credential destination
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
class AiHiveClient:
    """Encapsulates AI Hive OpenAPI HTTP requests."""

    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="Detailed logging")

Technical Analysis

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

The same client then attaches the AI-HIVE bearer credential to every reques ...[truncated 1457 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin authenticated production requests to https://ai-hive.iclip.cn/api.
  2. If custom endpoints are operationally necessary, require an explicit high-friction opt-in and display the exact credential destination before proceeding.
  3. Permit only HTTPS URLs and reject URLs containing user information, fragments, unexpected ports, or non-approved hostnames.
  4. Maintain an allowlist of trusted API hosts and validate the normalized hostname rather than using suffix-based string checks.
  5. Never reuse the production AI-HIVE credential for custom or development endpoints. Require a separate credential explicitly supplied for that endpoint.
  6. Prevent configuration files or untrusted inherited environment variables from silently overriding the credential destination.
  7. Add automated tests confirming that credentials are never transmitted to HTTP, localhost, private-network, or unapproved public destinations.
  8. Apply the same correction to both scripts/imagegen.py and scripts/videogen.py.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:312
Finding

Unvalidated API Response Fields Enable SSRF and Output-Directory Escape

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:312-333, 397-413; equivalent implementation in scripts/videogen.py:312-333, 397-413
Vulnerability Type: Server-side request forgery and path traversal
Risk Level: Medium

Vulnerable Code

python
def download_file(url, out_path, timeout=300):
    """Stream a file download while displaying progress."""
    print(f"[download] {out_path.name}")
    try:
        resp = requests.get(url, stream=True, timeout=timeout)
        resp.raise_for_status()
        total = int(resp.headers.get("content-length", 0))
        downloaded = 0
        with open(str(out_path), "wb") as f:
            for chunk in resp.iter_content(chunk_size=8192):
                if chunk:
                    f.write(chunk)
                    downloaded += len(chunk)
                    if total > 0:
                        pct = int(downloaded * 100 / total)
                        bar = "█" * (pct // 5) + "░" * (20 - pct // 5)
                        print(
                            f"\r  {bar} {pct}% "
                            f"({downloaded // 1024}KB)",
                            end="",
                            flush=True,
                        )
python
out_dir = Path(output_dir)
out_dir.mkdir(parents=True, exist_ok=True)
task_type = task.get("taskType", "task")
for i, item in enumerate(succeeded):
    result_url = item.get("resultUrl")
    if not result_url:
        continue
    ext = ".mp4" if "video" in task_type.lower() else ".png"
    filename = f"{task_type}_{task_id}_{i+1}{ext}"
    out_path = out_dir / filename
    download_file(result_url, out_path)

for item in succeeded:
    last_frame = item.get("lastFrameUrl")
    if last_frame:
        out_path = out_dir / f"{task_type}_{task_id}_lastframe.png"
        download_file(last_frame, out_path)

Technical Analysis

The task response ...[truncated 2403 chars]

Remediation
View remediation

Remediation Suggestions

  1. Allow downloads only from explicitly approved HTTPS hosts used by the AI-HIVE service and its trusted object storage.
  2. Parse URLs with a standards-compliant URL parser and reject unsupported schemes, embedded credentials, malformed hosts, and unexpected ports.
  3. Resolve destination hostnames and reject loopback, private, link-local, multicast, reserved, and unspecified addresses for both IPv4 and IPv6.
  4. Disable redirects or validate every redirect destination before following it. Revalidate after DNS resolution to reduce DNS-rebinding exposure.
  5. Generate output filenames locally from safe identifiers rather than API-controlled taskType or task IDs.
  6. If server values must be retained, remove directory components and restrict them to a conservative character set.
  7. Resolve the final output path and verify that it remains beneath the resolved output directory before opening it.
  8. Use exclusive creation or an explicit overwrite policy instead of unconditional "wb" writes.
  9. Set maximum download sizes and verify expected media content types to reduce resource-exhaustion and unexpected-content risks.
  10. Apply identical validation to normal result files and last-frame downloads in both generation scripts.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill claims to provide three routing strategies and fallback planning for high-volume teams, but the observed behavior does not implement those controls and instead emphasizes fixed AI-HIVE media invocation and auxiliary capabilities. In a cost-routing context, this is especially dangerous because users may rely on nonexistent safeguards for concurrency, cost, deadline, and failure handling, increasing operational and financial risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill claims to provide three routing strategies and fallback planning for high-volume teams, but the observed behavior does not implement those controls and instead emphasizes fixed AI-HIVE media invocation and auxiliary capabilities. In a cost-routing context, this is especially dangerous because users may rely on nonexistent safeguards for concurrency, cost, deadline, and failure handling, increasing operational and financial risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill claims to provide three routing strategies and fallback planning for high-volume teams, but the observed behavior does not implement those controls and instead emphasizes fixed AI-HIVE media invocation and auxiliary capabilities. In a cost-routing context, this is especially dangerous because users may rely on nonexistent safeguards for concurrency, cost, deadline, and failure handling, increasing operational and financial risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill claims to provide three routing strategies and fallback planning for high-volume teams, but the observed behavior does not implement those controls and instead emphasizes fixed AI-HIVE media invocation and auxiliary capabilities. In a cost-routing context, this is especially dangerous because users may rely on nonexistent safeguards for concurrency, cost, deadline, and failure handling, increasing operational and financial risk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest describes a skill for querying model configuration and price snapshots, generating routing strategies, and using AI-HIVE OpenAPI for model routing and media-generation workflows. This file instead implements a standalone local CLI for probing and editing video files with ffmpeg/ffprobe, with no model-routing, pricing, OpenAPI, or Token Hub logic at all.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest describes a skill for receiving routing requirements such as quality thresholds, concurrency, budget, deadlines, and failure tolerance, then producing cost-first/speed-first/success-first routing strategies and fallback plans. In this file, the exposed skill-specific interface only supports image generation, task polling, and media upload, with a fixed image model and no implementation of routing-center analysis or strategy delivery.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises and demonstrates operations that imply access to environment variables, local files, shell commands, and networked APIs, but it does not declare an explicit tool/permission scope. That weakens least-privilege controls and can cause the platform or reviewer to underestimate what the skill may access or trigger, especially where API keys, file paths, and ffmpeg/shell usage are involved.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The activation criteria are broader than the stated Token Hub routing purpose, extending into generic business-content and originality requests. Overbroad triggering increases the chance the skill is invoked in contexts where its capabilities, restrictions, or review assumptions do not fit, which can expose unrelated users to unnecessary file/network/tool operations or misleading outputs.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The natural-language prompt explicitly instructs the skill to produce a "production-ready Chinese workflow," which imposes a language choice regardless of the user's preference. This is a language policy concern because the file does not offer any user choice or opt-in for Chinese output.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest says the skill should query current model configuration and pricing snapshots, perform COST_FIRST/SPEED_FIRST/SUCCESS_FIRST routing, handle async polling, and download results through AI-HIVE OpenAPI. In contrast, this file only collects CLI arguments and writes a static blueprint JSON to disk, with no routing logic, API calls, pricing lookup, fallback execution, or model orchestration.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code executes external binaries via subprocess to inspect and transform local media files. For a skill whose stated purpose is AI model routing, pricing snapshot retrieval, and AI-HIVE API orchestration, local multimedia transcoding is not an obvious or declared requirement.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/edit_video.py (reported line 20)May include surrounding context.

python
def run(args: list[str]) -> None:
    print(" ".join(args))
    subprocess.run(args, check=True)


def main() -> None:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python skill embeds its top-level description and user-facing guidance entirely in Chinese, and the CLI later continues that pattern for prompts and status output. That imposes a specific language on all users without any opt-in or alternative locale handling, which matches the natural-language policy violation criteria.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
80% confidence
Finding

The manifest is scoped to Token Hub routing and AI-Hive-assisted content/material generation, but this file also includes a capability to retrieve user account information and wallet balance. That capability is not justified by the stated purpose of producing routing strategies or generation assets for the named skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The embedded skill configuration names this as an image skill for creating a commercial image for a Token Hub cost-routing center, yet the code includes broad chat, video generation, and related media-processing capabilities. Those generic capabilities are not necessary for the skill's stated purpose and make the implementation materially broader than justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The initialization flow uses Chinese-only browser instructions, validation errors, and prompts for sensitive setup steps, with no option for another language. This is a natural-language locale constraint that is not documented as region-specific or user-selectable.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest centers on building a Token Hub cost-routing center that evaluates model needs and pricing snapshots to choose among routing strategies. Although cmd_image internally fetches model metadata and pricing for a fixed image model, the skill-specific generate path does not expose or implement any decision logic based on user budget, concurrency, latency, or reliability requirements; it simply forwards to image creation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill metadata promises a narrowly scoped Token Hub cost-routing center, but the file implements a broad AI-Hive client with media generation, chat, uploads, and account operations. This scope mismatch is dangerous because it can cause users or orchestrators to grant trust, permissions, or usage expectations to a skill that actually performs materially broader actions than advertised.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code file contains user-facing natural-language text exclusively in Chinese in the module docstring and throughout the CLI UX, establishing a single-language interaction model. The policy requires avoiding forced language or locale unless the skill offers user choice or clearly documents a justified locale restriction, which is not present here.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Including user-info and wallet balance retrieval exceeds the stated purpose of a cost-routing video skill and introduces access to potentially sensitive account data. Even if not overtly exfiltrating data, this unnecessary privilege expansion increases the attack surface and can leak billing or account details through outputs, logs, or misuse by downstream agents.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The generic text chat endpoint is unrelated to the declared Token Hub cost-routing center and materially expands the skill's behavior beyond its advertised scope. Hidden general-purpose model access can be abused for unintended content generation, prompt handling, or policy bypass within environments that only approved this skill for routing/video-related tasks.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The docstring frames the script as producing a production brief for the Token Hub cost-routing center, which implies a substantive routing-oriented brief tied to the skill's operational purpose. The actual output is a minimal JSON stub with descriptive fields and status 'draft', without any production-routing analysis, pricing data, or strategy generation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The top-level docstring documents the file as a generic AI-Hive tool covering multiple AI capabilities, while the manifest presents this skill as a narrowly purposed Token Hub cost-routing center for specific routing workflows. This is not merely incomplete documentation; it describes a materially broader intent than the skill claims.

Content

No source excerpt is available for this finding.