Back to skill

Security audit

Nano Banana Image T8

Security checks for vulnerabilities and agentic risk

Overview

This image-generation skill is mostly purpose-aligned, but it handles API keys and network destinations in ways that could expose a user's credential or private images.

Install only if you are comfortable with this skill sending prompts and selected images to the configured Nano Banana-compatible service and storing an API key in a plaintext file under your home directory. Avoid using --base-url with untrusted endpoints, prefer temporary environment-based keys when possible, and delete or rotate the saved key if you no longer need the skill.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/test_nano_banana_2.py:62
Finding

API Key Disclosure and SSRF Through Untrusted Image Result URLs

Content
View full analysis
bytes: if "b64_json" in item and isinstance(item["b64_json"], str): return base64.b64decode(item["b64_json"]) url_value = item.get("url") if isinstance(url_value, str) and url_value: resp = client.get(url_value, timeout=60) resp.raise_for_status() return resp.content raise RuntimeError("响应中未包含 b64_json 或 url") ``` The client passed to this function is initialized with the API key as a default header: ```python with httpx.Client(headers=_build_headers(api_key), follow_redirects=True) as client: ``` The header construction is: ```python def _build_headers(api_key: str) -> dict[str, str]: return {"Authorization": f"Bearer {api_key}"} ``` ### Technical Analysis The image-generation service controls the `url` field returned in its JSON response. The script performs a GET request to that URL using the same `httpx.Client` that has the API key configured as a default `Authorization` header. No validation is performed on the URL scheme, hostname, resolved IP address, port, or redirect destination. Consequently, a compromised or malicious API response can direct the client to: - An attacker-controlled HTTPS endpoint, potentially receiving the bearer credential. - Loopback or private-network services. - Link-local cloud metadata services. - Unexpected non-image resources. - Redirect chains whose destinations have not been independently validated. The request also downloads the complete response into memory without enforcing an explicit size limit. This creates an additional resource-exhaustion risk if the destinatio ...[truncated 1584 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/test_nano_banana_2.py:278
Finding

User-Controlled API Base URL Can Receive Credentials and Private User Content

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/test_nano_banana_2.py:178
Finding

API Key Persisted as Plaintext in the User Profile

Content
View full analysis
None: _KEY_FILE.parent.mkdir(parents=True, exist_ok=True) _KEY_FILE.write_text(api_key.strip(), encoding="utf-8") if sys.platform != "win32": os.chmod(_KEY_FILE, 0o600) ``` The interactive credential path saves the entered key: ```python entered = getpass.getpass("请输入 API Key(输入过程不可见): ").strip() if not entered: raise SystemExit( "缺少 API key,请通过 --api-key / 环境变量 NANO_BANANA_API_KEY / 交互输入提供" ) _save_api_key(entered) print(f"API Key 已保存到: {_KEY_FILE}") return entered ``` The configured destination is: ```python _KEY_FILE = Path.home() / ".whaleclaw" / "credentials" / "nano_banana_api_key.txt" ``` `SKILL.md:36` also configures persistent storage: ```yaml saved_file: "~/.whaleclaw/credentials/nano_banana_api_key.txt" ``` The instructions at `SKILL.md:73-74` explicitly state that the key is stored and reused in later sessions. ### Technical Analysis Persistent plaintext storage is not required for a single image-generation operation. Although Unix-like systems apply mode `0600` after writing the file, this protection has limitations: - The key remains recoverable by any process running as the same user. - Host compromise, user-profile backups, support bundles, or accidental file copying can expose it. - On Windows, the code applies no explicit access-control hardening. - The file is written before `chmod()` executes, which can create a short exposure window depending on the process umask and filesystem behavior. - The implementation does not use atomic exclusive creation or protect against a pre-existing symbolic link. - There is no documented key deletion, expiration, rotation, or opt-out workflo ...[truncated 1850 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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 (10)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly allows persisting the user's API key to disk and silently reusing it later, but the user-facing flow does not require clear informed consent at the moment of storage or reuse. This creates credential-retention risk, especially because the skill is also broadly triggerable and performs shell/network actions, so a user may unintentionally seed long-lived secrets into the environment.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill invokes shell execution and networked scripts but does not declare a restrictive tool scope such as explicit allowed tools or permissions. That increases the blast radius if the skill is triggered unexpectedly or later modified, because the runtime may permit broader file, environment, or shell access than users expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list includes broad phrases like '文生图', '图生图', and generic testing phrases that can overlap with ordinary user requests. Because this skill can run shell commands, use credentials, save API keys, and contact an external service, overbroad activation materially increases the chance of unintended execution in unrelated conversations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

In image-to-image mode, the code opens user-supplied image files and sends them to the remote endpoint via an HTTP POST request. While the operation is part of the feature, the code does not explicitly disclose at the point of execution that local image contents will be transmitted off the system.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script is a test utility, but it persists an API key to a fixed file under the user's home directory and reuses it automatically in later runs. Storing long-lived credentials beyond the immediate test increases exposure if the workstation, home directory, backups, or adjacent processes are compromised, and this is not strictly necessary for one-off image generation testing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

When a user enters an API key interactively, the script immediately saves it locally without obtaining explicit consent or warning that the credential will be written to disk. Even with restrictive file permissions on non-Windows systems, silent plaintext persistence can surprise users and unnecessarily broaden the secret's lifetime and exposure surface.

Content

No source excerpt is available for this finding.