Back to skill

Security audit

nanobanana2

Security checks for vulnerabilities and agentic risk

Overview

This image-generation skill is mostly coherent, but it handles a Gemini API key in a way users should review carefully before installing.

Install only if you are comfortable running a local Python script that contacts Google's Gemini image API and writes files in your working directory. Prefer setting GEMINI_API_KEY in a protected environment over pasting keys in chat or using --api-key, and consider pinning dependencies or running the skill in a restricted environment.

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)

T08 · Insecure Dependencies

Warning
Location
scripts/generate_image.py:2
Finding

Unpinned Runtime Dependencies Permit Unreviewed Package Updates

Content
View full analysis
=3.10" # dependencies = [ # "google-genai>=1.0.0", # "pillow>=10.0.0", # ] # /// ``` ### Technical Analysis The inline dependency metadata specifies only minimum versions for `google-genai` and `pillow`. It does not pin exact reviewed versions, reference a lockfile, or verify package hashes. When the documented `uv run` workflow resolves these dependencies, a newer package release satisfying the constraints may be installed and executed even though that release was not part of the audited project. Python package initialization and imported module code execute with the same operating-system identity and environment as the skill. This is not evidence that either current dependency is malicious. The issue is that the reviewed source does not deterministically identify the dependency code that will execute in future runs. ### Attack Path 1. An attacker compromises the package maintainer account, distribution infrastructure, or another trusted release channel for one of the named dependencies. 2. The attacker publishes a malicious version satisfying `>=1.0.0` or `>=10.0.0`. 3. A user invokes the script through the documented `uv run` command without a reviewed lockfile already constraining resolution. 4. The resolver selects and installs the compromised qualifying release. 5. Malicious package code executes when the script imports the dependency: ```python from google import genai from google.genai import types from PIL import Image as PILImage ``` 6. The dependency code runs with access to the script process's environment, filesystem permissions, network access, and Gemini credentials. ### Impact Assessment Successful exploitation could provide arbitrary Python code execution under the acc ...[truncated 519 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_image.py:66
Finding

Gemini API Key Can Be Exposed Through Command-Line Arguments

Content
View full analysis
str | None: """Get API key from argument first, then environment.""" if provided_key: return provided_key return os.environ.get("GEMINI_API_KEY") ``` The documentation instructs callers to place the key directly in the command: ```bash uv run "$HOME/.openclaw/skills/skills/nanobanana2/scripts/generate_image.py" --prompt "your image description" --filename "output-name.png" [--resolution 512|1K|2K|4K] [--aspect-ratio RATIO] [--api-key KEY] ``` It also explicitly recommends this path for a key supplied in chat: ```markdown The script checks for API key in this order: 1. `--api-key` argument (use if user provided key in chat) 2. `GEMINI_API_KEY` environment variable ``` ### Technical Analysis Command-line arguments are not an appropriate secret transport mechanism. Depending on the operating system and execution environment, arguments may be exposed through: - Process inspection interfaces and process-monitoring tools. - Shell history. - Agent execution logs and telemetry. - Job schedulers, wrappers, debugging output, or command auditing. - Retained chat content when the credential is originally supplied through a conversation. Although the script does not print the API key itself, passing it as `--api-key KEY` places the credential in the invocation command before the Python process handles it. Avoiding explicit logging inside the script the ...[truncated 1410 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • 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 (5)

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · SKILL.md (reported line 100)May include surrounding context.

md
- Prompt "A serene Japanese garden" → `2025-11-23-14-23-05-japanese-garden.png`
- Prompt "sunset over mountains" → `2025-11-23-15-30-12-sunset-mountains.png`
- Prompt "create an image of a robot" → `2025-11-23-16-45-33-robot.png`
- Unclear context → `2025-11-23-17-12-48-x9k2.png`

## Image Editing

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/generate_image.py (reported line 33)May include surrounding context.

python
def get_api_key(provided_key: str | None) -> str | None:
    """Get API key from argument first, then environment."""
    if provided_key:
        return provided_key
    return os.environ.get("GEMINI_API_KEY")

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill instructs use of environment-derived secrets (GEMINI_API_KEY) and execution of a local script, but the manifest does not declare any explicit tool scope or permissions. That creates an authorization gap: an agent may invoke code that reads sensitive environment data without a clear, reviewable declaration of that capability.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The skill references the API documentation using a hl=zh-cn locale parameter, which imposes a specific language/locale in the linked documentation. There is no indication that this locale choice is optional, user-selected, or required for a region-specific reason.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The skill explicitly directs saving files into the user's current working directory, which causes file creation as a side effect without an explicit warning or confirmation step. While expected for an image-generation skill, silent writes can still overwrite expectations, clutter project directories, or place files in sensitive workspaces.

Content

No source excerpt is available for this finding.