Back to skill

Security audit

Context Compressor

Security checks for vulnerabilities and agentic risk

Overview

This skill is a context compressor, but it can change agent behavior automatically, persist conversation-derived records, and alter the user's shell environment.

Install only after reviewing the auto-trigger and persistence behavior. Prefer explicit, opt-in compression, avoid running the installer unless you accept ~/.bashrc and ~/bin changes, and do not enable memory logging for chats that may contain secrets or sensitive data.

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
Findings (1)

T01 · Skill Instruction Hijacking

Warning
Location
README.md:109
Finding

Skill Instructions Alter Agent Responses and Interrupt the Active Task

Content
View full analysis

Vulnerability Details

File Location: README.md:109-118; related directives in references/auto-trigger.md:26-28,93-100 and SKILL.md:41-43
Vulnerability Type: Agent instruction hijacking through automatic response modification and task blocking
Risk Level: Medium

Vulnerable Code Snippet

markdown
## Auto-Trigger

When context reaches 70%, every answer includes:

[🦅 Context: 72%] Compress recommended: /hawk-compress 148k → ~35k | Save 113k tokens

text

At 85%+, forces confirmation before continuing.

The related auto-trigger documentation further directs the agent to check context before responses, block nonessential output at high thresholds, require compression before continuing, replace the current conversation context after compression, and write a compression record to memory/today.md.

Technical Analysis

These are behavioral instructions intended to take effect merely because the skill is loaded. Rather than limiting activation to an explicit user request, the skill directs the agent to monitor every interaction, append skill-controlled content to ordinary responses, force confirmation, and eventually prevent the active task from continuing.

This behavior changes the goals and output policy of the current agent session. It can supersede unrelated user work by redirecting the conversation into the compression workflow. The package also does not contain the advertised scripts/hawk-compress executable, so the forced workflow can block normal operation while directing the user toward a command that cannot successfully perform the documented function.

The risk is instruction-level rather than operating-system privilege escalation. No evidence was found that these directives bypass platform-level system instructions, but they can interfere with lower-priority user tasks when the skill text is incorporated into agent context.

Attack Path

  1. A user or platform loads the sk ...[truncated 1237 chars]
Remediation
View remediation

Remediation Suggestions

  1. Make compression strictly opt-in and activate it only after an explicit user command.
  2. Remove instructions requiring context checks before every response.
  3. Remove mandatory notices that alter all unrelated agent responses.
  4. Remove language directing the agent to refuse, block, or delay the active task.
  5. Treat context thresholds as advisory telemetry rather than authorization to change session behavior.
  6. Require explicit user approval before replacing conversation context or writing any compression history.
  7. State that system instructions, active user requests, and platform safety requirements always take precedence over the skill workflow.
  8. Add the documented scripts/hawk-compress executable or remove installation and invocation instructions that reference it.
  9. Add tests confirming that loading the skill alone does not modify responses, write persistent state, or interrupt unrelated tasks.
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
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill is presented as a pure Python context-compression tool, but its Quick Start instructs users to run a shell installer that modifies ~/.bashrc and creates command links in ~/bin. This undocumented host modification expands the trust boundary and can lead users to execute environment-changing commands they would not expect from a compression utility, increasing the risk of persistence, command hijacking, or unsafe installation behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documentation explicitly says the compressed conversation history is written to memory/today.md, creating persistent storage for chat content even though the skill is described as a pure context compressor and not a memory manager. This expands the trust boundary, introduces retention of potentially sensitive user data, and can cause users or integrators to unknowingly persist information that should have remained ephemeral.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

A context-compression tool does not inherently need persistent history storage, so documenting that capability is unjustified data retention. If implemented, it can silently accumulate sensitive prompts, secrets, or personal data on disk, increasing exposure through later compromise, misuse, or accidental disclosure.

Content

No source excerpt is available for this finding.

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · scripts/install.sh (reported line 12)May include surrounding context.

sh
#!/usr/bin/env bash
# install.sh — Auto-link hawk-compress command to ~/bin
# Run after: openclaw skills install ./context-compressor.skill

set -e

echo "[install] Context-Compressor — creating symlinks..."

mkdir -p "$HOME/bin"
if ! echo "$PATH" | grep -q "$HOME/bin"; then
    echo "[install] Adding ~/bin to PATH in ~/.bashrc..."
    echo 'export PATH="$HOME/bin:$PATH"' >> "$HOME/.bashrc"
    export PATH="$HOME/bin:$PATH"
fi

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ln -sf "$SCRIPT_DIR/hawk-compress" "$HOME/bin/hawk-compress"

echo "[install] Symlink created: ~/bin/hawk-compress"
echo "[install] Run: source ~/.bashrc && hawk-compress --help"

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The README explicitly states the skill 'writes to memory' and saves compression history to memory/today.md, which contradicts the stated purpose of being a pure context-compression tool and 'NOT a memory manager'. That mismatch can mislead users into exposing conversation data to persistent storage without informed consent, increasing privacy and data-retention risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README describes saving compression history to memory without clearly warning that compressed conversation content may persist on disk. Because this skill processes potentially sensitive chat history, undocumented persistence can cause users to retain private prompts, secrets, or regulated data longer than expected.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README instructs users to run an install script that links a command into ~/bin and modifies shell startup behavior via source ~/.bashrc, which expands the skill's footprint beyond simple context compression. For a skill handling conversation data, unnecessary environment modification increases the attack surface and normalizes execution of local scripts with user trust but limited justification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manual trigger phrases include generic terms such as '瘦身' and 'reduce context', which can easily appear in normal conversation rather than as an intentional command. In this skill's context, accidental activation is dangerous because compression can rewrite or discard prior conversation state, potentially removing safety-relevant instructions or task details from the working context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documentation describes dropping low-importance messages and summarizing older content, but it does not prominently warn users that parts of the conversation may be permanently omitted from the active context. This creates a safety risk because users may rely on the assistant to retain constraints, decisions, or sensitive caveats that are instead compressed away or discarded.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The operational examples and required prompts shown for checks, warnings, confirmation, and completion are all presented in Chinese as mandatory interaction text, while the file does not state that this skill is China-specific or that users may opt into another language. Under the language/locale policy, forcing a specific language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list includes broad phrases such as compress, 瘦身, and similar natural-language variants that can appear in ordinary conversation, making unintended invocation plausible. In this skill's context, accidental activation could summarize or replace active conversation state, causing loss of important context, user confusion, or unintended handling of sensitive content.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code documentation and output structure present this as a context compressor with structured compression metrics, but compress_context only returns message objects/content and never annotates items with status values such as preserved or summarized. As a result, the reported kept_messages and summarized_count metrics at L087-L088 will always be inconsistent with actual behavior, contradicting the intent implied by the CLI's documented JSON stats.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file describes running the CLI with --output compressed.json and different compression levels, including heavy and emergency, but it does not warn users that the operation can irreversibly reduce retained context or replace detailed history with summaries. Because the skill affects user data fidelity and writes results to disk, the description should disclose those impacts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The document is primarily written in Chinese and does not indicate that language is optional or user-selectable. Under the policy rule for natural-language violations, forcing a specific language without opt-in can be a locale-policy issue.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented compression-history logging and integration with Context Hawk Memory and memory-lancedb-pro go beyond transient context compression and introduce unjustified persistence and propagation of user-derived data. In a tool advertised as dependency-free and non-memory-managing, this creates hidden data flow and increases the chance of privacy breaches, over-collection, or unintended reuse of sensitive conversation content.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation explicitly says each compression writes a record to memory/today.md, which creates persistent storage of conversation-derived metadata despite the skill being described as a pure current-context compressor and not a memory manager. This mismatch can cause users or integrators to unknowingly retain sensitive chat information and route it into other memory systems, expanding data exposure beyond the current session.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The markdown instructs writing compression history to a local file but provides no user warning that conversation-derived information will persist beyond the active chat. Even if the log contains metrics rather than full transcripts, timestamps, token counts, compression events, and summarized content can still reveal sensitive usage patterns or fragments of private data.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file states the compressor handles only current-dialog compression, yet the documented workflow writes history into persistent memory and feeds a longer-term memory stack. That contradiction is dangerous because operators may rely on the 'current only' claim while the implementation or expected behavior actually persists and reuses chat-derived data across sessions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The installer persistently modifies the user's shell startup file by appending to ~/.bashrc, which changes the environment beyond the immediate execution of the skill. For a skill described as a pure context compression tool with no stated need for persistent shell configuration, this is an unnecessary privilege/footprint increase and can surprise users or create lasting side effects.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script installs a user-wide executable path and symlink, making the command globally available across future sessions. While not overtly malicious, this exceeds the stated scope of a compression skill and creates persistent system changes that could later be abused if the linked target is replaced or if users did not expect shell-level installation behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The examples in the README include Chinese text such as 越来越长,越来越贵,越来越慢 and placeholders like 永久保留的系统提示 without explaining that the skill is locale-specific or offering language choice. This can indicate a natural-language locale preference embedded in documentation without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The natural-language instructions and examples are predominantly in Chinese, with no indication that users may opt into another language or that the skill is intentionally region- or locale-specific. This can violate language/locale policy when a skill effectively forces one language without user choice.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The header comment says the script will auto-link the hawk-compress command to ~/bin, but the implementation also appends an export statement to ~/.bashrc. That documentation understates the side effect and creates a mismatch between the documented intent and actual behavior.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.