Back to skill

Security audit

Compaction UI Enhancements

Security checks for vulnerabilities and agentic risk

Overview

This skill appears purpose-aligned, but it needs Review because it can automatically compact session content with an LLM by default and may store conversation summaries locally in plaintext.

Review this before installing if your OpenClaw chats may contain secrets, proprietary code, personal data, or regulated information. Disable auto-compaction unless you want background LLM processing, avoid enabling stored summaries for sensitive sessions, and ensure the agent directory has owner-only filesystem permissions.

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
references/compaction-rpc.ts:76
Finding

Compaction Summaries Persisted in Plaintext Without Explicit Restrictive File Permissions

Content
View full analysis
{ const configPath = getConfigPath(agentDir); await fs.mkdir(path.dirname(configPath), { recursive: true }); await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8"); } /** * Called by the compaction engine to record a result. * Exported for use by the sessions.compact RPC and auto-compaction trigger. */ export async function recordCompactionResult( result: CompactionLastResult, agentDir?: string, ): Promise { const config = await loadCompactionConfig(agentDir); if (config.settings.storeLastResult) { config.lastResult = result; } else { // Still store metadata, just not the summary config.lastResult = { ...result, summary: undefined }; } await saveCompactionConfig(config, agentDir); } ``` ### Technical Analysis When result storage is enabled, `result.summary` can contain a condensed representation of the user's conversation, including confidential prompts, personal information, source code, operational details, or credentials accidentally included in chat history. The summary is serialized directly into `{agentDir}/compaction-config.json` as plaintext. The `fs.writeFile` call does not specify a restrictive mode such as `0o600`, so permissions are determined by the process umask and any permissions already present on the file. In a permissively configured or multi-user environment, the resulting file may be readable by unintended local users or processes. The write is also performed directly against the destination rather than through an atomic temporary-file replacement. An interruption could leave a partially written configuration file, ...[truncated 1721 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a broader feature set centered on background memory compaction and UI/configuration capabilities. The supplied code chunk, however, is narrowly focused on modifying the prompt sent to a compaction routine by injecting a conversation-summary section before other structured sections, then calling compaction. While the 'chat summary paragraph' portion is represented, the code does not implement or evidence auto-triggering, threshold configuration, model selection, settings-tab integration, result storage, or broader OpenClaw Control UI behavior. Therefore the description materially overstates what this specific code chunk actually does.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill describes automatic compaction after chat responses but does not prominently warn that conversation content may be automatically sent for summarization/processing once thresholds are reached. In this context, auto-triggering reduces user awareness and can cause sensitive chat content to be processed without an explicit per-use confirmation, increasing privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file states that the most recent compaction result, including a natural-language summary of the conversation, may be written to {agentDir}/compaction-config.json, but it lacks a strong privacy warning. Persisting summarized conversation content to local storage can expose sensitive information to other local users, backups, logs, or downstream tooling if the file permissions and retention expectations are not explicit.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The code states that compaction is called after every chat final event and triggers automatically when a token threshold is exceeded. Although UI toasts appear after the operation starts or completes, there is no prior user-facing disclosure or confirmation here that the session will be compacted in the background, which is a potentially user-impacting state-changing action.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The code invokes the "sessions.compact" action directly on button click, which appears to rewrite or summarize session history/context. Although the UI shows progress after initiation, there is no pre-action confirmation prompt or explicit warning that compaction may alter available conversation context.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The patch changes compaction from deterministic local line trimming into a full LLM-driven operation that selects a provider/model and runs compaction logic over session content. That materially expands capability and trust boundaries: session data is now processed by an agentic summarization engine and may be sent to an external model, which is more dangerous than the manifest’s simple 'background memory compaction' description suggests.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Passing arbitrary p.instructions into customInstructions turns a maintenance action into a general prompt-injection surface over sensitive session transcripts. An attacker who can trigger this RPC can steer the embedded compaction run to produce unexpected outputs, exfiltrate or transform memory content, or bypass the intended narrow purpose of summarization.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code invokes compactEmbeddedPiSession, which the surrounding comments indicate is the real LLM-based compaction engine and is likely to rewrite or summarize session transcript state. In this diff there is no confirmation prompt, logging/print statement, or explanatory comment warning the user that session content may be altered during a manual compaction request.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.