Back to skill

Security audit

Nano Banana Prompting Skill

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for image generation, but its documented shell command passes user-shaped prompt text in a way that could let a malicious prompt become a local command.

Install only if you are comfortable with the agent invoking a local image-generation command and using GEMINI_API_KEY. Before use, prefer an implementation that passes prompt JSON as a separate process argument or file/stdin, checks output filenames for collisions, and confirms non-default output paths.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:24
Finding
Shell Command Injection Through Unsafe Prompt Interpolation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 24–27; repeated in the editing workflow at lines 468–472 **Vulnerability Type**: Shell command injection **Risk Level**: High ### Vulnerable Code ```bash uv run {nano-banana-pro-dir}/scripts/generate_image.py \ --prompt '<YOUR_JSON_PROMPT>' \ --filename "<descriptive-name>.png" \ --resolution 2K ``` The editing workflow repeats the same unsafe interpolation pattern: ```bash uv run {nano-banana-pro-dir}/scripts/generate_image.py \ --prompt '<JSON_PROMPT>' \ --filename "edited-output.png" \ -i "/path/to/original.png" \ --resolution 2K ``` ### Technical Analysis The Skill instructs the Agent to incorporate content derived from the user's image request into a JSON prompt and then insert that prompt directly into a single-quoted shell argument. Single quotes only protect the argument until another single quote is encountered. If user-controlled content contains an apostrophe followed by shell syntax, it can terminate the quoted argument and introduce an additional command. For example, malicious text conceptually shaped like the following could escape the prompt argument when copied into the generated JSON: ```text '; attacker-controlled-command; # ``` The exact payload depends on how the Agent constructs and submits the command, but the underlying issue is that data and shell syntax are combined in one command string without context-aware escaping. Although `SKILL.md` explicitly requires filename sanitization, it provides no equivalent protection for the more directly user-controlled `--prompt` value. The same concern applies to dynamically substituted generator, input-image, and output paths if they are interpolated into a shell command rather than supplied as separate process arguments. ### Attack Path 1. An attacker submits an image-generation or editing request containing a single quote and shell control operators. 2. The Agent incorporates the attacker-controlled ...[truncated 1558 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Do not construct a shell command by string interpolation.** Invoke the generator with an argument array so the prompt is passed as one literal process argument: ```python subprocess.run( [ "uv", "run", generator_path, "--prompt", json_prompt, "--filename", safe_filename, "--resolution", "2K", ], check=True, shell=False, ) ``` 2. **Prefer a prompt file or standard input for large JSON values.** Write the JSON to a securely created file with restrictive permissions and pass a file path to the generator, or update the generator to accept the prompt through standard input. Avoid predictable temporary filenames. 3. **If a shell is unavoidable, use a proven quoting mechanism.** Apply shell escaping to every dynamic argument rather than adding quotes manually. The preferred remediation remains avoiding the shell entirely. 4. **Validate all dynamic paths.** - Resolve the generator path from a trusted Skill installation directory. - Generate output filenames from a strict allowlist such as letters, digits, hyphens, and a fixed image extension. - Treat reference-image and user-selected output paths as data, not shell syntax. - Use path normalization and enforce intended directory boundaries where applicable. 5. **Update both documented workflows.** Correct the generation example at lines 24–27 and the editing example at lines 468–472 so Agents are not instructed to execute unsafe command templates. 6. **Add adversarial tests.** Verify safe handling of prompts containing apostrophes, quotes, semicolons, command substitutions, newlines, backticks, and shell redirection characters. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Skill Enumeration

Medium
Category
Agent Snooping
Content
### Claude Code

```bash
mkdir -p .claude/skills
cd .claude/skills
git clone https://github.com/minilozio/nano-banana-prompting-skill.git
```
Confidence
85% confidence
Finding
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The README instructs users to interact with the agent using very broad natural-language phrases like 'Generate a photo...' and 'Draw me...'. In an agentic environment, such generic triggers can cause the skill to activate during ordinary conversation or be invoked unintentionally by third-party content, increasing the risk of prompt-routing mistakes and unintended model/tool use.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill explicitly directs the agent to save generated files to the user's Desktop or another specified path, but it does not require user confirmation before creating or overwriting files. In an agent setting, this can cause unintended file writes, clutter, or overwriting of existing files if filename collisions occur, especially when the path is user-specified.

Static analysis

No suspicious patterns detected.