Back to skill

Security audit

Sleep

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent sleep/resume purpose, but it installs a shared persistent hook, resets sessions, and stores detailed session context in plaintext without enough scoping or safeguards.

Review this carefully before installing. It may be useful if you intentionally want session sleep/resume behavior, but install it only if you accept a global persistent hook, session resets, local gateway-token use, and plaintext recovery files. Avoid storing secrets or personal data in previews, restrict file permissions, and remove or disable the hook when no longer needed.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T02 · Agent Memory Poisoning

Error
Location
references/hook-template/handler.ts:50
Finding

Persistent Agent Context Poisoning Through Untrusted Preview Content

Content
View full analysis
{ const m = content.match(regex); return m ? m[1].trim().replace(/^[\s-]+/gm, "") : "(无)"; }; const summary = extract(/##\s*本次 session 摘要[\r\n]+([\s\S]*?)(?=##\s*未完成|##\s*醒来|##\s*关键)/i); const items = extract(/##\s*未完成事项[\r\n]+([\s\S]*?)(?=##\s*醒来|##\s*关键)/i); const nextStep = extract(/##\s*醒来后第一步[\r\n]+([\s\S]*?)(?=##\s*关键)/i); const context = extract(/##\s*关键上下文[\r\n]+([\s\S]*?)(?=##\s*状态|$)/i); const recoveryText = [ "🌙 检测到上次 session 有未完成事项,恢复上下文:", "", `**上次 session 摘要**:${summary}`, "", `**未完成事项**:\n${items}`, "", `**醒来后第一步**:${nextStep}`, "", `**关键上下文**:${context}`, "", "请根据上述信息,继续处理未完成的事项。", ].join("\n"); log(`[hook] Recovery text length: ${recoveryText.length} chars`); // 注入到 bootstrapFiles if (event.context && Array.isArray(event.context.bootstrapFiles)) { event.context.bootstrapFiles.unshift({ path: `memory:session-recovery/${sessionKey}.md`, content: recoveryText, isInline: true, }); log(`[hook] Injected via bootstrapFiles (count=${event.context.bootstrapFiles.length})`); } else { log(`[hook] bootstrapFiles not available, context keys: ${JSON.stringify(Object.keys(event.context || {}))}`); } ``` ### Technical Analysis The hook treats the preview file as trusted recovery information and inserts its contents directly into `event.context.boo ...[truncated 1964 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
references/hook-template/handler.ts:35
Finding

Preview File Path Traversal Through Unvalidated Session Key

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:36
Finding

Plaintext Persistence of Potentially Sensitive Session Information

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (9)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly allows the agent to decide on its own when to invoke a workflow that writes state to disk and resets the current session. A vague self-invocation condition increases the chance of unintended activation, causing premature context loss or persistence of sensitive data without a clear user-triggered boundary.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The description advertises recording unfinished items and resetting the session, but does not clearly warn about the operational effect of losing active conversational context at invocation time. Because reset is central to the workflow, insufficient warning can cause users or agents to trigger a disruptive action without understanding the immediate consequences.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger description says the agent may activate the skill whenever it thinks the session is suitable to end or pause, but it provides no concrete constraints. In a skill that performs reset behavior, this ambiguity can lead to accidental disruption, inconsistent state handling, and unexpected carryover of persisted context.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill directs the agent to persist detailed unfinished work, including code paths, configuration values, API endpoints, and error information, then reinject that material into a later session. That creates a durable store of potentially sensitive operational and user-derived context, increasing exposure if the preview files are accessed by other processes, users, or future sessions beyond the original trust boundary.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
87% confidence
Finding

The workflow creates persistent preview files under the user's home workspace specifically to survive a session reset and be loaded later. While session persistence is the stated purpose, it also extends the lifetime and accessibility of contextual data, which can expose sensitive information and create cross-session leakage risks if storage controls are weak.

Content

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

md
AGENT_SESSION_KEY="agent:main:feishu:group:oc_87d0d49f1f81f9e1b8dd1d5ad5f9ec72"  # 替换为 Step 1 获取的值
PREVIEW_DIR="$HOME/.openclaw/workspace/previews"  # 替换为你的工作空间路径

mkdir -p "$PREVIEW_DIR"

TOKEN="$(cat ~/.openclaw/openclaw.json | python3 -c "import json,sys; c=json.load(sys.stdin); print(c['gateway']['auth']['token'])")"
openclaw gateway call sessions.reset \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill instructs reading a gateway authentication token directly from a local configuration file and passing it into a command, without any credential-handling safeguards. This normalizes unsafe secret access patterns and increases the risk of token exposure through logs, shell history, copied snippets, or downstream tooling.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This TypeScript file includes natural-language comments, parsing rules for Chinese headings, and injected recovery text entirely in Chinese. Because the skill does not offer a language choice or document that it is intentionally limited to a Chinese-speaking environment, it violates the language/locale policy for natural-language behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The entire skill documentation, including installation, verification, triggers, and error guidance, is written only in Chinese. This imposes a language choice on users without stating that the skill is Chinese-only or offering an alternative language, which matches the policy category for language/locale constraints without opt-in.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
91% confidence
Finding

The documentation instructs users to install a shared hook under ~/.openclaw/workspace/hooks/ and restart the gateway so it applies automatically to all agents and future sessions. That creates persistent cross-session behavior and expands the trust boundary from a per-skill install to a global mechanism, which is risky because a hook can observe or modify agent behavior beyond the originating session.

Content

Scanner excerpt · references/implementation.md (reported line 41)May include surrounding context.

text

```bash
mkdir -p ~/.openclaw/workspace/hooks/session-sleep-wake
cp skills/sleep/references/hook-template/HOOK.md ~/.openclaw/workspace/hooks/session-sleep-wake/
cp skills/sleep/references/hook-template/handler.ts ~/.openclaw/workspace/hooks/session-sleep-wake/