Back to skill

Security audit

Dreaming Guard Pro

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly aligned with guarding OpenClaw dreaming files, but it includes under-scoped persistent execution and an unsafe restore path that could overwrite files outside its intended area.

Review before installing. Use an unprivileged account, avoid the supplied root-oriented cron runner, do not restore archives from untrusted or user-writable locations, and require backups or dry-run review before enabling automatic compression, cleanup, or recovery.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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
Findings (2)

T06 · System Persistence

Error
Location
scripts/dreaming-guard-pro.sh:1
Finding

Persistent Cron Execution Encourages Excessive Root Privileges

Content
View full analysis

Vulnerability Details

File Location: README.md:57-60, README.md:146-151, scripts/dreaming-guard-pro.sh:1-15
Vulnerability Type: Scheduled-task persistence and excessive privilege guidance
Risk Level: High

Vulnerable Code

README.md:57-60:

bash
### Cron Setup

# Add to crontab (run every minute)
* * * * * /path/to/dreaming-guard-pro/scripts/dreaming-guard-pro.sh >> /tmp/dreaming-guard.log 2>&1

README.md:146-151:

bash
# Disable old script
crontab -l | grep -v dreaming-guard.sh | crontab -

# Enable new guard
* * * * * /path/to/dreaming-guard-pro/scripts/dreaming-guard-pro.sh

scripts/dreaming-guard-pro.sh:1-15:

bash
#!/bin/bash
# Dreaming Guard Pro - Cron Runner
# Run one guard loop every minute
# Installation: add * * * * * /path/to/dreaming-guard-pro.sh >> /tmp/dreaming-guard-pro.log 2>&1 with crontab -e

set -e

# Project path
PROJECT_DIR="/root/.openclaw/workspace/projects/dreaming-guard-pro"
NODE_PATH="$(which node)"

# Enter project directory
cd "$PROJECT_DIR"

# Execute one loop

Technical Analysis

The documentation directs users to create a cron entry that executes the Skill every minute and survives individual Skill or agent sessions. Persistent monitoring can be consistent with the declared functionality, but cron is not the minimum mechanism necessary for one-time health checks or user-triggered operation.

The supplied runner hard-codes a project directory under /root, encouraging installation or operation as the root user. Monitoring and maintaining a single user's OpenClaw workspace normally requires only that user's permissions. Running the Skill as root expands the effect of every filesystem flaw and any future modification of the project source.

The migration command also reconstructs the complete crontab using a broad substring filter:

bash
crontab -l | grep -v dreaming-guard.sh |
...[truncated 2096 chars]
Remediation
View remediation

Remediation Suggestions

  1. Make persistent operation explicitly optional and keep one-time, user-triggered health checks as the default.
  2. Run the guard under a dedicated unprivileged account with access limited to the required OpenClaw dreaming, archive, state, and log directories.
  3. Remove the hard-coded /root path. Resolve the installation directory relative to the script or require a validated absolute path in a protected configuration file.
  4. Provide an installer that creates one uniquely marked cron entry only after explicit confirmation, and provide a matching uninstaller.
  5. Never rebuild the entire crontab with a broad substring filter. Match an exact marker or use a dedicated crontab file after creating a backup.
  6. Verify that the project directory and loaded files are owned by the service account or root and are not writable by less-privileged users.
  7. Use a lock such as flock to prevent overlapping executions.
  8. Write logs to a permission-restricted application log directory rather than a predictable shared /tmp path.
  9. Document the exact persistence scope, required privileges, generated files, and removal procedure.

T09 · Insecure Skill Coding Practices

Error
Location
src/archiver.js:559
Finding

Archive Manifest Path Traversal Allows Filesystem Writes Outside the Restore Directory

Content
View full analysis

Vulnerability Details

File Location: src/archiver.js:559-590
Vulnerability Type: Path traversal and arbitrary file overwrite
Risk Level: High

Vulnerable Code

javascript
// Load manifest
const manifestPath = path.join(archivePath, 'manifest.json');
if (!fs.existsSync(manifestPath)) {
  throw new Error('Archive manifest not found');
}

const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));

// Ensure target directory exists
if (!fs.existsSync(restorePath)) {
  fs.mkdirSync(restorePath, { recursive: true });
}

const result = {
  restored: [],
  failed: [],
  totalRestored: 0
};

// Decompress and restore files
for (const fileInfo of manifest.files) {
  try {
    const compressedPath = path.join(archivePath, fileInfo.path + '.gz');
    const targetFile = path.join(restorePath, fileInfo.path);
    const targetDir = path.dirname(targetFile);

    if (!fs.existsSync(targetDir)) {
      fs.mkdirSync(targetDir, { recursive: true });
    }

    // Decompress
    await this._decompressFile(compressedPath, targetFile);

Technical Analysis

The restore operation treats fileInfo.path from manifest.json as a trusted relative path. It joins that value to both the archive directory and destination directory without validating the resolved paths.

A value containing parent-directory components, such as ../../outside-file, can cause:

javascript
path.join(restorePath, '../../outside-file')

to resolve outside restorePath. Absolute paths and symlinked path components present similar boundary risks. The decompression operation uses fs.createWriteStream(target), so an existing destination is overwritten with decompressed attacker-controlled content.

The source path is affected by the same weakness:

javascript
path.join(archivePath, fileInfo.path + '.gz')

Consequently, the implementation does not guarantee that compressed i ...[truncated 2590 chars]

Remediation
View remediation

Remediation Suggestions

  1. Reject manifest paths that are absolute, empty, contain NUL bytes, or contain .. traversal components.

  2. Resolve and enforce both source and destination containment before any filesystem access:

    javascript
    const archiveRoot = path.resolve(archivePath);
    const restoreRoot = path.resolve(restorePath);
    const relative = fileInfo.path;
    
    if (
      typeof relative !== 'string' ||
      relative.length === 0 ||
      path.isAbsolute(relative) ||
      relative.split(/[\\/]+/).includes('..')
    ) {
      throw new Error('Invalid archive entry path');
    }
    
    const source = path.resolve(archiveRoot, relative + '.gz');
    const destination = path.resolve(restoreRoot, relative);
    
    if (!source.startsWith(archiveRoot + path.sep)) {
      throw new Error('Archive source escapes archive root');
    }
    if (!destination.startsWith(restoreRoot + path.sep)) {
      throw new Error('Restore destination escapes restore root');
    }
    
  3. Validate the complete manifest schema, including the type and maximum length of every path and reasonable limits on file count and decompressed size.

  4. Reject symlinks in every existing component of the archive and destination paths. Use lstat() and perform containment checks against canonical paths obtained with realpath().

  5. Decompress to a newly created temporary file inside the verified destination directory, verify completion and size, and atomically rename it into place.

  6. Avoid overwriting existing files by default. Require an explicit overwrite policy and create recoverable backups where replacement is permitted.

  7. Restrict archive and state files to the guard's unprivileged account using strict ownership and permissions.

  8. Cryptographically authenticate internally generated manifests or store trusted archive metadata separately from user-modifiable archive contents.

  9. Add tests covering ../, absolute paths, mixed path se ...[truncated 101 chars]

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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (63)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The metadata claims zero external dependencies, but the architecture explicitly relies on several third-party packages such as chokidar, archiver, fs-extra, and systeminformation. This is dangerous because it misleads reviewers and operators about the actual supply-chain and runtime risk, potentially causing the skill to be trusted or deployed under false assumptions.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

Documenting emergency restart and recovery behavior without clear warning understates the operational impact: the skill may interrupt the OpenClaw process, alter runtime state, and potentially lose in-flight work. In the context of an agent skill, automated restart logic is especially sensitive because it crosses from maintenance into direct lifecycle control of another service.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
92% confidence
Finding

The crash recovery design includes restoring dreaming files and prior state without warning that this may overwrite newer files or revert the system to an earlier snapshot. That can cause integrity loss, rollback of legitimate changes, or confusion about the current state, especially if recovery triggers automatically after a transient failure.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Creating, writing, and deleting files in a user's home directory for testing, plus modifying environment variables and simulating restart behavior, are meaningful side effects that exceed the declared purpose. The mismatch is more dangerous in this skill context because it is presented as a safety/guard component, which may lower user suspicion while it performs local system changes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The architecture scope expands from managing dreaming-context growth into broader process supervision, memory intervention, crash detection, and restart behavior. In a skill context, that increased authority raises the chance of unsafe control over host processes and can cause service disruption or unintended system impact if the skill is activated without tight scoping and explicit consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The document describes automatic archiving, compression, intervention, and self-healing behaviors without clearly warning that these actions can alter, remove, or replace user data and system state. In a memory-management skill, silent destructive automation is risky because users may enable it expecting monitoring, not autonomous modification of active context files.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The planned CLI tooling, install scripts, and migration scripts materially expand the attack surface beyond the stated purpose of preventing dreaming-context overflow. Shell entry points and operational scripts often execute with user privileges and, if unnecessary, create extra opportunities for unsafe file operations, privilege misuse, or unexpected system modification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README advertises automatic cleanup, compression, archiving, and crash recovery actions that can modify or remove user data and alter runtime behavior, but it does not clearly warn users about those side effects before installation or use. In an agent skill context, users may treat README instructions as safe operational guidance, so omission of cautions increases the risk of accidental data loss or service disruption.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Presenting 'Emergency cleanup + Gateway restart' as a normal automatic response without a prominent caution understates potentially destructive and availability-impacting behavior. In this skill's context, the action is especially sensitive because it targets a live gateway process and stored dreaming data, so an unsuspecting user could suffer session loss, corruption, or downtime.

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 95)May include surrounding context.

⚙️ Configuration

Create ~/.openclaw/dreaming-guard.json:

json
{

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% 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 148)May include surrounding context.

bash
# Disable old script
crontab -l | grep -v dreaming-guard.sh | crontab -

# Enable new guard
* * * * * /path/to/dreaming-guard-pro/scripts/dreaming-guard-pro.sh

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
77% confidence
Finding

The skill advertises environment-variable based configuration and file-writing behavior, but the manifest does not declare any tool scope or permissions. That creates an authority mismatch: users and the platform cannot clearly evaluate what the skill is allowed to access, increasing the chance of unexpected environment inspection or filesystem side effects.

Content

No source excerpt is available for this finding.