Back to skill

Security audit

Prompt Optimizer

Security checks for vulnerabilities and agentic risk

Overview

This prompt helper does not show exfiltration or destructive behavior, but it persistently stores potentially sensitive prompts locally and can activate very broadly, so users should review it before installing.

Install only if you are comfortable with the skill keeping local prompt history and saved prompts on disk. Avoid using it with secrets, credentials, private business data, or regulated personal information unless you first confirm local file permissions and know how to clear the stored history.

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
SKILL.md:35
Finding
Potentially Sensitive Prompts Stored in Plaintext Without Explicit Access Controls## Vulnerability Details **File Location**: `SKILL.md:35-59`, `SKILL.md:65-69`, and `SKILL.md:972-975` **Vulnerability Type**: Insecure storage of potentially sensitive user data **Risk Level**: Medium ### Vulnerable Code ```markdown On first message, create data directory: ```bash mkdir -p ~/.openclaw/prompt-optimizer ``` Initialize files: ```json // ~/.openclaw/prompt-optimizer/settings.json { "default_model": "any", "prompts_optimized": 0, "templates_used": 0, "prompts_saved": 0, "streak_days": 0 } ``` ```json // ~/.openclaw/prompt-optimizer/library.json [] ``` ```json // ~/.openclaw/prompt-optimizer/history.json [] ``` ``` ```markdown All data stored under `~/.openclaw/prompt-optimizer/`: - `settings.json` — stats and preferences - `library.json` — saved prompt library - `history.json` — optimization history ``` ```markdown 1. Never expose raw JSON 2. Keep all data LOCAL 3. Maximum 200 saved prompts, 500 history entries 4. Prompts may contain sensitive info — never share externally ``` ### Technical Analysis The Skill directs the agent to persist saved prompts and optimization history as JSON files under the user's home directory. It explicitly recognizes that prompts may contain sensitive information, but it does not prescribe restrictive permissions for the directory or files, encryption at rest, user consent before history collection, secret detection, or a defined retention and secure-deletion policy. The command `mkdir -p ~/.openclaw/prompt-optimizer` relies on the process umask to determine permissions. Likewise, the documented initialization process does not require files to be created with mode `0600`. On a host with a permissive umask or incorrectly configured home-directory access controls, other local users or processes may be able to read stored prompt content. The maximum-entry limits reduce unbounded growth but do not address confid ...[truncated 1802 chars]
Remediation
## Remediation Suggestions 1. **Enforce restrictive directory permissions** - Create the directory with mode `0700`. - Verify and repair permissions if the directory already exists. - Example: ```bash install -d -m 700 "$HOME/.openclaw/prompt-optimizer" ``` 2. **Enforce restrictive file permissions** - Create `settings.json`, `library.json`, and `history.json` with mode `0600`. - Set a restrictive umask before creating or replacing files: ```bash umask 077 ``` - Reapply permissions after atomic file replacement. 3. **Make history retention opt-in** - Do not automatically retain complete prompts by default. - Ask for explicit user consent before enabling history. - Allow saving individual prompts without enabling global history. 4. **Minimize retained content** - Store metadata or redacted summaries instead of complete prompts when possible. - Detect and warn about likely passwords, API keys, access tokens, private keys, and other secrets before saving. - Refuse to persist identified credentials unless the user explicitly overrides the warning. 5. **Add lifecycle controls** - Provide commands to clear history, delete individual records, and delete all Skill data. - Add configurable time-based expiration in addition to entry-count limits. - Document whether deletion affects backups or synchronized home directories. 6. **Protect sensitive libraries** - Consider authenticated encryption for saved prompt content. - Keep encryption keys separate from the stored JSON files and use an operating-system credential store where available. 7. **Use safe file updates** - Write updates to securely created temporary files in the same protected directory. - Flush and atomically rename them into place. - Reject symbolic-link targets and verify file ownership before reading or overwriting existing files.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (10)

Vague Triggers

High
Confidence
95% confidence
Finding
The activation description is extremely broad and includes catch-all phrasing such as 'any prompt writing and optimization task,' which can cause the skill to trigger on ordinary conversation or unrelated user requests. Over-broad invocation increases the chance the skill intercepts sensitive content or changes assistant behavior unexpectedly, even if it does not execute code or access the network.

Vague Triggers

High
Confidence
98% confidence
Finding
The command list includes 'help' as a trigger, which is a highly collision-prone phrase commonly used in normal conversation. A generic trigger like this can invoke the skill unexpectedly and override the user's intended interaction path.

Session Persistence

Medium
Category
Rogue Agent
Content
---
name: prompt-optimizer
description: When user asks to improve prompt, optimize prompt, better prompt, fix prompt, rewrite prompt, prompt engineering, make prompt better, enhance prompt, prompt template, system prompt, mega prompt, chain of thought, few shot prompt, prompt for Claude, prompt for GPT, prompt tips, why bad response, improve AI output, get better results, prompt library, save prompt, or any prompt writing and optimization task. 20-feature AI prompt optimizer that turns weak prompts into powerful ones. Works with any LLM — Claude, GPT, Gemini, Llama, Mistral. Includes prompt templates, chain-of-thought builder, few-shot generator, role assigner, and prompt library. All data stays local — NO external API calls, NO network requests, NO data sent to any server.
metadata: {"clawdbot":{"emoji":"⚡","requires":{"tools":["read","write"]}}}
---
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.

Ssd 3

Medium
Confidence
94% confidence
Finding
The skill stores prompt history and saved prompts locally, and prompts can contain sensitive information such as API keys, internal instructions, personal data, or proprietary content. Persisting this data by default in plaintext-like local files without explicit consent, minimization, redaction, or retention controls creates avoidable confidentiality risk.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The listed trigger phrases include generic terms like 'better prompt,' 'fix prompt,' 'prompt tips,' and 'why bad response,' which overlap with normal user dialogue and make invocation ambiguous. This can lead to unintended activation and capture of user-provided text into the skill workflow, especially given the skill's persistence features.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
- Ask clarifying questions before solving
- Provide step-by-step solutions
- If you cannot solve the issue, escalate politely
- Never make promises about refunds without approval
- Always end with "Is there anything else I can help
  you with?"
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Indirect Prompt Extraction

Medium
Category
System Prompt Leakage
Content
## FEATURE 16: Prompt Translator

When user says **"translate prompt"** or **"prompt in [language]"**:

```
User: "translate this prompt to Spanish"
Confidence
75% confidence
Finding
Skill contains patterns that could indirectly extract system prompts through rephrasing, translation, summarization, or side-channel techniques.

Indirect Prompt Extraction

Medium
Category
System Prompt Leakage
Content
## FEATURE 16: Prompt Translator

When user says **"translate prompt"** or **"prompt in [language]"**:

```
User: "translate this prompt to Spanish"
Confidence
75% confidence
Finding
Skill contains patterns that could indirectly extract system prompts through rephrasing, translation, summarization, or side-channel techniques.

Ssd 3

Medium
Confidence
92% confidence
Finding
The behavior rules actively encourage saving prompts even though the skill itself acknowledges prompts may contain sensitive information. This increases the likelihood that confidential user data is retained unnecessarily and later exposed through local compromise, shared accounts, backups, or accidental disclosure.

Natural-Language Policy Violations

Low
Confidence
79% confidence
Finding
The note recommends English as the generally best language for prompts, which is a language-preference statement embedded in the skill guidance. While not a hard requirement, it may steer users toward English without first asking their preference or clarifying that language choice is user-driven.

Static analysis

Detected: suspicious.prompt_injection_instructions

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
SKILL.md:553