Back to skill

Security audit

https://github.com/ckpxgfnksd-max/prompt-compressor-openclaw

Security checks for vulnerabilities and agentic risk

Overview

This token-saving skill needs review because it persistently changes agent behavior and includes a hook that can rewrite user messages before the model sees them.

Install only if you intentionally want persistent concise-mode behavior across future OpenClaw sessions. Avoid enabling the hook unless you are comfortable with user messages being rewritten before the model sees them; prefer one-off prompt compression or a workspace-scoped SOUL.md, and keep a backup/uninstall plan.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • 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)

T02 · Agent Memory Poisoning

Warning
Location
SKILL.md:25
Finding

Persistent Modification of Global Agent Instructions

Content
View full analysis
> ~/.openclaw/SOUL.md ``` Or if using a workspace SOUL.md: ```bash cat {baseDir}/soul-snippet.md >> /SOUL.md ``` Then start a new session (`/new`) so the updated SOUL.md loads. ``` `SKILL.md:72-73`: ```markdown - When installing, ALWAYS append to SOUL.md, never overwrite it - Tell the user to run `/new` after installation so the new SOUL.md loads ``` `soul-snippet.md:1-38`: ```markdown # Token Efficiency Protocol You save tokens on every response and in all persistent files. This reduces API costs 20-40% across sessions. ## Response Rules - No greetings, no sign-offs, no "Sure!", no "Great question!" - No filler: never use "just", "really", "very", "basically", "actually", "literally", "honestly", "definitely", "certainly", "simply" - No hedging: never say "I think", "I believe", "it seems like", "in my opinion" - No padding: never say "it is important to note that", "it is worth mentioning", "as a matter of fact" - Short phrases over verbose: "because" not "due to the fact that", "to" not "in order to", "about" not "with regard to", "now" not "at this point in time", "if" not "in the event that", "many" not "a large number of", "before" not "prior to", "after" not "subsequent to", "consider" not "take into consideration", "create" not "come up with", "determine" not "figure out" - Lead with the answer. Context after, only if needed. - Code blocks: no narration before or after unless the user won't understand without it. - Lists: only when structure genuinely helps. Default to prose. ## Memory & Log Rules When writing to MEMORY.md or memory/YYYY-MM-DD.md: - Use compressed not ...[truncated 3063 chars]
Remediation
View remediation
... ``` 4. Back up `SOUL.md` before modification and provide a documented uninstall command that removes only the marked section. 5. Keep memory and compaction behavior separate from response-style optimization. Require separate opt-in for changing persistent records. 6. Preserve uncertainty, negation, attribution, security decisions, and requirements in memory even when compression is enabled. 7. Prefer loading the protocol only for sessions in which the user explicitly requests token compression. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
handler.js:357
Finding

Silent Semantic Alteration of Inbound User Messages

Content
View full analysis
{ if (event.type !== "message" || event.action !== "received") return; const content = event.context?.content; if (!shouldCompress(content)) return; const result = compress(content); if (result.text.length < content.length && result.text.length > 0) { event.context.content = result.text; console.log( `[prompt-compressor] ${result.origTokens}→${result.compTokens} tokens (-${result.savedPct}%)` ); } }; ``` ### Technical Analysis When the optional hook is enabled, it intercepts qualifying inbound messages and replaces `event.context.content` before the LLM processes the message. The only acceptance conditions are that the result is nonempty and shorter than the original. No semantic-equivalence check, user conf ...[truncated 2835 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The description says this works via SOUL.md instructions only, with no hooks or extra process, and frames the skill as teaching the agent to write compressed outputs and memory artifacts, plus optionally compress prompts when asked. The actual code instead installs an OpenClaw message:received hook that intercepts and rewrites user messages automatically before they reach the model. That is a materially different mechanism and an undeclared capability. It also does not contain any logic for compressing the agent's responses, memory logs, or pre-compaction summaries; its implemented behavior is prompt/input compression only. While prompt compression is related to the declared theme, the primary behavior, trigger mechanism, and scope differ enough to constitute a clear mismatch.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill metadata and header materially misrepresent behavior: it claims to work via passive SOUL.md instructions with no hooks, while the code installs an active message-received hook that rewrites user input before the model sees it. This is dangerous because it conceals a trust-boundary change from operators and users, making prompt semantics mutable in a security-sensitive position and undermining informed consent, auditing, and policy enforcement.

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 · README.md (reported line 3)May include surrounding context.

md
# Prompt Compressor for OpenClaw

**Saves 20-40% of LLM tokens** by teaching the agent to write compressed output from the start.

## The Problem

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README materially understates the skill's capabilities by emphasizing a SOUL.md-only, no-hooks approach while also documenting a hook-based path that preprocesses input. This mismatch can mislead operators during review and deployment, causing them to approve a skill with broader behavior than initially advertised.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

A hook that compresses user messages before the model sees them changes user intent at the trust boundary. This can omit qualifiers, safety constraints, or exact details, leading to unsafe actions, incorrect outputs, or bypass of user- or system-level safeguards that depend on precise wording.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

Enabling a persistent hook in the user's OpenClaw hooks directory causes ongoing preprocessing of future sessions and inputs, expanding the blast radius beyond a single conversation. Because the hook acts before the LLM sees user text, mistakes or unsafe transforms can silently affect all later interactions until removed.

Content

Scanner excerpt · README.md (reported line 86)May include surrounding context.

handler.js contains a message:received hook that compresses user messages before the LLM sees them (saving tokens on turn 1 too). This requires OpenClaw versions with custom hook support. When your version supports it:

bash
mkdir -p ~/.openclaw/hooks/prompt-compressor
cp handler.js SKILL.md ~/.openclaw/hooks/prompt-compressor/
openclaw hooks enable prompt-compressor

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill instructs users to run shell commands that modify SOUL.md, but it declares no tool scope or permissions. This creates a transparency and governance gap: an agent or platform may expose shell-capable behavior without explicit authorization boundaries, increasing the chance of unsafe execution or review bypass.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
94% confidence
Finding

The skill is explicitly designed to persist behavior by appending instructions to SOUL.md so future sessions produce compressed responses, memory logs, and summaries. Persistent instruction changes are security-relevant because they alter agent behavior beyond the current interaction and may affect data handling, auditability, and user expectations across later sessions.

Content

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

md
---
name: prompt-compressor
description: Saves 20-40% of LLM tokens by teaching the agent to write compressed responses, compressed memory logs, and compressed pre-compaction summaries. Works via SOUL.md instructions — no hooks, no extra process, no dependencies. Also provides explicit compression when the user asks to compress a prompt. Use when the user asks about reducing token costs, optimizing API spend, compressing prompts, or making the agent more efficient.
version: 1.0.0
metadata: {"openclaw":{"emoji":"🗜️","homepage":"https://github.com/ckpxgfnksd-max/prompt-compressor-openclaw"}}
---

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The activation language is broad enough to trigger on many generic requests about efficiency or token cost, which can cause the skill to apply persistent behavior outside the user's precise intent. In this skill's context, that means modifying long-lived agent behavior through SOUL.md rather than handling a one-off compression task, increasing the risk of unwanted instruction persistence.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The hook modifies user messages before they reach the LLM, with no user-facing warning, consent flow, or transparent indication that content was rewritten. In this context, that is risky because regex-based prompt rewriting can change meaning, remove constraints, or distort quoted instructions, yet users and administrators may attribute the resulting model behavior to the original text.

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 · handler.js (reported line 11)May include surrounding context.

js
* rules run in-process in ~3ms.
 *
 * Install:
 *   mkdir -p ~/.openclaw/hooks/prompt-compressor
 *   cp handler.js ~/.openclaw/hooks/prompt-compressor/
 *   openclaw hooks enable prompt-compressor
 *

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest says compression is provided when the user explicitly asks for it, but the implementation automatically compresses any qualifying inbound message. In a prompt-processing component, automatic transformation can silently remove qualifiers, scope, or safety-relevant language from user requests, causing the model to act on altered intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill applies a mandatory response-style policy ('save tokens on every response') without user opt-in, overriding normal assistant flexibility and potentially conflicting with user or system expectations for tone, clarity, or completeness. While not overtly malicious, persistent compression can degrade communication quality, suppress needed context, and cause the agent to omit helpful explanatory text in situations where detail matters.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This markdown file instructs the user to append content into ~/.openclaw/SOUL.md, which changes persistent agent behavior, but it does not clearly warn that this will alter future sessions and may affect how the agent responds. The parenthetical note only prevents overwriting and does not function as a user-facing safety disclosure about the behavioral impact of the file write.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The top-level comment states the compressor 'Saves 20-50% of LLM input tokens on every message' and 'compresses user messages BEFORE the LLM sees them,' implying universal application. In reality, shouldCompress excludes messages under MIN_LENGTH and content matching SKIP_PATTERNS, so the documentation overstates what the code does.

Content

No source excerpt is available for this finding.