Back to skill

Security audit

prompt-optimizer

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local Chinese-language prompt optimizer with file-writing and local learning logs that are mostly disclosed and purpose-aligned.

Install only if you are comfortable with a local Chinese-language prompt tool that writes optimized prompts, benchmark reports, and learning logs. Avoid putting secrets in prompt files, notes, or preferences, and run learner.py only against directories you intend it to update.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明的核心用途是“优化器”——应能把 prompt 升级、重写、增强并做版本化管理,同时可进行双 prompt 对比。实际代码并不生成、修改或迭代任何 prompt,也没有版本管理逻辑;它只是对两个输入文本做基于正则规则的静态评分和选优。因此,虽然其中“对比两个 prompt”这一子功能与声明部分吻合,但代码的主要行为只覆盖了声明中的一个辅助手段,而未实现声明的主要能力,构成明显描述-行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的核心能力是“提示词优化与版本对比”,而代码的核心职责是“技能使用学习与统计分析”。该脚本提供 init/record/prefer/insight/reflect 五类命令,操作的是 learned_patterns.json,记录能力调用、失败次数、错误类型、偏好与最近操作,并生成高频能力/重复错误的建议。这与提示词内容增强、结构化改写、输出格式设计、版本化 prompt 管理或 prompt A/B 对比没有实质对应关系。虽然‘优化建议’一词可能表面上接近声明中的‘优化’,但这里优化的是技能本身的使用模式,而不是用户提供的 prompt。因此属于明显的目的与行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

代码的大方向与声明基本一致,确实是在做 prompt 优化增强,并包含角色设定、上下文、分步指令、输出格式、约束、示例占位、链式思考、自检等功能,也确实进行了某种日志记录。但声明中的两个重要能力没有实际实现:一是“双 prompt 基准对比选优”,代码没有接收两个 prompt、执行对比或输出优胜版本;二是“版本管理(v1/v2...)”,代码只是把每次执行记录到 optimize_log.json,并未实际进行版本编号、版本内容管理或多版本迭代产物控制。因此存在描述与行为不一致,属于能力被明显高估的情况。

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file’s functionality materially diverges from the declared prompt-optimizer purpose and instead implements a reusable cross-skill telemetry/learning subsystem. In an agent-skill ecosystem, this kind of scope mismatch is dangerous because it expands persistence and observability capabilities beyond user expectations, making covert data collection or unauthorized state sharing across skills easier to hide.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code accepts an arbitrary directory or skill name and then reads/writes learned_patterns.json for that target, including under ~/.workbuddy/skills. For a prompt-optimization skill, cross-directory persistent access is over-privileged and can be abused to tamper with or mine data from other skills, increasing the blast radius well beyond the declared function.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill advertises workflows that write files such as prompt.optimized.md and optimize_log.json, but it does not declare any explicit tool scope or permission boundary. In an agent environment, undeclared write capability can lead to unauthorized file modification, unexpected persistence, or abuse of the workspace without clear operator consent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The activation phrases are broad enough to match ordinary requests like 'improve my prompt,' increasing the chance of unintended invocation. In multi-skill agent systems, overly broad triggers can cause prompt interception, unexpected transformations of user content, and misrouting into a skill with file-writing and persistence behaviors.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill is written entirely in Chinese and describes its behavior only in Chinese, with no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking context. Under the policy, language constraints should be opt-in or explicitly justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script records free-text notes and error history directly into a local JSON file, which can capture secrets, internal prompts, tokens, or sensitive operational context entered during failures. Because these notes are arbitrary text and are retained across runs, they create a durable leakage surface with little visibility or control.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script persistently stores user preferences to disk without any disclosure, consent flow, retention policy, or sensitivity filtering. Preference values may contain personal or operationally sensitive information, and silent persistence creates a privacy and data-handling risk that users would not reasonably expect from a prompt-optimization skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file’s docstring and examples are written entirely in Chinese and the generated prompt templates are hard-coded in Chinese, indicating the skill is intended to operate in a fixed language/locale. There is no user opt-in or documented justification for this language restriction, which violates the language-choice policy for natural-language behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The optimize() function constructs all role, task-structure, constraints, and reasoning instructions in Chinese, which forces a specific language for downstream prompt generation. Because the skill does not provide any mechanism to choose another language or explicitly obtain user consent for Chinese-only behavior, this is a natural-language policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The module docstring, CLI descriptions, and output strings are all Chinese-language only, with no indication that the skill is region-specific or that users may select another language. This can violate language/locale policy where skills should not force a language without opt-in.

Content

No source excerpt is available for this finding.