Back to skill

Security audit

cloudflare-media

Security checks for vulnerabilities and agentic risk

Overview

This skill appears to do what it says, but it asks for broad local authority and reads credentials from general agent memory before sending user content to Cloudflare.

Review before installing. Use only a narrowly scoped Cloudflare Workers AI token, avoid storing it in MEMORY.md, and do not submit sensitive prompts, private images, or confidential text unless you are comfortable sending them to Cloudflare. The publisher should narrow the allowed tools and add an explicit confirmation or disclosure step before external requests.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:19
Finding
Overbroad access to persistent memory for plaintext API credentials<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 19–21 and 233–235 **Vulnerability Type**: Overbroad sensitive-memory access and insecure credential handling **Risk Level**: Medium ### Vulnerable Snippet The following is an English rendering of the relevant instructions: ```markdown ## Credential Configuration Preferentially read the Account ID and API Token from `skills/cloudflare-media/config.json` or MEMORY.md. If they are missing, ask the user. ``` The same behavior is repeated in the execution workflow: ```markdown ## Step 1: Check Credentials Read `skills/cloudflare-media/config.json` or MEMORY.md. If the credentials are missing, ask the user. ``` ### Technical Analysis The skill instructs the agent to search a general-purpose `MEMORY.md` file for a Cloudflare Account ID and API token. Persistent agent memory can contain unrelated credentials, personal data, prior conversation state, or operational instructions. Reading the entire memory file violates least-privilege principles because media generation only requires access to two dedicated credential values. The alternative configuration file also implies plaintext credential storage without requiring restrictive file permissions, encryption, secret-manager integration, or token redaction. Once loaded, the token may enter the agent context and could subsequently be exposed through logs, generated shell commands, tool output, prompt injection, or another compromised component. The skill declares broad `Read`, `Write`, `Edit`, `Exec`, and `Message` capabilities. Although the audited file does not explicitly misuse those tools or exfiltrate credentials, their availability increases the potential consequences of placing a broadly scoped memory file and API token into the execution context. ### Attack Path 1. A user invokes the media-generation skill. 2. The skill directs the agent to read `MEMORY.md` when locating Cloudflare credentials. 3. The entire persistent-memory cont ...[truncated 1450 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the `MEMORY.md` credential fallback entirely. General-purpose agent memory must not be used as a secret store. 2. Retrieve credentials from a dedicated secret manager, protected environment variables, or a narrowly scoped configuration interface. 3. If a local configuration file is unavoidable: - Store it outside the project and general memory directories. - Restrict permissions to the owning account, such as mode `0600`. - Exclude it from version control, backups, diagnostics, and chat context. - Never write credentials into generated files or persistent agent memory. 4. Issue a dedicated Cloudflare API token restricted to the minimum Workers AI permissions and required account only. 5. Avoid placing bearer tokens directly in command-line arguments where process listings or execution logs may expose them. Use protected headers supplied through a secure API client or secret-aware execution mechanism. 6. Redact authorization headers and tokens from tool output, error messages, telemetry, and audit logs. 7. Reduce the declared tool permissions to the minimum required. In particular, avoid granting `Edit`, unrestricted `Exec`, and general `Message` access unless each is necessary and constrained. 8. Rotate any token that has already been stored in `MEMORY.md` or an inadequately protected plaintext configuration file. ]]>
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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (17)

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger phrases include broad everyday language such as '帮我画' and '读出来', which can cause accidental activation in ordinary conversation. In this skill, accidental activation matters because it may lead to credential lookup and external transmission of user content to Cloudflare without clear intent.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill requests Exec even though its documented purpose is only to call remote media-generation APIs and return images/audio. Unnecessary command-execution capability increases the blast radius if the skill is misused or prompt-injected, enabling shell access unrelated to its function.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill does not clearly warn users that prompts, text, optional images, and authentication tokens will be used in requests to an external Cloudflare service. This undermines informed consent and can result in unexpected disclosure of sensitive user content to a third party.

External Transmission

Medium
Category
Data Exfiltration
Content
| steps | ❌ | — | 步数(参考值25)|

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/black-forest-labs/flux-2-klein-4b" \
  -H "Authorization: Bearer {TOKEN}" \
  -F "prompt=a sunset over the ocean" \
  -F "width=1024" -F "height=1024"
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
| steps | ❌ | 4 | 步数(1~8,越高越慢)|

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/black-forest-labs/flux-1-schnell" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a cyberpunk cat","steps":4}'
Confidence
90% confidence
Finding
This skill sends user-supplied prompts and bearer-authenticated requests to Cloudflare's external API, which is an intentional but security-relevant data egress path. In context this is expected functionality, yet it remains a real exposure because prompts or generated-content parameters may contain sensitive data and the transfer is not transparently disclosed at point of use.

External Transmission

Medium
Category
Data Exfiltration
Content
| steps | ❌ | 4 | 步数(1~8,越高越慢)|

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/black-forest-labs/flux-1-schnell" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a cyberpunk cat","steps":4}'
Confidence
90% confidence
Finding
This skill sends user-supplied prompts and bearer-authenticated requests to Cloudflare's external API, which is an intentional but security-relevant data egress path. In context this is expected functionality, yet it remains a real exposure because prompts or generated-content parameters may contain sensitive data and the transfer is not transparently disclosed at point of use.

External Transmission

Medium
Category
Data Exfiltration
Content
| mask / mask_b64 | ❌ | — | inpainting mask |

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/bytedance/stable-diffusion-xl-lightning" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a cyberpunk cat","num_steps":10}'
Confidence
90% confidence
Finding
The SDXL-Lightning flow transmits prompts and potentially img2img or mask data to an external provider through Cloudflare. Because image and mask inputs can contain sensitive visual data, this egress path is materially security-relevant even though it is core to the feature.

External Transmission

Medium
Category
Data Exfiltration
Content
| mask / mask_b64 | ❌ | — | inpainting mask |

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/bytedance/stable-diffusion-xl-lightning" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a cyberpunk cat","num_steps":10}'
Confidence
90% confidence
Finding
The SDXL-Lightning flow transmits prompts and potentially img2img or mask data to an external provider through Cloudflare. Because image and mask inputs can contain sensitive visual data, this egress path is materially security-relevant even though it is core to the feature.

External Transmission

Medium
Category
Data Exfiltration
Content
| mask / mask_b64 | ❌ | — | inpainting mask |

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/lykon/dreamshaper-8-lcm" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a realistic photo of a cat","num_steps":8}'
Confidence
90% confidence
Finding
The DreamShaper flow also sends user prompts and optional image/mask material to Cloudflare's API, creating a third-party disclosure path. Given the skill's broad triggers and memory-based credential lookup, accidental or unintended egress becomes more plausible in context.

External Transmission

Medium
Category
Data Exfiltration
Content
| mask / mask_b64 | ❌ | — | inpainting mask |

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/lykon/dreamshaper-8-lcm" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a realistic photo of a cat","num_steps":8}'
Confidence
90% confidence
Finding
The DreamShaper flow also sends user prompts and optional image/mask material to Cloudflare's API, creating a third-party disclosure path. Given the skill's broad triggers and memory-based credential lookup, accidental or unintended egress becomes more plausible in context.

External Transmission

Medium
Category
Data Exfiltration
Content
| bit_rate | ❌ | — | 比特率(bps)|

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/deepgram/aura-2-en" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello world","speaker":"luna"}'
Confidence
89% confidence
Finding
The TTS flow transmits arbitrary user text to an external API, which may include private, regulated, or proprietary content if users ask the agent to read sensitive material aloud. This is expected behavior for TTS, but without explicit disclosure and consent it remains a genuine confidentiality concern.

External Transmission

Medium
Category
Data Exfiltration
Content
| bit_rate | ❌ | — | 比特率(bps)|

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/deepgram/aura-2-en" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello world","speaker":"luna"}'
Confidence
89% confidence
Finding
The TTS flow transmits arbitrary user text to an external API, which may include private, regulated, or proprietary content if users ask the agent to read sensitive material aloud. This is expected behavior for TTS, but without explicit disclosure and consent it remains a genuine confidentiality concern.

External Transmission

Medium
Category
Data Exfiltration
Content
| lang | ❌ | en | 语言:en/es/fr/zh/ja/ko |

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/myshell-ai/melotts" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Hello world","lang":"en"}'
Confidence
89% confidence
Finding
The MeloTTS endpoint similarly sends user text off-platform to Cloudflare, creating external data exposure. Since the skill is designed for convenience and broad activation, users may not realize their text leaves the local environment for synthesis.

External Transmission

Medium
Category
Data Exfiltration
Content
| lang | ❌ | en | 语言:en/es/fr/zh/ja/ko |

```bash
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/myshell-ai/melotts" \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Hello world","lang":"en"}'
Confidence
89% confidence
Finding
The MeloTTS endpoint similarly sends user text off-platform to Cloudflare, creating external data exposure. Since the skill is designed for convenience and broad activation, users may not realize their text leaves the local environment for synthesis.

Natural-Language Policy Violations

Medium
Confidence
82% confidence
Finding
L276-L289 的 TTS 交互流程将“Deepgram Aura-2 英语”设为默认模型 1,并要求用户仅提供模型编号、文本和声音,未明确先询问用户语言偏好。对于文本转语音场景,默认落到英语模型可能导致在未经用户选择的情况下强制使用特定语言/locale。

Context-Inappropriate Capability

Low
Confidence
88% confidence
Finding
Write and Edit permissions are broader than necessary for a skill whose purpose is generating media via Cloudflare APIs. Excess file-modification privileges could be abused to alter unrelated workspace files, plant data, or overwrite outputs outside the intended media flow.

Context-Inappropriate Capability

Low
Confidence
92% confidence
Finding
The skill explicitly instructs reading MEMORY.md for credentials, which expands access beyond the minimum needed for media generation and can expose unrelated secrets stored in shared memory. Because MEMORY.md often contains broader agent context or other service tokens, this creates an avoidable secret-scoping and over-collection risk.

Static analysis

No suspicious patterns detected.