Back to skill

Security audit

AI大模型专家|Nano Banana Pro 图片生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill fits an AI-HIVE image-generation workflow, but needs review because it can be implicitly invoked and can upload any local file path to an external service without strong input limits.

Review before installing. Only use this skill when you explicitly want AI-HIVE/Nano Banana Pro, expect prompts and selected files to be sent to AI-HIVE/object storage, and are comfortable with possible account usage or charges. Do not let an agent choose sensitive local paths for --image or upload; verify the exact file path before any upload.

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:277
Finding

Unrestricted Local File Upload to Remote Object Storage

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py, lines 277-312 and 818-819
Vulnerability Type: Arbitrary local file upload
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"Object-storage upload network error: {e}"
            )

The upload command exposes this function without restricting the selected file to an image:

python
p = sub.add_parser("upload", help="Upload an image")
p.add_argument("--file", required=True)

Technical Analysis

The image-generation Skill accepts an arbitrary path and only verifies that it refers to a regular file. It does not enforce an image extension allowlist, inspect the file signature, verify that the detected MIME type is an image, reject symbolic-link traversal, or apply a maximum file-size limit.

The associated guess_mime() behavior assigns application/octet-stream to unknown extensions rather than rejecting them. Consequently, the upload operation is not limited to the image files required by the declared functionality.

The function obtains an upload URL from AI-HIVE and then transmits the complete ...[truncated 1703 chars]

Remediation
View remediation

Remediation Suggestions

  1. Permit only the image formats supported by the selected model, using a strict extension and MIME allowlist.
  2. Inspect file signatures with a maintained image-decoding library rather than relying exclusively on filename extensions.
  3. Reject application/octet-stream and all non-image MIME types in this image-specific Skill.
  4. Resolve the canonical path and reject symbolic links or paths outside explicitly approved input directories where operationally feasible.
  5. Enforce model-derived and locally defined file-size limits before requesting an upload token.
  6. Require explicit user confirmation before uploading files outside the working directory or designated media directories.
  7. Display the canonical path, detected media type, size, and destination before transmission.
  8. Keep the generic upload primitive private and expose a validated image-only wrapper through the Skill interface.

T08 · Insecure Dependencies

Note
Location
SKILL.md:69
Finding

Unpinned Runtime Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 69-73
Vulnerability Type: Unpinned third-party dependency
Risk Level: Low

Vulnerable Code

bash
pip3 install requests

Technical Analysis

The installation instructions request the latest version of requests and its transitive dependencies at installation time. No reviewed version constraint, lock file, package hash, or isolated environment is specified.

This makes installation non-reproducible and allows future package or transitive-dependency releases to enter the execution environment without review. The audit found no evidence that requests is currently malicious; the risk arises from unrestricted future dependency resolution and supply-chain compromise.

Attack Path

  1. A user follows the documented installation command.
  2. pip queries its configured package index and resolves the latest available compatible releases.
  3. A compromised, malicious, or unexpectedly incompatible future release is selected.
  4. Package installation hooks or subsequently imported runtime code execute under the privileges of the user running pip or the Skill.
  5. Malicious dependency code could access files, environment variables, network resources, and API credentials available to that account.

This path requires compromise of the configured package source, a dependency release, or the dependency-resolution environment. No such compromise was observed in the audited project.

Impact Assessment

If the dependency chain were compromised, code could execute with the privileges of the installing or running user. This could expose the AI-HIVE API key, generated media, local files, and other resources available to that account.

The current project does not request administrator privileges, and the documented command does not use elevated installation. The practical scope therefore depends on the environment in which the user runs the command.

Remediation
View remediation

Remediation Suggestions

  1. Pin requests and its transitive dependencies to reviewed versions in a lock file.
  2. Use cryptographic hashes, such as pip's --require-hashes workflow, to verify downloaded distributions.
  3. Install dependencies in a dedicated virtual environment rather than the global Python environment.
  4. Document the trusted package index explicitly and avoid untrusted or ambiguous extra indexes.
  5. Add automated dependency vulnerability and integrity scanning.
  6. Establish a controlled update process so version changes are reviewed and tested before release.
Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (9)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill instructs users to run a local Python script that reads environment variables, writes API credentials to ~/.ai-hive/config.json, accesses local files for image upload, uses network calls to AI-HIVE, and is executed via shell, yet the manifest declares no explicit tool scope or permissions. This creates a transparency and least-privilege problem: the runtime capabilities materially exceed what the manifest communicates, increasing the risk of unintended file, credential, or network access.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest description includes many broad, generic image-generation and image-editing keywords that overlap with common user intents, making the skill likely to be invoked for requests beyond its narrow product boundary. Over-broad invocation increases the chance that users unintentionally route prompts, local files, or sensitive brand assets to this third-party-integrated skill when they expected a generic or different tool.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The applicable-user section explicitly targets users searching broad generic phrases in Chinese and English, without clear constraints tying invocation to AI-HIVE or Nano Banana Pro. In context, this matters because the skill can upload local media and submit jobs to an external service, so accidental invocation can expose user data or cause unintended charges.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The search coverage section lists a very large set of generic model names, platforms, business scenarios, and common image-editing terms, which can cause the agent to select this skill for loosely related requests. Because the skill is connected to a real external API with pricing, task submission, uploads, and downloads, misrouting is more dangerous than simple over-marketing: it can lead to data egress and unexpected billing.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest enables implicit invocation for a skill that can submit external AI-HIVE jobs, upload reference materials, poll task status, and download results, but it does not define narrow trigger conditions or user-confirmation boundaries. This increases the chance the agent will auto-select and execute the skill in broader contexts than intended, causing unintended data transfer, external API usage, cost-incurring actions, or processing of sensitive images without explicit user consent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file contains a broad generic AI-HIVE client with text chat, video generation, user-info lookup, model enumeration, and upload/download flows, while the skill is presented as a narrowly scoped Nano Banana Pro image-generation skill. This scope mismatch increases the exposed attack surface and can enable unintended capability access if a caller, wrapper, or future integration invokes the generic entrypoints or reuses the module beyond the advertised image-only purpose.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The top-level documentation says this is a '通用 AI 能力调用工具' covering text chat, image generation, video generation, model queries, media upload, and task polling. That actively conflicts with the surrounding skill identity and manifest, which present this artifact as a Nano Banana Pro image generation/editing skill rather than a general-purpose multimodal AI client.

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, prompts, and operational guidance entirely in Chinese, beginning with the module docstring and continuing throughout the CLI UX. That can violate a language/locale policy when the skill is used in broader environments because users are not given any opt-in or alternative locale.

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 placeholder uses Chinese text ('请替换为你的APIKey'), which imposes a specific language in a user-facing configuration artifact. The file does not provide an alternative language option or document a justified locale constraint, so it may violate language/locale policy expectations.

Content

No source excerpt is available for this finding.