Back to skill

Security audit

Agent Sleep

Security checks for vulnerabilities and agentic risk

Overview

This skill needs review because it advertises memory cleanup and scheduling, but ships an undeclared note utility that can read and write an unrelated notes file outside the skill workspace.

Review before installing. Do not enable scheduling until the author removes or clearly documents the external note.py integration, fixes the missing/wrong command paths, and defines exact paths and confirmation behavior for any archival, deletion, memory update, or CortexGraph sync operations.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/note.py:11
Finding

Undocumented Cross-Project File Read and Write Access

Content
View full analysis

Vulnerability Details

File Location: scripts/note.py, lines 11-28
Vulnerability Type: Unauthorized access to files outside the Skill workspace
Risk Level: Medium

Evidence

python
NOTE_TAKER_DIR = Path("/Users/guohongbin/mcp-note-taker")
NOTES_FILE = NOTE_TAKER_DIR / "notes.txt"

def add_note(content):
    timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    entry = f"\n[{timestamp}] {content}"
    
    with open(NOTES_FILE, "a") as f:
        f.write(entry)
    print(f"✅ Note saved to {NOTES_FILE}")

def list_notes(last_n=10):
    if not NOTES_FILE.exists():
        print("No notes found.")
        return

    with open(NOTES_FILE, "r") as f:
        lines = f.readlines()

The command dispatch that exposes these operations appears at lines 34-48:

python
if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: note <text> | note --list")
        sys.exit(1)
        
    cmd = sys.argv[1]
    if cmd == "--list":
        list_notes()
    else:
        # Join all arguments as the note content
        content = " ".join(sys.argv[1:])
        add_note(content)

Technical Analysis

The bundled utility uses an absolute, author-specific path to access another project's data. That location is outside both the Skill package and the expected OpenClaw workspace. This violates least privilege because note storage access is unrelated to the declared memory consolidation and sleep-cycle functionality.

Running the script with --list reads the external note file and prints its contents. Running it with any other arguments appends those arguments to the same file. There is no path validation, workspace-boundary check, user confirmation, or documented configuration governing this access.

The issue does not elevate operating-system privileges: all access remains limited to files available under the invoking user's pe ...[truncated 1248 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove scripts/note.py from the package if note-taking is not part of the declared Skill functionality.
  2. If integration is required, replace the hard-coded path with an explicit, user-provided configuration value.
  3. Default storage to a dedicated directory within the approved OpenClaw workspace.
  4. Resolve and normalize the configured path, then verify that it remains inside an approved storage root.
  5. Require explicit user confirmation before reading from or writing to storage owned by another application.
  6. Document the integration, accessed files, supported operations, and associated privacy implications.
  7. Apply restrictive file permissions and avoid printing note contents unless disclosure was explicitly requested and authorized.
  8. Add error handling for missing directories, permission failures, symbolic links, and unexpected file types.

T06 · System Persistence

Note
Location
SKILL.md:33
Finding

Documentation Encourages Persistent Scheduled Execution

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 33-37 and 76-81; README.md, lines 49-56
Vulnerability Type: Recurring Cron or heartbeat execution
Risk Level: Low

Evidence

SKILL.md documents a scheduling interface:

bash
python3 scripts/schedule.py --set "0 3 * * *"  # 3 AM sleep

It also recommends recurring jobs:

bash
# Deep sleep every day at 3 AM
python3 scripts/schedule.py --set "0 3 * * *"

# CortexGraph synchronization every 6 hours
python3 scripts/schedule.py --set "0 */6 * * *"

README.md provides a persistent Cron or heartbeat configuration:

json
{
  "schedule": "0 3 * * *", // Run at 3 AM
  "command": "python3 ~/.openclaw/skills/agent-sleep/src/run_sleep_cycle.py"
}

Technical Analysis

The documentation instructs users to configure recurring background execution that survives the initial Skill run. If established, such a schedule creates a persistent execution channel under the user's account. Changes made later to the scheduled script could consequently execute without a new interactive approval.

The reviewed package does not automatically install a scheduled task. Moreover, the documented scripts/schedule.py file is absent, and the README refers to src/run_sleep_cycle.py, while the shipped entrypoint is under scripts/. The documented commands are therefore nonfunctional as supplied. Exploitation requires a user or agent to repair the paths or independently register the recurring job.

Attack Path

  1. A user follows the recommendation to configure a daily Cron or heartbeat task.
  2. Because the documented files are absent or incorrectly located, the user repairs the command to point to the shipped entrypoint.
  3. The scheduler stores the recurring task outside the lifetime of the current Skill invocation.
  4. The Skill package or scheduled script is subsequently modified or replaced.
  5. At the next scheduled interval, the ...[truncated 641 chars]
Remediation
View remediation

Remediation Suggestions

  1. Make scheduling explicitly opt-in and require informed user confirmation before registering any recurring task.
  2. Correct all paths so the documentation references the actual shipped entrypoint, scripts/run_sleep_cycle.py.
  3. Remove references to the nonexistent scripts/schedule.py unless a reviewed implementation is added.
  4. Do not silently create or modify Cron, heartbeat, startup, or service configurations.
  5. Document how users can inspect, disable, and completely remove scheduled execution.
  6. Pin the scheduled command to a trusted, immutable version or verify the script's integrity before every run.
  7. Use a minimally privileged account and restrict filesystem access available to the scheduled process.
  8. Log each scheduled invocation and provide a visible indication that persistent execution is enabled.
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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (17)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

该技能声明执行记忆整合、日志归档、工作区清理及 CortexGraph 同步,但静态分析显示这些核心能力并未实现,反而存在其他读写外部笔记或无关目录的行为。此类描述与行为不一致会误导用户和调度系统,使其在错误信任前提下授予权限,进而导致越权访问、数据泄露或非预期修改。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

该技能声明执行记忆整合、日志归档、工作区清理及 CortexGraph 同步,但静态分析显示这些核心能力并未实现,反而存在其他读写外部笔记或无关目录的行为。此类描述与行为不一致会误导用户和调度系统,使其在错误信任前提下授予权限,进而导致越权访问、数据泄露或非预期修改。

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file implements a note-taking utility, but the declared skill purpose is sleep-related memory consolidation, log archival, and workspace cleanup. This capability mismatch is security-relevant because it introduces undeclared data-handling behavior, making it easier to hide persistence or collection of user content under an unrelated skill label.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly describes moving logs to an archive and deleting temporary and log files, but it provides no warning, confirmation step, scope limitation, or rollback guidance. In an agent skill, destructive filesystem operations can cause unintended data loss or removal of forensic/debug artifacts, especially if users invoke it without understanding the side effects or if path handling in the implementation is broader than expected.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README describes compression, memory updates, archival, and cleanup, but does not prominently warn users that the skill modifies workspace data and may remove or relocate files. In this context, the omission increases risk because users may schedule the skill automatically and unknowingly permit recurring state-changing operations on logs and temporary files.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documented manual trigger phrase, "Run a sleep cycle.", is broad enough to plausibly occur in ordinary conversation or be embedded in untrusted content, which can cause unintended execution of archival and cleanup actions. In this skill's context, accidental activation is more dangerous because the action reads logs, updates memory, archives data, and deletes temporary files, all of which change workspace state.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill documents file-reading and file-writing behaviors but does not declare any explicit tool scope or permissions boundaries. In an agent ecosystem, missing scope declarations can cause the skill to run with broader-than-expected filesystem access, increasing the chance of unintended reads, writes, archival, or deletion of user data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The Deep Sleep workflow explicitly describes appending to MEMORY.md, archiving logs, and deleting temporary files, but it does not warn users about modification, movement, or deletion of data. In a maintenance skill, this is especially risky because scheduled or unattended execution can silently alter or remove user information without informed consent or recovery planning.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The CortexGraph synchronization flow describes syncing MEMORY.md and daily logs to another system without any privacy or data-sharing warning. Even if CortexGraph is local in some setups, users need to know that memory and log contents may be transmitted, copied, or retained outside the original workspace, which can expose sensitive information.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script hard-codes an external directory and appends data into another tool's storage without validation, ownership checks, or user confirmation. Writing into unrelated application state can cause unauthorized cross-tool data modification, leakage of sensitive content into an unexpected location, and trust-boundary violations that are especially concerning in an agent skill.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script is described as performing memory compression and context cleanup, but it only reads the current day's log and prints status messages. This creates a deceptive operational state where users or higher-level automation may believe housekeeping occurred when it did not, leading to retention of sensitive logs and failed maintenance assumptions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This Python file contains its title, docstrings, comments, and printed user-facing messages in Chinese only. The policy requires flagging language or locale constraints when a skill forces a specific language without user opt-in, and this file provides no alternative language handling or justification for the locale restriction.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The user-facing output explicitly claims that memory was compressed and context cleared even though no such actions occur. This is dangerous because operators may rely on the output for privacy, storage, or compliance expectations, while sensitive data remains untouched on disk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

Nearly all user-facing instructional content is presented only in Chinese, while no opt-in or locale justification is provided. Under the policy, forcing a specific language without user choice can be a natural-language policy violation unless the regional constraint is explicitly documented.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The package description is written entirely in Chinese ("睡眠系统 - 记忆整合、日志归档、CortexGraph 同步"), which indicates a fixed language choice in user-facing natural language. The file does not offer an alternative language, opt-in, or any justification that this skill is intended only for a Chinese-language or region-specific audience.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The code persists user-provided content directly to disk without nearby disclosure or guardrails, which creates a transparency and privacy issue. Even if the behavior is simple, users of a sleep/cleanup skill would not reasonably expect arbitrary text they provide to be stored in a notes file under another tool's directory.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.