Back to skill

Security audit

Ghost Mode

Security checks for vulnerabilities and agentic risk

Overview

This skill is a clearly disclosed privacy/deletion tool, but its implementation can delete too broadly and has unsafe failure and input-handling behavior.

Review before installing. This skill is local and purpose-built to delete OpenClaw memory/session traces, but it has serious safety issues: it may delete unrelated archive/session data, may claim cleanup succeeded when verification failed, and has input/path handling bugs. Use only with backups, explicit commands, dry-run previews, and a trusted local environment; avoid cron, --yes, and disabling confirmations until the implementation is fixed.

Vulnerability Patterns
  • 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
  • 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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/ghost_mode.sh:242
Finding

Arbitrary Python Code Execution Through Unsafe Shell Interpolation

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/ghost_archive.py:24
Finding

OPENCLAW_AGENT Path Traversal Allows File Operations Outside the OpenClaw Directory

Content
View full analysis
{archive_dir.relative_to(OPENCLAW_HOME)}", file=sys.stderr) # Remove original if full mode, or if checkpoint/split in split mode if archive_mode == "full": src_path.unlink() elif archive_mode == "split" and file_type != "primary": src_path.unlink() ``` ### Technical Analysis `OPENCLAW_AGENT` is treated as an untrusted path component but is not validated. It may contain `..` components or an absolute path. With `pathlib`, joining an absolute component can discard preceding path components, while traversal components can resolve outside `OPENCLAW_HOME`. Although `ghost_registry.py` validates `OPENCLAW_HOME` and `OPENCLAW_WORKSPACE`, that protection does not constrain `SESSIONS_DIR`. The sour ...[truncated 1503 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/ghost_mode.sh:349
Finding

Single-Session Cleanup Securely Deletes the Entire Shared Archive

Content
View full analysis
/dev/null || { find "$archive_dir" -type f -exec rm -f {} \; warn "shred unavailable, used rm instead" } # Remove empty directories find "$archive_dir" -type d -empty -delete 2>/dev/null || true fi ``` ### Technical Analysis The `off` command operates on one `session_id`, but the final deletion stage recursively selects every file beneath the shared `ghost-archive` directory. It does not restrict deletion to the archive directory created for the current session. Consequently, cleanup of one session can destroy archives belonging to other sessions, including archives whose scrub or verification stages have not completed. It can also delete unrelated files that a user placed beneath the shared archive path. The code additionally hard-codes `$HOME/.openclaw/ghost-archive` instead of deriving the location from `OPENCLAW_HOME`. This creates configuration inconsistency: archival may write to one location while the shell cleanup deletes another. ### Attack Path 1. Archive files for another session or unrelated user data exist under `$HOME/.openclaw/ghost-archive`. 2. The user deactivates a single Ghost Mode session and authorizes cleanup. 3. The session-specific archive, scrub, index, and verification commands run. 4. The final `find` recursively enumerates every file in the shared archive. 5. Every enumerated file is securely overwritten and removed, regardless of ownership by session or pipeline state. ### Impact Assessment The flaw causes irreversible cross-session data loss and may destroy the only recovery copies available after partial cleanup. It exceeds the minimum scope necessary for del ...[truncated 146 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/ghost_mode.sh:328
Finding

Cleanup Continues After Failures and Falsely Reports Successful Verification

Content
View full analysis
/dev/null || true # Step 2: Archive session files python3 "$SCRIPT_DIR/ghost_archive.py" session "$session_id" 2>/dev/null || { warn "Archival encountered issues, continuing..." } # Step 3: Scrub memory files python3 "$SCRIPT_DIR/ghost_scrub.py" session "$session_id" 2>/dev/null || { warn "Scrubbing encountered issues, continuing..." } # Step 4: Index cleanup python3 "$SCRIPT_DIR/ghost_index_cleanup.py" --session-id "$session_id" 2>/dev/null || { warn "Index cleanup encountered issues, continuing..." } # Step 5: Verify python3 "$SCRIPT_DIR/ghost_verify.py" session "$session_id" 2>/dev/null || { warn "Verification encountered issues, continuing..." } # Step 6: Secure delete archived files local archive_dir="$HOME/.openclaw/ghost-archive" if [ -d "$archive_dir" ]; then find "$archive_dir" -type f -exec shred -u {} \; 2>/dev/null || { find "$archive_dir" -type f -exec rm -f {} \; warn "shred unavailable, used rm instead" } # Remove empty directories find "$archive_dir" -type d -empty -delete 2>/dev/null || true fi log "Ghost mode OFF — session $session_id fully scrubbed and verified" ``` ### Technical Analysis Every critical stage converts an error into a warning or ignores it with `|| true`. This defeats the script's global `set -e` safety behavior. Verification failure does not prevent shredding, and the final status message is unconditional. The archive is intended to provide temporary recoverability while scrubbing and verification occur. Continuing to secure deletion after archival, scrubbing, index cleanup, or verification fails can destroy the recovery copy while leaving original traces or ...[truncated 1111 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/ghost_scrub.py:50
Finding

Timestamp-Based Scrubbing Can Delete Memory From Unrelated Sessions

Content
View full analysis
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
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (21)

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
80% confidence
Finding

Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Content

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

md
> ⚠️ **Ghost Mode is installed.** This skill permanently deletes data — logs, memory files, session transcripts, and search index entries — using secure deletion (`shred -u`). This is irreversible. Bugs, misuse, or environment conflicts can cause unrecoverable data loss beyond what you intended. By keeping this skill installed, you accept these risks. **Strongly recommended: set up daily backups of `~/.openclaw/workspace/` and `~/.openclaw/data/`.** Run `ghost_mode.sh status` to check the current state at any time.

This warning must be shown **once** after installation. To prevent repeated warnings, after delivering it, create the file `memory/.ghost-mode-warning-shown` in the workspace. On subsequent sessions, check for this file — if it exists, skip the warning.

**On first install**, the agent MUST also create `ghost-mode-config.json` in the workspace root with confirmation enforced:

Session Persistence

Medium
Category
Rogue Agent
Confidence
97% confidence
Finding

The skill advertises a session that leaves 'no persistent trace' while explicitly preserving independently created files and local outputs. This creates a dangerous privacy mismatch: users may disclose secrets under the assumption of full non-persistence even though artifacts, downloads, generated files, gateway logs, and other traces can remain.

Content

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

md
---
name: ghost-mode
description: Browser-style incognito mode for your OpenClaw agent. Activate to pause all memory writes — when you deactivate, every trace of the session is securely scrubbed from logs, memory files, session transcripts, and search indexes. Like closing an incognito window: nothing persists. Any files or local outputs you independently create during the session remain untouched. Use when user says "ghost on", "ghost off", "incognito", "private mode", "privacy mode", or wants a conversation that leaves no persistent trace in agent memory.
requires:
  bins:
    - python3

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The invocation description includes the broad trigger 'or wants a conversation that leaves no persistent trace in agent memory,' which can cause the skill to activate from ambiguous user intent rather than a precise command. In a destructive/privacy-affecting skill, ambiguous activation increases the risk of unintended suppression of logging and later deletion of session artifacts.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
92% confidence
Finding

The documented use of '--yes' to skip confirmation enables fully automated execution of a destructive cleanup operation that permanently deletes logs, memory files, transcripts, and index entries. In a skill whose core function is irreversible deletion, allowing one-flag suppression of safeguards materially increases the chance of accidental or scripted data destruction.

Content

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

md
# Deactivate and scrub (with confirmation prompt)
./scripts/ghost_mode.sh off

# Skip confirmation prompt (for scripted/automated use)
./scripts/ghost_mode.sh off --yes

# Check status (includes config)

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
94% confidence
Finding

Allowing 'confirm_before_delete' to be disabled in configuration and permitting '--yes' in non-interactive contexts weakens the only meaningful user-consent barrier before irreversible deletion. This makes misuse by automation, operator error, or a compromised agent workflow much more likely to cause silent destructive cleanup.

Content

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

Type yes to confirm, or anything else to cancel:

text

- **Configurable**: Set `"confirm_before_delete": false` in `ghost-mode-config.json` to disable prompts.
- **Non-interactive fallback**: If no terminal is available (e.g., cron, piped input), confirmation is required unless you pass `--yes` / `-y`.
- **`--yes` / `-y` flag**: Skips the confirmation prompt entirely. Use in scripts, cron jobs, or automation.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
93% confidence
Finding

The configuration table explicitly documents turning off confirmation and dry-run defaults, normalizing unattended destructive behavior. Given the skill's purpose of scrubbing and shredding records, these options reduce friction around irreversible deletion and make unsafe deployment practices more likely.

Content

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

md
| Setting | Default | Description |
|---------|---------|-------------|
| `confirm_before_delete` | `true` | Require typing `yes` before any destructive operation. Set `false` to disable prompts. |
| `dry_run_by_default` | `true` | If `true` (default), `ghost off` and `force-cleanup-all` start in dry-run mode. Pass `--yes` to execute for real. Set `false` to skip dry-run by default. |

## What This Skill Touches

Session Persistence

Medium
Category
Rogue Agent
Confidence
96% confidence
Finding

The documentation states that files and local outputs created during a ghost session remain untouched, which conflicts with the broader incognito/no-trace framing elsewhere in the skill. This can mislead users into believing sensitive material handled during the session will be ephemeral, when in reality generated files, artifacts, and downloads may persist on disk.

Content

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

md
## What This Skill Does NOT Touch

- **Files you create** — code, documents, images, configs, anything you explicitly write to disk during a ghost session stays exactly where you put it
- **Local outputs** — command output, build artifacts, downloaded files, anything the agent creates as a file output (not a memory entry) is untouched
- OpenClaw gateway logs — outside agent workspace scope
- OS-level process traces — outside agent workspace scope

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The AGENTS.md integration instructs the agent to avoid mentioning ghost mode unless the user asks, reducing transparency while a destructive mode is active. Hiding the state of a mode that suppresses memory writes and later scrubs records can prevent informed consent and increase the chance of unnoticed data loss or audit bypass.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The architecture explicitly describes irreversible deletion and shredding of session transcripts, checkpoints, and memory artifacts, but it does not pair that behavior with strong user-consent, retention, rollback, or recovery safeguards. In a system handling conversational history and memory, this can cause accidental permanent data loss or anti-forensics behavior if triggered improperly or automatically.

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 · references/ARCHITECTURE.md (reported line 92)May include surrounding context.

md
**Semantic memory** (`memory/semantic/*.md`):
- Removes entries attributed to the ghost session or with timestamps in the ghost window
- Atomic write: write to `.tmp`, then rename

**Episodic memory** (`memory/episodic/*.md`):
- Same approach as semantic

Tainted flow: 'dest' from os.environ.get (line 77, credential/environment) → shutil.copy2 (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/ghost_archive.py (reported line 80)May include surrounding context.

python
dest = archive_dir / src_path.name

        # Copy to archive
        shutil.copy2(src_path, dest)
        print(f"Archived: {src_path.name} -> {archive_dir.relative_to(OPENCLAW_HOME)}", file=sys.stderr)

        # Remove original if full mode, or if checkpoint/split in split mode

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script unlinks original session files after copying them, with no confirmation, dry-run, rollback, or verification that the archive copy is complete and durable beyond copy2 returning. In an agent/automation context, this can cause irreversible loss of session data if invoked against the wrong sessions, with misleading status updates further increasing the chance of silent destructive mistakes.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The function documentation states it will find sessions with status 'completed' and archive them, but the implementation calls list_sessions(status="active"). This is an active contradiction between the stated intent and the actual selection logic, and it materially changes which sessions are affected.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · scripts/ghost_mode.sh (reported line 93)May include surrounding context.

sh
# ── Confirmation ────────────────────────────────────────────────────
confirm_delete() {
    # Check config: if confirm_before_delete is false, skip confirmation
    local require_confirm
    require_confirm=$(get_config_bool "confirm_before_delete" "true")
    if [ "$require_confirm" = "false" ]; then

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · scripts/ghost_mode.sh (reported line 102)May include surrounding context.

sh
# ── Confirmation ────────────────────────────────────────────────────
confirm_delete() {
    # Check config: if confirm_before_delete is false, skip confirmation
    local require_confirm
    require_confirm=$(get_config_bool "confirm_before_delete" "true")
    if [ "$require_confirm" = "false" ]; then

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 · scripts/ghost_mode.sh (reported line 163)May include surrounding context.

sh
echo "════════════════════════════════════════════════════════════════"
        echo ""
        # Mark warning as shown so it only appears once
        mkdir -p "$(dirname "$WARNING_FILE")"
        date -u +"%Y-%m-%dT%H:%M:%SZ" > "$WARNING_FILE"
        log "Warning shown and acknowledged. This message will not appear again."
    fi

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · scripts/ghost_mode.sh (reported line 527)May include surrounding context.

sh
echo ""
        echo "Options:"
        echo "  --dry-run    Show what would be deleted without making any changes"
        echo "  --yes, -y    Skip confirmation prompt (for scripted use)"
        echo ""
        echo "Configuration (ghost-mode-config.json in workspace root):"
        echo "  {"

Tainted flow: 'tmp' from os.environ.get (line 87, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/ghost_registry.py (reported line 88)May include surrounding context.

python
"""Atomic write: save to .tmp then rename."""
    REGISTRY_PATH.parent.mkdir(parents=True, exist_ok=True)
    tmp = REGISTRY_PATH.with_suffix(".tmp")
    with open(tmp, "w") as f:
        json.dump(registry, f, indent=2)
    tmp.rename(REGISTRY_PATH)

Tainted flow: 'FLAG_PATH' from os.environ.get (line 16, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/ghost_registry.py (reported line 182)May include surrounding context.

python
"activatedAt": datetime.now(timezone.utc).isoformat(),
    }
    FLAG_PATH.parent.mkdir(parents=True, exist_ok=True)
    with open(FLAG_PATH, "w") as f:
        json.dump(flag_data, f, indent=2)
    print(f"Ghost mode flag written: {FLAG_PATH}", file=sys.stderr)

Scope Creep

Low
Category
Excessive Agency
Confidence
70% confidence
Finding

Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Content

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

md
This skill is provided **as-is, with no warranties, express or implied.** There is no assurance of fitness for any particular purpose, no guarantee of data safety, and no support commitment.

By installing or using this skill, you accept full responsibility for any outcomes. You use this skill entirely at your own risk. The Author is not liable in any way for any losses, damages, or consequences — direct, indirect, incidental, or otherwise — that result from using this skill. This includes, but is not limited to, data loss, corrupted files, lost sessions, or any other damage arising from the use or inability to use this skill.

You are running a tool whose stated purpose is to permanently delete data. Use it carefully. Back up your workspace.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The subcommand is named 'completed', which implies acting on completed sessions, but its help text says 'Archive all active sessions' and the implementation also targets active sessions. This creates contradictory operator-facing intent signals about what the command is supposed to do.

Content

No source excerpt is available for this finding.