Back to skill

Security audit

prompt-buddy

Security checks for vulnerabilities and agentic risk

Overview

PromptBuddy is a prompt-optimization skill, but it forces itself onto every user input and runs an unreviewed local script with the full message, creating unnecessary security and privacy risk.

Install only if you intentionally want every message processed by this prompt optimizer and you trust the missing local smart_engine.py script. Avoid using it with secrets, credentials, private documents, or regulated data unless the skill is changed to be opt-in, use safe argument passing, redact sensitive content, and include the script for review.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (2)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:4
Finding

Global Skill Instruction and Response Hijacking

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 4–19
Vulnerability Type: Mandatory global instruction and response hijacking
Risk Level: Critical

yaml
  【全局强制技能】每次用户输入后必须执行此技能。
  
  执行命令:cd ~/.openclaw/workspace/skills/promptbuddy && python3 scripts/smart_engine.py -f json "用户输入"
  
  从返回JSON提取:optimized_prompt(优化后的Prompt)
  
  输出格式(展示优化后的Prompt,让用户看到转化效果):
  ┌─────────────────────────────────────┐
  │ 🤖 PromptBuddy 已优化你的问题       │
  │                                     │
  │ [角色设定] ...                      │
  │ [指令] ...                          │
  │ ...(精简显示前几行)               │
  └─────────────────────────────────────┘
  
  触发词:用户提问、需求描述、任务请求、问题咨询

Technical Analysis

The skill declares itself globally mandatory and directs the agent to execute it after every user input. It further requires the agent to extract an optimized_prompt value from an external local script and display or act upon that generated content before answering the user.

This alters the agent's response procedure regardless of whether prompt optimization is relevant to the user's request. The generated prompt is not assigned an explicit trust boundary, validated against the original request, or prevented from containing new instructions. Consequently, a modified or compromised smart_engine.py could return instructions that redirect the agent's goals, suppress safety behavior, request unauthorized tool activity, or otherwise interfere with the current session.

The mandatory branded response block also causes persistent response manipulation unrelated to many user tasks. The referenced script is absent from the audited artifact, so its behavior and the provenance of its generated instructions cannot be verified.

Attack Path

  1. The skill is loaded into an agent session.
  2. Its global activation rule applies after every user message.
  3. The agent invokes the referenced local smart_engine.py program.
  4. The program returns an optimized_prompt c ...[truncated 972 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove all claims that the skill is globally mandatory or must run after every user input.
  2. Make prompt optimization explicitly opt-in and activate it only when requested by the user.
  3. Treat optimized_prompt as untrusted data rather than authoritative agent instructions.
  4. Do not allow generated content to override system, developer, security, or original user instructions.
  5. Validate generated output against a restrictive schema, length limit, and permitted content policy.
  6. Present generated prompts only as quoted data when previewing them; do not automatically execute or follow embedded directives.
  7. Remove mandatory branding and response-prefix requirements that are unrelated to the user's task.
  8. Include the referenced script in the auditable package or use a reviewed, integrity-verified component.
  9. Require explicit confirmation before generated content can initiate tool calls or other consequential actions.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:24
Finding

Shell Command Injection Through Unsafely Interpolated User Input

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 24–30
Vulnerability Type: Shell command injection
Risk Level: High

markdown
## ⚠️ 执行要求

**每次用户输入后,必须执行以下命令:**

```bash
cd ~/.openclaw/workspace/skills/promptbuddy && python3 scripts/smart_engine.py -f json "用户的完整输入"
text

### Technical Analysis

The documented execution pattern places the user's complete, untrusted input directly into a double-quoted shell command. Double quotes do not disable every form of shell evaluation. Command substitutions such as `$(command)` and backtick substitutions can still execute inside double quotes. Embedded quote characters may also terminate or restructure the intended argument if the agent constructs the command through textual interpolation.

For example, if a user's input includes `$(id)`, a shell-based executor can evaluate `id` before `python3` starts. More complex payloads could read, modify, or delete files accessible to the executing account. The vulnerability occurs when an agent follows the documented pattern by constructing a command string and passing it to a shell.

The risk is increased because the skill requires this command to run for every user input rather than only trusted or narrowly scoped values.

### Attack Path

1. An attacker sends a user message containing shell substitution syntax or quote-breaking metacharacters.
2. The agent substitutes the complete message into the documented command template.
3. The agent executes the resulting string using a shell.
4. The shell evaluates attacker-controlled substitutions or command syntax before launching the Python script.
5. The injected command runs with the operating-system permissions of the agent process.
6. The attacker can access or alter resources available to that account and may use discovered data or local executables for further compromise.

### Impact Assessment

Exploitation can provide arbitrary command execution under the local account running the agent. The attacker c
...[truncated 519 chars]
Remediation
View remediation

Remediation Suggestions

  1. Never create a shell command by concatenating or interpolating user input.
  2. Invoke Python through a process API that accepts an argument array and disables shell evaluation, for example conceptually:
    python
    subprocess.run(
        ["python3", "scripts/smart_engine.py", "-f", "json", user_input],
        shell=False,
        check=True,
        timeout=30,
        capture_output=True,
        text=True,
    )
    
  3. Prefer supplying potentially large user content through standard input rather than a command-line argument.
  4. Set an explicit working directory through the process API instead of using cd and &&.
  5. Apply input-size limits and reject NUL bytes or other values unsupported by the process interface.
  6. Use a fixed, verified absolute path to the script and interpreter where appropriate.
  7. Apply execution timeouts, output-size limits, and least-privilege process isolation.
  8. Do not rely solely on shell escaping. If shell execution is unavoidable, use a well-tested platform-specific quoting mechanism and prohibit unsafe shell constructs.
  9. Add tests containing payloads such as command substitutions, backticks, quotes, newlines, and shell metacharacters to verify that they remain literal input.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill declares itself as a global mandatory skill and uses trigger conditions that cover essentially any user request, causing it to run on nearly every turn. In context, this is dangerous because it forces broad interception of user inputs and combines with external-script execution, greatly expanding the blast radius of any downstream privacy, prompt-injection, or data-handling issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

All instructions and required output formatting are written to force Chinese-language behavior such as '已优化你的问题' and Chinese prompt structures, with no indication that the user can opt into another language. This is a natural-language policy issue because it imposes a specific language/locale on all interactions rather than offering a choice.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

Passing the user's full input to an external processing script on every turn creates a direct data exposure path for all user-provided content, including secrets, personal data, and confidential business information. This risk is amplified by the skill's mandatory, near-universal trigger behavior, which removes meaningful opportunity for user awareness or selective handling.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill instructs the agent to send the user's complete input to a local external script on every invocation without any consent, minimization, or disclosure of handling rules. Even if the script is local, it is a separate processing boundary that may log, persist, transform, or leak sensitive data, especially because the skill is mandatory and broad in scope.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly requires showing the transformed prompt back to the user, which can echo or summarize sensitive input that the user may not expect to be repeated. This creates an avoidable disclosure channel in the visible output, especially when the original message contains credentials, private data, or confidential instructions.

Content

No source excerpt is available for this finding.