Back to skill

Security audit

Nano Banana Pro 图片生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

This image-generation skill mostly matches its stated purpose, but it stores an API key and can send it to a caller-controlled API endpoint, so it should be reviewed before installation.

Review this skill before installing if you plan to keep an AI Hive API key on disk. Use only the default AI Hive endpoint unless you fully trust a custom endpoint, avoid setting AI_HIVE_BASE_URL with a stored key, expect selected reference images to be uploaded to the service, and consider installing dependencies in a virtual environment with pinned versions.

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:91
Finding
Stored API Key Can Be Redirected to an Untrusted Base URL## Vulnerability Details **File Location**: `scripts/imagegen.py`, lines 91–99 and 125–145 **Vulnerability Type**: Credential disclosure through an unrestricted API endpoint override **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 class AiHiveClient: """Encapsulates AI Hive OpenAPI HTTP calls.""" 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 The API key and API base URL are resolved independently. The key may be loaded from the persistent configuration file at `~/.ai-hive/config.json`, while the destination can be overridden through either the `AI_HIVE_BASE_URL` environment variable or the `--base-url` command-line argument. The client unconditionally includes the API key in the `Authorization` header for requests sent to the selected base URL. No validation enforces HTTPS, checks that the hostname is the expected AI Hive service, or requests confirmation before reusing a stored credential with a different origin. An attacker capable of influencing the process environment or command invocat ...[truncated 1517 chars]
Remediation
## Remediation Suggestions 1. Restrict authenticated requests to the expected HTTPS origin by default: - Require the `https` scheme. - Compare the normalized hostname against an explicit allowlist. - Reject URLs containing unexpected credentials, ports, or malformed hostnames. 2. If custom API endpoints are necessary, require an explicit high-friction opt-in and display the exact destination before sending credentials. 3. Bind stored credentials to their configured origin. Do not automatically send a key loaded for `ai-hive.iclip.cn` to a different hostname. 4. Prefer a separate API key argument or configuration profile for each custom endpoint. 5. Reject plain HTTP endpoints except for an explicitly enabled local-development mode, and never reuse production credentials in that mode. 6. Add automated tests confirming that environment and CLI overrides cannot redirect a stored credential without explicit authorization. 7. Document the security implications of `AI_HIVE_BASE_URL` and `--base-url`.

T08 · Insecure Dependencies

Note
Location
SKILL.md:79
Finding
Runtime Dependency Is Installed Without Version or Integrity Pinning## Vulnerability Details **File Location**: `SKILL.md`, line 79 **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Low **Vulnerable Code**: ```bash pip3 install requests ``` ### Technical Analysis The documented installation command resolves the latest available `requests` release and its transitive dependencies from the active pip package index. The project provides no reviewed version constraint, lock file, or cryptographic hash verification. Consequently, installations are not reproducible and their resulting dependency graph can change without any modification to the audited project. Risk increases when a user's pip configuration points to an untrusted mirror or additional package index. A future malicious or compromised package release could also be selected automatically. The audited command names the legitimate `requests` package and does not demonstrate active dependency confusion or typosquatting. This is therefore a supply-chain hardening weakness rather than evidence of an embedded malicious dependency. ### Attack Path 1. A user follows the installation instructions from `SKILL.md`. 2. The user's pip configuration references a compromised or attacker-controlled package index, or a package selected by the unconstrained dependency resolution becomes compromised. 3. `pip3 install requests` retrieves an unreviewed package or transitive dependency version. 4. Malicious code executes during package installation or when `imagegen.py` imports and uses the dependency. 5. The malicious package operates with the privileges of the user running pip or the Skill. ### Impact Assessment Exploitation could allow arbitrary code execution with the privileges of the installing user. Depending on those privileges, an attacker could access user files, environment variables, the AI Hive API key, generated media, and network-accessible resources. The practical likelihood is reduced when the ...[truncated 190 chars]
Remediation
## Remediation Suggestions 1. Add a reviewed dependency file containing an exact version, for example `requests==<reviewed-version>`. 2. Generate and verify cryptographic hashes, and install with `pip install --require-hashes -r requirements.txt`. 3. Lock all transitive dependencies rather than pinning only the direct dependency. 4. Install dependencies in a dedicated virtual environment instead of the user's global Python environment. 5. Document the trusted package index and discourage unverified extra indexes or mirrors. 6. Add automated dependency scanning and a controlled process for reviewing and updating locked versions.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (11)

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill invokes shell commands, installs dependencies, and calls a Python script that likely performs network, file, and environment operations, yet it declares no explicit tool or permission scope. This creates an over-privileged execution surface where the agent may use sensitive capabilities without clear restriction or user-visible consent boundaries.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The description contains broad trigger phrases covering generic image generation, editing, branding, photography, and marketing requests, which increases the chance the skill is auto-invoked for loosely related user prompts. Over-broad routing can cause unintended execution of networked and file-handling code paths, exposing user assets or causing actions the user did not specifically request.

Natural-Language Policy Violations

Medium
Confidence
78% confidence
Finding
The user-facing instructions and examples are entirely in Chinese, and the file does not indicate that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking context. This can constitute a language/locale policy issue when a specific language is effectively imposed without opt-in.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The file presents itself as a generic AI Hive client while the skill metadata advertises a narrowly scoped Nano Banana Pro image skill. This scope mismatch can mislead reviewers and downstream agents about the true capabilities exposed by the code, increasing the chance that broader functions are invoked or approved under false assumptions.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The module documentation explicitly describes a generic multi-capability tool, contradicting the expected specialized behavior of the skill. This discrepancy is dangerous because trust and approval decisions for agent skills are often made from metadata and top-of-file descriptions, so contradictory descriptions can conceal excess functionality.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
This code file contains user-facing natural-language instructions, help text, prompts, and errors in Chinese, beginning with the module docstring and continuing throughout the CLI. Because the skill does not offer an opt-in language selection or document that it is intentionally China/Chinese-specific, it effectively forces a specific language for all users.

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
The presence of text-chat functionality in an image-generation skill violates least privilege and broadens the attack surface beyond the stated purpose. In an agent setting, hidden or undocumented capabilities can be abused to process arbitrary prompts or data flows that operators did not intend to permit for this skill.

Context-Inappropriate Capability

Medium
Confidence
96% confidence
Finding
Video-generation support is unrelated to the declared Nano Banana Pro image skill and unnecessarily expands capability. In a security-sensitive agent ecosystem, this kind of capability overreach can enable unintended remote actions, larger uploads/downloads, and policy bypass through a mislabeled skill.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
This markdown file contains user-facing natural-language content entirely in Chinese, with no indication that the skill is region-specific or that users can choose another language. Under the policy rule for language or locale constraints, forcing a single language without opt-in can be a natural-language policy violation.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
The example API key value uses Chinese text ('请替换为你的APIKey') as the only user-facing instruction in this file. This imposes a specific language choice without opt-in or justification, which matches the language/locale policy violation category.

Context-Inappropriate Capability

Low
Confidence
81% confidence
Finding
Account information and model enumeration features go beyond the end-user purpose of generating/editing images. While not directly an exploit by themselves, they expose additional internal data and broaden what an agent can learn or do under the guise of a simple image skill.

Static analysis

No suspicious patterns detected.