Back to skill

Security audit

Claw Compactor

Security checks for vulnerabilities and agentic risk

Overview

The skill has real token-compression features, but included memory and proxy components can expose private chats or run powerful agent actions without strong safeguards.

Review this carefully before installing. Use only the deterministic compression features unless you explicitly need Engram or the proxy. Do not run the proxy without setting a strong PROXY_AUTH_TOKEN, binding it to loopback or a protected network, and avoiding USE_CLI_AGENTS unless it is sandboxed. Do not point OPENAI_BASE_URL at an untrusted or plaintext remote endpoint, and periodically inspect/delete memory under memory/engram.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
proxy/server.mjs:531
Finding

Default-Open Proxy Exposes a Full-Permission Autonomous Agent

Content
View full analysis
{ const url = new URL(req.url, `http://0.0.0.0:${PORT}`); res.setHeader("access-control-allow-origin", "*"); res.setHeader("access-control-allow-methods", "GET, POST, OPTIONS"); res.setHeader( "access-control-allow-headers", ...[truncated 3643 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/lib/engram_storage.py:38
Finding

Unvalidated Thread IDs Permit Filesystem Path Traversal

Content
View full analysis
Path: """Return (and create) the directory for a thread.""" d = self.base_path / "memory" / "engram" / thread_id d.mkdir(parents=True, exist_ok=True) return d def _obs_path(self, thread_id: str) -> Path: return self._thread_dir(thread_id) / "observations.md" def _ref_path(self, thread_id: str) -> Path: return self._thread_dir(thread_id) / "reflections.md" def _pending_path(self, thread_id: str) -> Path: return self._thread_dir(thread_id) / "pending.jsonl" def _meta_path(self, thread_id: str) -> Path: return self._thread_dir(thread_id) / "meta.json" ``` ```python def append_observation( self, thread_id: str, observation: str, timestamp: Optional[str] = None, ) -> None: ts = timestamp or _now_utc() header = f"\n\n" content = header + observation.strip() + "\n" path = self._obs_path(thread_id) with path.open("a", encoding="utf-8") as f: f.write(content) self._update_meta(thread_id, last_observed_at=ts) ``` ```python def write_reflection( self, thread_id: str, reflection: str, timestamp: Optional[str] = None, ) -> None: ts = timestamp or _now_utc() header = f"\n" content = header + reflection.strip() + "\n" path = self._ref_path(thread_id) _atomic_write(path, content) self._update_meta(thread_id, last_reflected_at=ts) ``` ```python def append_message(self, thread_id: str, message: dict) -> None: path = self._pending_path(thread_id) with path.open("a", encoding="utf-8") as f: f.write(json.dumps(message, ensure_ascii=False) + "\n") ``` ### Technical Analysis `thread_id` is used directly as a path ...[truncated 2506 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
scripts/lib/engram.py:310
Finding

Untrusted Conversation Data Can Poison Persistent System Context

Content
View full analysis
str: ctx = self.get_context(thread_id) parts: List[str] = [] if ctx["reflection"].strip(): parts.append("## Long-Term Memory (Reflections)\n" + ctx["reflection"]) if ctx["observations"].strip(): obs_lines = ctx["observations"].splitlines() if len(obs_lines) > 200: obs_lines = obs_lines[-200:] parts.append("## Recent Observations\n" + "\n".join(obs_lines)) if not parts: return "" total = ctx["stats"]["total_tokens"] parts.append(f"\n") return "\n\n".join(parts) ``` ```python OBSERVER_USER_TEMPLATE = """\ Please observe and compress the following conversation messages into a \ structured observation log. Current date/time: {current_datetime} --- MESSAGES START --- {messages_text} --- MESSAGES END --- """ ``` ```python REFLECTOR_SYSTEM_PROMPT = """\ You are the **Reflector Agent** — a specialist in distilling and compressing \ an accumulated observation log into a tighter, pattern-aware reflection log. ## Your Mission Take a large observation log (previously produced by the Observer Agent) and: 1. **Merge** related entries across dates into unified threads. 2. **Promote** recurring patterns and long-term context to the top. 3. **Prune** outdated or superseded information. 4. **Preserve** all 🔴 critical items — never drop them. ``` The documented integration subsequently prepends the generated value: ...[truncated 2944 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/lib/engram.py:128
Finding

Configurable LLM Endpoint Can Receive Conversation Data and Provider Credentials

Content
View full analysis
str: """Call an OpenAI-compatible chat completions endpoint.""" base = self.openai_base_url.rstrip("/") url = f"{base}/v1/chat/completions" headers = { "Authorization": f"Bearer {self.openai_api_key}", "content-type": "application/json", } body = { "model": self.model, "max_tokens": self.max_tokens, "messages": [ {"role": "system", "content": system}, {"role": "user", "content": user}, ], } data = _http_post(url, headers, body) try: return data["choices"][0]["message"]["content"] except (KeyError, IndexError) as exc: raise ValueError( f"Engram: unexpected OpenAI response structure: {data}" ) from exc ``` ### Technical Analysis The OpenAI-compatible backend URL can be supplied through a constructor argument, configuration dictionary, or environment variable. The code appends `/v1/chat/completions` and sends both the full LLM input and `OPENAI_API_KEY` to the selected host. There is no validation requiring TLS, no hostname allowlist, no confirmation for remote destinations, and no binding between a credential and its intended provider. Consequently, a configuration error or malicious environment modification can redirect requests to an attacker-controlled HTTP or HTTPS endpoint. Observer requests contain raw conversation ...[truncated 1821 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (147)

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

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

md
<!--
<script type="application/ld+json">
{
 "@context": "https://schema.org",

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The Engram section instructs users to configure API endpoints and keys and describes observing, reflecting, ingesting, and daemonizing conversation processing, but it does not clearly warn that conversation content may be sent to an external or custom LLM endpoint and then stored persistently under memory/engram/. In a memory-processing skill, this materially increases privacy and data-exfiltration risk because sensitive prompts, credentials, internal discussions, or regulated data could be transmitted and retained without informed consent.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/engram_auto.py --workspace ~/.openclaw/workspace

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · benchmark/compressors.py (reported line 32)May include surrounding context.

python
# ---------------------------------------------------------------------------

def _load_env() -> None:
    env_path = Path(__file__).parent.parent / ".env"
    if env_path.exists():
        for line in env_path.read_text().splitlines():
            line = line.strip()

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/engram-auto.sh (reported line 55)May include surrounding context.

sh
# ---------------------------------------------------------------------------

def _load_env() -> None:
    env_path = Path(__file__).parent.parent / ".env"
    if env_path.exists():
        for line in env_path.read_text().splitlines():
            line = line.strip()

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/lib/config.py (reported line 120)May include surrounding context.

python
# ---------------------------------------------------------------------------

def _load_env() -> None:
    env_path = Path(__file__).parent.parent / ".env"
    if env_path.exists():
        for line in env_path.read_text().splitlines():
            line = line.strip()

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · tests/test_engram_auto.py (reported line 543)May include surrounding context.

python
# ---------------------------------------------------------------------------

def _load_env() -> None:
    env_path = Path(__file__).parent.parent / ".env"
    if env_path.exists():
        for line in env_path.read_text().splitlines():
            line = line.strip()

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · tests/test_engram_auto.py (reported line 550)May include surrounding context.

python
# ---------------------------------------------------------------------------

def _load_env() -> None:
    env_path = Path(__file__).parent.parent / ".env"
    if env_path.exists():
        for line in env_path.read_text().splitlines():
            line = line.strip()

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · tests/test_engram_auto.py (reported line 557)May include surrounding context.

python
# ---------------------------------------------------------------------------

def _load_env() -> None:
    env_path = Path(__file__).parent.parent / ".env"
    if env_path.exists():
        for line in env_path.read_text().splitlines():
            line = line.strip()

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

EngramCompressor sends full conversation content to an OpenAI-compatible endpoint over plain HTTP while also attaching an Authorization bearer token. This exposes sensitive prompt data and credentials to interception on the local network, proxies, or misconfigured hosts, and the module provides no trust boundary, consent, or manifest justification for the exfiltration.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
89% confidence
Finding

The backup cleanup loop derives object names from aws s3 ls output and passes them directly into aws s3 rm, relying on fragile text parsing and weak date extraction. If object names are malformed, unexpected, or intentionally crafted, the script can delete the wrong backups or remove more data than intended, causing destructive data loss in the backup store.

Content

Scanner excerpt · benchmark/data/sample_05_sysadmin.json (reported line 36)May include surrounding context.

json
{"role": "user", "content": "Will add disk monitoring. Our backup strategy is manual rsync. Should we automate this?", "ts": "2026-03-05T10:35:00Z"},
    {"role": "assistant", "content": "Yes, absolutely automate backups. Recommended stack:\n1. **Database**: `pg_dump` or `mysqldump` → compress → S3 (use `aws s3 cp` or `rclone`)\n2. **Files**: `restic` — deduplication, encryption, S3/B2 backend, excellent retention policies\n3. **Schedule**: cron or systemd timers\n4. **Test restores**: Monthly restore test to verify backups are valid\n5. **3-2-1 rule**: 3 copies, 2 different media, 1 offsite (S3 is your offsite)\n\nRestic example: `restic -r s3:s3.amazonaws.com/my-backups backup /data --password-file /etc/restic-password`", "ts": "2026-03-05T10:35:30Z"},
    {"role": "user", "content": "We use Postgres. Show me a complete backup script.", "ts": "2026-03-05T10:36:00Z"},
    {"role": "assistant", "content": "```bash\n#!/bin/bash\n# postgres-backup.sh — Daily Postgres backup to S3\n\nset -euo pipefail\n\nDATE=$(date +%Y-%m-%d-%H%M)\nDB_NAME=\"myapp\"\nBACKUP_DIR=\"/tmp/backups\"\nS3_BUCKET=\"s3://my-company-backups/postgres\"\n\nmkdir -p \"$BACKUP_DIR\"\n\n# Dump all databases\npg_dumpall -U postgres | gzip > \"$BACKUP_DIR/postgres-$DATE.sql.gz\"\n\n# Upload to S3\naws s3 cp \"$BACKUP_DIR/postgres-$DATE.sql.gz\" \"$S3_BUCKET/postgres-$DATE.sql.gz\"\n\n# Verify upload\naws s3 ls \"$S3_BUCKET/postgres-$DATE.sql.gz\" || { echo 'Upload failed!'; exit 1; }\n\n# Cleanup local backup\nrm -f \"$BACKUP_DIR/postgres-$DATE.sql.gz\"\n\n# Delete S3 backups older than 30 days\naws s3 ls \"$S3_BUCKET/\" | awk '{print $4}' | while read f; do\n    fdate=$(echo \"$f\" | grep -oP '\\d{4}-\\d{2}-\\d{2}' | head -1)\n    if [[ $(date -d \"$fdate\" +%s 2>/dev/null) -lt $(date -d '30 days ago' +%s) ]]; then\n        aws s3 rm \"$S3_BUCKET/$f\"\n    fi\ndone\n\necho \"Backup completed: postgres-$DATE.sql.gz\"\n```\n\nAdd to cron: `0 2 * * * /opt/scripts/postgres-backup.sh >> /var/log/backup.lo
...[truncated 25 chars]

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · benchmark/compressors.py (reported line 28)May include surrounding context.

python
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · engram.yaml (reported line 3)May include surrounding context.

yaml
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/benchmark_fusion.py (reported line 543)May include surrounding context.

python
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/engram-auto.sh (reported line 50)May include surrounding context.

sh
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/engram-auto.sh (reported line 78)May include surrounding context.

sh
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/engram_cli.py (reported line 353)May include surrounding context.

python
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/lib/config.py (reported line 8)May include surrounding context.

python
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/lib/config.py (reported line 91)May include surrounding context.

python
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/lib/config.py (reported line 118)May include surrounding context.

python
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · tests/test_engram_auto.py (reported line 290)May include surrounding context.

python
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · tests/test_engram_auto.py (reported line 296)May include surrounding context.

python
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · tests/test_engram_auto.py (reported line 310)May include surrounding context.

python
# engram.yaml — Engram unified configuration
# Place this file in the claw-compactor root directory.
# All paths support ~ expansion.  Sensitive values stay in .env (not here).

llm:
  # Provider: "anthropic" or "openai-compatible"

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · proxy/quantum-lock.mjs (reported line 170)May include surrounding context.

js
}

  // Build the appendix with actual dynamic values
  const appendixLines = ["", "---", "<!-- quantum-lock: dynamic context -->"];
  for (const { name, original } of fragments) {
    appendixLines.push(`${name}: ${original}`);
  }

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The proxy is explicitly designed to launch Claude CLI with --dangerously-skip-permissions, giving model-driven subprocesses unrestricted tool execution without per-request user approval. In a proxy that accepts remote chat completion requests, this creates a direct path from untrusted prompt input to autonomous command execution on the host and any reachable environment, making prompt injection or abuse highly dangerous.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec, suspicious.dynamic_code_execution, suspicious.exposed_secret_literal (+2 more)

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
proxy/compression-middleware.mjs:140

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
proxy/server.mjs:628

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
scripts/lib/fusion/nexus_model.py:144

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
benchmark/data/sample_04_mixed_long.json:214

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
proxy/server.mjs:533

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
tests/test_fusion_engine.py:108

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
tests/test_quantum_lock.py:73

Potential obfuscated payload detected.

Warn
Code
suspicious.obfuscated_code
Location
tests/test_photon.py:63

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
references/compression-techniques.md:197