Back to skill

Security audit

AI大模型专家|短剧悬念钩子与卡点

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed AI-HIVE media-generation helper, but it handles API keys and remote file transfers with loose endpoint controls that merit review before installation.

Review before installing. Use a dedicated, revocable AI-HIVE API key with limited funds or quota, avoid custom base URLs unless you fully trust the gateway, run in a virtual environment with pinned dependencies where possible, and only upload media you are comfortable sending to the configured service.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/imagegen.py:91
Finding

API Credentials Can Be Redirected to an Attacker-Controlled Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:91-99, 130-143; duplicated in scripts/videogen.py:91-99, 130-143
Vulnerability Type: Arbitrary 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:
    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
            )

Technical Analysis

Both scripts accept the API base URL from a command-line argument, the AI_HIVE_BASE_URL environment variable, or the local configuration file. They perform no URL-scheme validation, trusted-host verification, or origin binding between the API key and the endpoint.

The client unconditionally attaches the AI-HIVE bearer credential to every request constructed from that configurable base URL. Consequently, a malicious environment variable, command-line value, or modified ~/.ai-hive/config.json can redirect the credential to an arbitrary HTTP or HTTPS server.

HTTPS certificate verification by requests does not address this issue when the attacker controls a valid HTTPS domain. Plaint ...[truncated 1170 chars]

Remediation
View remediation

Remediation Suggestions

  • Require an https URL scheme for all credential-bearing API requests.
  • Bind AI-HIVE credentials to the exact trusted AI-HIVE hostname.
  • Reject URLs containing user information, unexpected ports, fragments, or non-HTTPS schemes.
  • If custom enterprise gateways are required, maintain an explicit administrator-controlled hostname allowlist.
  • Require separate credentials for custom gateways rather than forwarding the AI-HIVE key.
  • Display the effective credential destination and require explicit confirmation before first use of a non-default endpoint.
  • Protect the configuration directory as well as the file, and reject configuration files not owned by the current user.
  • Apply the same correction to both scripts/imagegen.py and scripts/videogen.py.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:267
Finding

Unvalidated Server-Supplied URLs Control Media Uploads and Downloads

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:267-303, 313-337, 401-414; duplicated in scripts/videogen.py:267-303, 313-337, 401-414
Vulnerability Type: Untrusted remote URL handling
Risk Level: Medium

Vulnerable Code

python
def upload_media(client, file_path):
    path = Path(file_path)
    if not path.is_file():
        raise SystemExit(f"File does not exist: {file_path}")

    filename = path.name
    content_type = guess_mime(str(path))
    size = path.stat().st_size

    token = client.create_upload_token(filename, content_type, size)

    media_id = token["mediaId"]
    upload_url = token["upload"]["url"]
    upload_method = token["upload"].get("method", "PUT")
    upload_headers = token["upload"].get("headers", {})

    with open(str(path), "rb") as f:
        try:
            oss_resp = requests.request(
                upload_method,
                upload_url,
                headers=upload_headers,
                data=f,
                timeout=300,
            )
        except requests.exceptions.RequestException as e:
            raise SystemExit(f"Upload network error: {e}")
python
def download_file(url, out_path, timeout=300):
    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)
python
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)

Technical Analysis

The ...[truncated 2136 chars]

Remediation
View remediation

Remediation Suggestions

  • Permit only HTTPS upload and download URLs.
  • Maintain an allowlist of approved API and object-storage hostnames.
  • Resolve destination hostnames and reject loopback, link-local, multicast, and private network addresses.
  • Restrict upload methods to the methods explicitly required by the protocol, normally PUT or POST.
  • Filter server-supplied headers and reject sensitive or connection-level headers.
  • Disable redirects or validate every redirect destination against the same policy.
  • Enforce maximum upload and download sizes.
  • Abort downloads that exceed the declared or configured limit, including responses without Content-Length.
  • Verify media signatures and MIME types before retaining downloaded files.
  • Write downloads to a temporary file and atomically rename them only after successful validation.
  • Apply identical controls to both generation scripts.

T08 · Insecure Dependencies

Note
Location
SKILL.md:117
Finding

Dependency Installation Is Unpinned and Not Reproducibly Verified

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:117-120
Vulnerability Type: Unpinned third-party dependency
Risk Level: Low

Vulnerable Code

bash
pip3 install requests
python3 "$SKILL_PATH/scripts/videogen.py" init \
  --skill-name ai-model-expert-drama-cliffhanger-beat

Technical Analysis

The documented setup command installs requests without a fixed version, lock file, integrity hash, isolated environment, or explicitly trusted package index. Installation therefore resolves whatever release and transitive dependencies are current at execution time.

The reviewed dependency name is legitimate and is not visibly typosquatted. No malicious package source is specified. The issue is the absence of reproducible dependency controls rather than evidence that the current package is malicious.

Attack Path

  1. A user follows the documented installation command.
  2. pip resolves the latest available requests package and its transitive dependencies from the user's configured index.
  3. A compromised index, compromised future package release, or maliciously altered local pip configuration supplies unreviewed code.
  4. Package installation executes build or installation behavior with the privileges of the invoking user.
  5. The installed code is subsequently imported by both generation scripts.

Impact Assessment

Exploitation through the dependency supply chain could execute code with the privileges of the user running pip or the Skill. This could expose local files, environment variables, API credentials, and generated media.

The practical risk is reduced because requests is a well-known package and no suspicious alternate index is documented, but the installation remains non-reproducible.

Remediation
View remediation

Remediation Suggestions

  • Add a reviewed dependency manifest with exact versions.
  • Use hash verification, such as pip install --require-hashes.
  • Pin all transitive dependencies through a generated lock file.
  • Install dependencies inside a dedicated virtual environment.
  • Document the intended package index and avoid inheriting untrusted index configuration.
  • Periodically update pinned versions after vulnerability and compatibility review.
  • Prefer a command such as python3 -m pip install -r requirements.txt --require-hashes.

other

Warning
Location
scripts/imagegen.py:664
Finding

Duplicate Entry Points Expose Undocumented Generic Operations and Break Specialized Dispatch

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:664-767, 843-844; scripts/videogen.py:664-767, 880-881
Vulnerability Type: Capability overreach and command-dispatch flaw
Risk Level: Medium

Vulnerable Code

python
def main():
    parser = build_parser()
    args = parser.parse_args()

    if args.command == "init":
        cmd_init(args)
        return

    config = Config(
        api_key=getattr(args, "api_key", None),
        base_url=getattr(args, "base_url", None),
        verbose=getattr(args, "verbose", False),
    )
    client = AiHiveClient(config)

    cmd_map = {
        "user-info": cmd_user_info,
        "models": cmd_models,
        "chat": cmd_chat,
        "image": cmd_image,
        "video": cmd_video,
        "task": cmd_task,
        "upload": cmd_upload,
    }

    handler = cmd_map.get(args.command)
    if not handler:
        parser.print_help()
        sys.exit(1)

    handler(client, args)

if __name__ == "__main__":
    main()

The same files later define and invoke a second entry point:

python
def skill_main():
    args = build_skill_parser().parse_args()
    if args.command == "init":
        cmd_init(args)
        return

    config = Config(
        api_key=getattr(args, "api_key", None),
        base_url=getattr(args, "base_url", None),
        verbose=getattr(args, "verbose", False),
    )
    client = AiHiveClient(config)

    if args.command == "generate":
        skill_generate(client, args)
    elif args.command == "task":
        cmd_task(client, args)
    elif args.command == "upload":
        cmd_upload(client, args)

if __name__ == "__main__":
    skill_main()

Technical Analysis

Each specialized wrapper contains two independently invoked command-line entry points. The first parser is a generic AI-HIVE client that exposes account information, model enumeratio ...[truncated 2063 chars]

Remediation
View remediation

Remediation Suggestions

  • Retain exactly one __main__ block in each script.
  • Remove the generic parser and generic handlers from specialized wrappers.
  • Expose only the commands required by the declared Skill: specialized generation, task lookup, upload when necessary, and initialization.
  • Move shared HTTP functionality into a non-executable library module.
  • Ensure importing the shared module cannot invoke a parser or perform network operations.
  • Add command-line tests confirming that documented commands reach the intended handler exactly once.
  • Add negative tests confirming that unsupported generic commands are rejected before any authenticated operation occurs.
  • Apply the same refactoring to both scripts/imagegen.py and scripts/videogen.py.
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 (18)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared role is a narrow short-drama planning expert, but the documented behavior includes broad AI-HIVE operations such as uploads, model listing, generic chat, image/video generation, and task polling. This mismatch is dangerous because users or orchestrators may invoke the skill under a low-risk content-planning assumption while it actually enables far broader external interactions and media-processing actions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file presents itself as a domain-specific drama/cliffhanger skill, but actually exposes a broad AI Hive client with account access, model enumeration, chat, upload, image/video generation, task polling, and result download. This capability mismatch is dangerous because users or orchestrators may grant trust, data, or permissions based on the advertised narrow purpose while the code can perform substantially broader networked actions against the user's AI Hive account.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises executable scripts with network, shell, file, and environment-variable access but does not declare any explicit tool scope or permission boundaries. That creates an over-privileged and opaque execution surface where a host agent may grant broader capabilities than users expect, increasing the risk of unintended file access, command execution, or outbound API use.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file describes the skill as activating around a cluster of user phrases such as “悬念钩子、卡点、追更点、付费点、cliffhanger,” but it does not clearly define when the skill should activate versus when those terms are merely part of ordinary discussion. Because several of these terms are common content-planning phrases, the lack of scope limits or negative examples could lead to unintended invocation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill enables implicit invocation without any visible activation constraints, narrowing rules, or user-confirmation safeguards. That can cause the agent to auto-select this skill in loosely related contexts, leading to unintended execution of its prompting workflow and possible disclosure or misuse of user project context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This Python file contains multiple hard-coded Chinese-language user-facing strings, including the module docstring, argparse description, and generated metadata fields. The skill does not offer any language choice or indicate that the locale restriction is optional or region-specific, which is a natural-language policy concern under the language/locale rule.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module documentation explicitly describes a general-purpose AI capability tool, directly contradicting the manifest's specialized drama-cliffhanger framing. This deceptive or inaccurate packaging undermines informed consent and security review because operators may approve a seemingly narrow skill that actually implements a broad remote API wrapper.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and user-facing CLI text are written entirely in Chinese, establishing a fixed interaction language. The file does not provide any opt-in, locale selection, or documented justification for restricting the interface to Chinese, which creates a language/locale policy concern.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The user-info endpoint exposes account information and wallet/balance details unrelated to the stated writing-focused purpose. In a mismatched skill, this creates unnecessary access to sensitive account metadata and can facilitate reconnaissance or privacy leakage if invoked by an agent or unsuspecting user.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

Generic model enumeration allows discovery of all available backend models and routing modes, which exceeds the declared narrow use case. This increases attack surface by enabling capability reconnaissance and can be used to pivot into other service features not expected by users of a drama-planning skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Standalone task and upload commands expose generic media workflow primitives that are not justified by the manifested purpose. These primitives let the skill act as a broader file-transfer and remote job-management wrapper, enabling operations beyond what users would reasonably expect from a cliffhanger-writing assistant.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file presents itself and operates as a generic AI-Hive utility rather than a narrowly scoped short-drama/cliffhanger skill. That mismatch expands the skill's effective privileges and reachable behaviors, increasing the chance that an agent or user can invoke unrelated capabilities such as account inspection, model discovery, chat, and raw media operations that are outside the declared purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language descriptions entirely in Chinese, including the module docstring and user-facing setup guidance, with no indication that another language is supported or that Chinese is required for a region-specific reason. Under the policy, forcing a specific language 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

Exposing a user-info endpoint in a creative-content skill allows retrieval of account and wallet data unrelated to the stated purpose. In an agent setting, this creates unnecessary data exposure and capability creep, and may leak sensitive billing or account metadata to downstream components or logs.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The generic text chat capability lets callers send arbitrary prompts to any configured text model, which is outside the declared short-drama video/cliffhanger generation role. In an agent ecosystem this broadens the skill into a general-purpose model proxy, undermining policy boundaries and enabling unintended data processing or prompt exfiltration through an overprivileged interface.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The metadata sets the language to zh-CN, and the document content is entirely presented in Chinese, but there is no indication that users can choose another language or opt into this locale restriction. Under the policy, forcing a specific language without user choice can be a natural-language policy concern unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The example API key value uses Chinese placeholder text ('请替换为你的APIKey'), which imposes a specific language in user-facing configuration content. There is no indication that the skill offers a language choice or that this locale constraint is documented as region-specific and justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The file-level docstring and parser description state this is a '通用 AI 能力调用工具', while the embedded SKILL_CONFIG and manifest context position it as a specific short-drama video/cliffhanger skill. This documentation steers users toward a general-purpose tool identity rather than the declared specialized intent.

Content

No source excerpt is available for this finding.