Back to skill

Security audit

多窗口模式

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent window manager, but it can persist sensitive chat history and may save the wrong session's transcript into a window.

Review before installing. Use this only if you are comfortable with full conversation history being copied into persistent local window folders and later shown again. Avoid using it around secrets or confidential chats until it binds windows to explicit session IDs, uses private file permissions, and offers clear controls to disable, redact, or delete saved transcripts.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/switch.py:58
Finding

Unrelated Session Transcript May Be Captured During Window Switching

Content
View full analysis

Vulnerability Details

File Location: scripts/switch.py, lines 58–75 and 92–96
Vulnerability Type: Cross-session data exposure caused by insecure session selection
Risk Level: High

Vulnerable Code

python
def get_latest_session_path():
    """获取最新活跃的 session jsonl 文件"""
    if not os.path.exists(SESSIONS_DIR):
        return None
    
    sessions = []
    for f in os.listdir(SESSIONS_DIR):
        if f.endswith(".jsonl") and not f.endswith(".deleted") and not f.endswith(".reset"):
            path = os.path.join(SESSIONS_DIR, f)
            mtime = os.path.getmtime(path)
            sessions.append((mtime, path))
    
    if not sessions:
        return None
    
    # 返回最新的 session
    sessions.sort(reverse=True)
    return sessions[0][1]
python
# 获取最新 session
session_path = get_latest_session_path()
if session_path:
    dest_path = os.path.join(output_dir, "transcript.jsonl")
    shutil.copy2(session_path, dest_path)

Technical Analysis

The code identifies the current session by selecting the JSONL file with the most recent modification time. File modification time is not a reliable session-identity or authorization mechanism.

The current window is not bound to an authoritative runtime session identifier before its transcript is copied. If another agent, session, or background process modifies a different transcript more recently, that unrelated transcript becomes the selected source. The implementation then copies it into the current window without checking that it belongs to the active session.

This behavior undermines the documented context-isolation property and can cause one session's conversation history to be persisted and displayed in another window.

Attack Path

  1. A user has a work window selected through current.json.
  2. Another session transcript under ~/.openclaw/agents/main/sessions is created or updated after the intended session transcript.
  3. The user invokes the window-switch operation.

...[truncated 1163 chars]

Remediation
View remediation

Remediation Suggestions

  • Bind every window to the authoritative session identifier supplied by the runtime.
  • Persist the exact session identifier in current.json and the window metadata.
  • Resolve the transcript only from that identifier instead of scanning files by modification time.
  • Before copying, verify that the resolved transcript belongs to the expected session and is located inside the canonical sessions directory.
  • Reject the save operation if the session identifier is absent, malformed, unknown, or inconsistent with the active runtime session.
  • Use canonical path validation and disallow symbolic-link sources where feasible.
  • Add tests involving multiple concurrently updated session files to confirm that only the explicitly bound session can be copied.
  • Avoid displaying historical messages automatically unless the user has explicitly requested restoration and the transcript association has been verified.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/switch.py:88
Finding

Sensitive Conversation Data Is Persisted Without Explicit File Access Controls

Content
View full analysis

Vulnerability Details

File Location: scripts/switch.py, lines 88–96; scripts/save_as_window.py, lines 95–107
Vulnerability Type: Plaintext sensitive-data storage with permissions dependent on the process umask
Risk Level: Medium

Vulnerable Code

python
task_dir = get_task_dir(task_id, name)
output_dir = os.path.join(task_dir, "output")
os.makedirs(output_dir, exist_ok=True)

# 获取最新 session
session_path = get_latest_session_path()
if session_path:
    dest_path = os.path.join(output_dir, "transcript.jsonl")
    shutil.copy2(session_path, dest_path)

The same storage weakness is present when explicitly saving conversation context:

python
def save_context_to_window(window_id, window_dir, context_content):
    """保存对话上下文到窗口"""
    context_file = os.path.join(window_dir, "output", "context.md")
    
    content = []
    content.append(f"# 窗口上下文 - {window_id}")
    content.append(f"\n保存时间:{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
    content.append(f"来源:从临时对话保存")
    content.append("\n---\n")
    content.append(context_content)
    
    with open(context_file, "w") as f:
        f.write("\n".join(content))

Technical Analysis

The Skill stores complete transcripts and supplied conversation context in plaintext. It creates directories with os.makedirs() and files with ordinary open() operations without setting restrictive access modes.

Consequently, confidentiality depends on the environment's process umask and the permissions of parent directories. Under a permissive configuration, the resulting task directories or files may be readable by other local users or processes. shutil.copy2() also copies source metadata, so the destination transcript's mode can inherit inappropriate source permissions rather than enforcing a private destination mode.

Conversation transcripts are potentially sensitive records and should not rely on ambient filesystem defaults for access control.

Attack Path

  1. A user switches wo ...[truncated 1264 chars]
Remediation
View remediation

Remediation Suggestions

  • Create the task root and all window directories with mode 0700.
  • Create transcript, context, metadata, current-state, and summary files with mode 0600.
  • After shutil.copy2(), explicitly set the destination transcript to 0600; alternatively, copy through a securely opened destination that enforces the intended mode.
  • Verify that task storage and files are owned by the expected operating-system account.
  • Use atomic writes through a private temporary file in the same directory, followed by os.replace().
  • Reject symbolic links and verify canonical destination paths before writing sensitive data.
  • Document retention behavior and provide a secure deletion mechanism for archived or obsolete transcripts.
  • Consider encryption at rest where local threat models require protection beyond Unix file permissions.
  • Add automated tests that run under permissive umasks and verify that saved directories and files remain private.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (16)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill states that it will automatically save the current session transcript and reload prior dialogue when switching windows, but it does not prominently warn users that full conversation history is being persisted and re-displayed. This creates a privacy and data-handling risk because sensitive content from one work context may be stored longer than expected and exposed again later.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly instructs the system to save full conversation transcripts and later load them back into view when switching windows. That behavior can leak user-provided secrets, personal data, credentials, or confidential work content across sessions or shared environments, undermining the claimed context isolation.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The switch-window example shows historical user and assistant messages being replayed directly into the active context. This is a semantic data-leak pattern because prior sensitive information can be surfaced unexpectedly in a future interaction, especially if the user assumes windows are isolated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file contains user-facing natural-language strings exclusively in Chinese, including the module description and command-line usage/output messages. This imposes a specific language on users without any visible opt-in or alternative, which matches the language/locale policy-violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script's docstrings, status values, default task name, and console messages are all hard-coded in Chinese, with no option for the user to select another language. This is a natural-language policy concern because it imposes a specific locale without opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The docstring states the skill's function in Chinese ("列出所有任务"), and all user-facing output strings in the file are also hard-coded in Chinese. This imposes a specific language/locale on users without any opt-in or indication that the skill is region-specific, which matches the natural-language policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script's natural-language interface and outputs are hard-coded in Chinese, including the docstring, default query period, and all user-facing messages. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script persists conversation content and associated session metadata directly to disk with no user confirmation, preview, or sensitivity check. In an agent context, conversation history commonly contains secrets, personal data, or internal prompts, so silently writing it to a predictable location increases the risk of unintended disclosure or long-term retention.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script overwrites current.json to switch the active window automatically, modifying session state without prior disclosure or validation. This can cause session confusion, unexpected context switching, or loss of operational integrity if other tools rely on the current session pointer.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

User-facing strings including the module docstring, error messages, usage text, and success output are all written in Chinese. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file’s user-facing docstrings and CLI messages are written exclusively in Chinese, such as the module description and window-switching/status outputs. This imposes a specific language on users without offering a choice or documenting a justified region-specific limitation, which matches the locale policy violation criteria.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script automatically copies the latest session transcript into a task-specific window directory during window switching, with no user confirmation, access control check, or privacy notice. Because session files may contain sensitive prompts, secrets, or context from a different task, this creates a real risk of unintended data persistence and cross-context disclosure, especially in a multi-task or shared-environment workflow.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

Most of the operational guidance, commands, and user-facing examples are written in Chinese, which effectively constrains use to a specific language. The file does not indicate that users may choose another language or that the Chinese-only presentation is required for a region-specific purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code creates directories and writes JSON files under the user's home directory, which modifies persistent user data. While it prints the created path after completion, there is no pre-action warning, confirmation, or explanatory comment/docstring disclosing that it will create and update files in ~/.openclaw/workspace/memory/tasks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The script's user-facing docstrings and printed status messages are entirely in Chinese, which imposes a specific language on users without any visible opt-in or alternate locale support. This matches the policy category for language or locale constraints expressed through natural-language content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The top-level natural-language documentation and user-facing descriptions are exclusively in Chinese, which imposes a language choice without offering alternatives or opt-in. Under the policy, forcing a specific language can be a locale/language policy violation unless the constraint is explicitly justified or optional.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.