Back to skill

Security audit

Cloudflare Image Generation (Free)

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently generates images with Cloudflare Workers AI and optional Ollama prompt enhancement, with no evidence of hidden persistence, deception, or credential exfiltration.

Install only if you are comfortable sending image prompts to Cloudflare Workers AI and, when enabled, to the configured Ollama server. Keep the Cloudflare token narrowly scoped, use local or trusted HTTPS Ollama endpoints, and avoid placing secrets or confidential information in prompts.

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

Warning
Location
cf-img-gen.js:96
Finding

Arbitrary Ollama Endpoint Enables SSRF and Cleartext Prompt Disclosure

Content
View full analysis
{ const bodyStr = typeof body === 'string' ? body : JSON.stringify(body); const parsedUrl = new URL(url); const isHttps = parsedUrl.protocol === 'https:'; const lib = isHttps ? https : http; const reqOptions = { hostname: parsedUrl.hostname, port: parsedUrl.port || (isHttps ? 443 : 80), path: parsedUrl.pathname + parsedUrl.search, method: options.method || 'POST', headers: { 'Content-Type': 'application/json', ...(options.headers || {}), 'Content-Length': Buffer.byteLength(bodyStr), }, }; const req = lib.request(reqOptions, (res) => { const chunks = []; res.on('data', c => chunks.push(c)); res.on('end', () => resolve({ status: res.statusCode, headers: res.headers, buffer: Buffer.concat(chunks) })); }); req.on('error', reject); req.setTimeout(options.timeout || 120000, () => req.destroy(new Error('Request timeout'))); req.write(bodyStr); req.end(); }); } ``` ```javascript async function enhancePromptOllama(prompt, ollamaOptions = {}) { const host = ollamaOptions.host || process.env.OLLAMA_HOST || OLLAMA_DEFAULT_HOST; const model = ollamaOptions.model || process.env.OLLAMA_MODEL || OLLAMA_DEFAULT_MODEL; const timeout = ollamaOptions.timeout || 30000; const systemPrompt = `You are an expert at writing detailed, vivid image generation prompts. Given a short user description, expand it into a rich, detailed prompt that will produce a high-quality AI-generated image. Focus on visual details: lighting, composition, style, mood, colors, textures, and atmosphere. Kee ...[truncated 3507 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (13)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · cf-img-gen.js (reported line 108)May include surrounding context.

js
if (response.status !== 200) {
      console.warn(`⚠️ Ollama returned HTTP ${response.status}, using original prompt`);
      return prompt;
    }

    const json = JSON.parse(response.buffer.toString());

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · cf-img-gen.js (reported line 116)May include surrounding context.

js
if (response.status !== 200) {
      console.warn(`⚠️ Ollama returned HTTP ${response.status}, using original prompt`);
      return prompt;
    }

    const json = JSON.parse(response.buffer.toString());

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · cf-img-gen.js (reported line 123)May include surrounding context.

js
if (response.status !== 200) {
      console.warn(`⚠️ Ollama returned HTTP ${response.status}, using original prompt`);
      return prompt;
    }

    const json = JSON.parse(response.buffer.toString());

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill documentation describes capabilities that access credentials from an env file and call external services, but the manifest does not declare any explicit tool scope or permissions boundaries. That increases the chance an agent invokes the skill with broader-than-expected access to local environment data or network operations without clear operator consent.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

md
---
name: cf-img-gen
description: "AI image generation via Cloudflare Workers AI (free tier, FLUX models) with optional prompt enhancement via Ollama or the primary LLM agent. Use when generating images from text prompts, creating visual assets, or when the user asks to generate/create an image. Triggers: 'generate image', 'create image', 'draw me', 'make an image', 'imagine', image generation requests. Zero cost on free tier (10K neurons/day)."
---

# CF Image Gen — Cloudflare Workers AI Image Generation

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger phrases are overly broad, including generic language like 'imagine' and 'image generation requests,' which can overlap with ordinary conversation and cause accidental activation. In an agent setting, this can lead to unintended prompt transmission to remote services, unnecessary credential use, and surprise file creation or network activity.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation explains functionality but does not prominently warn that user prompts may be sent to third-party remote services, including Cloudflare Workers AI and potentially a remote Ollama endpoint. This is a privacy and data-handling risk because users or operators may supply sensitive prompts under the assumption processing is local or agent-contained.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

Step 3: Secure the credentials file

bash
chmod 600 ~/.openclaw/workspace/ACCESS/cloudflare-workers-ai.env

Step 4: Verify it works

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

"Missing ACCESS/cloudflare-workers-ai.env"

The credentials file doesn't exist at ~/.openclaw/workspace/ACCESS/cloudflare-workers-ai.env. Create it from the example file:

bash
cp skills/cf-img-gen/cloudflare-workers-ai.env.example \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill sends user-supplied prompts to third-party services: Cloudflare Workers AI always, and optionally Ollama at a configurable host. Because the tool is designed for agent use and does not surface an explicit privacy warning or require consent before transmitting prompt text, users may unknowingly disclose sensitive data in prompts to external systems.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file states that the skill sends text prompts to the Cloudflare Workers AI REST API and saves generated images as local JPEG files. For markdown files, SQP-2 applies when the description omits warnings about behaviors affecting user data, privacy, or system integrity, and this entry describes both remote transmission and local writes without an explicit caution.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

SQP-3 covers natural-language language or locale policy violations across all file types. The statement that prompt enhancement is 'English-only' presents a language restriction with no opt-in, fallback choice, or documented justification such as a region-specific requirement.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The help text includes an example using a specific LAN IP address for Ollama, which encourages routing prompt data to another machine on the network. This is not inherently unsafe, but as natural-language guidance it normalizes a network/locale assumption without any explicit opt-in or warning about where user data is sent.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.