Back to skill

Security audit

Openclaw Diagnostics

Security checks for vulnerabilities and agentic risk

Overview

This diagnostics skill is mostly purpose-aligned, but it can expose broad cross-agent session details and includes admin-level debug/restart behavior that users should review before installing.

Install only if the agent is meant to act as an OpenClaw administrator with permission to inspect all agents' logs and sessions. Prefer using `-a <agent>` for scoped checks, avoid raw/full reports in shared chats, and treat `-f --advanced` as a maintenance operation because it changes configuration and restarts the Gateway.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (1)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/openclaw-diag.sh:641
Finding

Cross-Agent Diagnostic Data Disclosure Through Unredacted Messaging

Content
View full analysis

Vulnerability Details

File Location: scripts/openclaw-diag.sh:641-650, 681-744, 1549-1609, 1742-1782; SKILL.md:42-49
Vulnerability Type: Missing authorization boundaries and disclosure of sensitive diagnostic data
Risk Level: High

Vulnerable Code

python
session_dirs = glob.glob(os.path.join(agents_root, "*/sessions"))
if not session_dirs:
    session_dirs = [SESSIONS_DIR]
all_session_files = []
for sd in session_dirs:
    for ext_pat in ["*.jsonl", "*.jsonl.reset.*", "*.jsonl.deleted.*"]:
        all_session_files.extend(glob.glob(os.path.join(sd, ext_pat)))
if not all_session_files:
    for ext_pat in ["*.jsonl", "*.jsonl.reset.*", "*.jsonl.deleted.*"]:
        all_session_files.extend(glob.glob(os.path.join(SESSIONS_DIR, ext_pat)))

The skill instructions subsequently require the generated output to be sent directly through the messaging tool:

text
message(action="send", message=output)

Technical Analysis

The script discovers every agent session directory under the shared OpenClaw agents root. It reads active session files as well as reset and deleted session artifacts. Unless an optional agent filter is supplied, no authorization boundary limits collection to the requesting user's agent.

Parsed data includes tool-call command summaries, paths, URLs, message previews, tool-result metadata, errors, model usage, run identifiers, and session identifiers. Full-report mode can place these values into stdout. The skill instructions require stdout to be delivered directly through the messaging tool without model review, content classification, redaction, or confirmation.

This violates least privilege: ordinary performance diagnostics do not require unrestricted access to every agent's history, particularly reset or deleted artifacts. The script does not establish that the requester is authorized to inspect the selected agents or receive their diagnostic content.

Att

...[truncated 1868 chars]

Remediation
View remediation

Remediation Suggestions

  1. Enforce requester authorization

    • Resolve the invoking channel identity to an authorized agent or tenant.
    • Reject requests for agents outside that authorization scope.
    • Do not treat a user-supplied -a value as proof of authorization.
  2. Use a least-privilege default

    • Require an explicit authorized agent identifier.
    • Default to the current requester's agent rather than scanning */sessions.
    • Avoid deriving a shared agents root and enumerating every agent directory.
  3. Exclude historical deletion artifacts

    • Stop scanning *.jsonl.reset.* and *.jsonl.deleted.* by default.
    • Place historical or deleted-session inspection behind a separate administrator-only option and explicit confirmation.
  4. Redact sensitive fields

    • Remove message bodies and previews from reports.
    • Redact credentials, API tokens, authorization headers, cookies, private keys, signed URLs, query strings, environment values, and command arguments.
    • Replace local paths, session identifiers, and run identifiers with truncated or pseudonymous values where full values are unnecessary.
    • Apply redaction to both ordinary report fields and unstructured error messages.
  5. Do not send raw output automatically

    • Remove the instruction to send stdout directly without review.
    • Generate a sanitized preview and require confirmation before external delivery.
    • Prefer returning aggregate metrics for standard diagnostics and reserve detailed records for authorized local administration.
  6. Harden filesystem access

    • Run diagnostics under an identity that can read only the authorized agent's logs and sessions.
    • Separate agent session directories using operating-system permissions or tenant-specific service accounts.
    • Log access to detailed and historical diagnostics for security review.
  7. Add security tests

    • Verify that one agent ca ...[truncated 225 chars]
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 (13)

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest presents the skill as a diagnostics/analysis tool, but the documented advanced mode changes openclaw.json and restarts the Gateway, which are state-changing administrative actions. This mismatch is dangerous because users or orchestrators may invoke the skill expecting read-only diagnostics while it can alter service configuration and availability.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

Gateway restart and configuration mutation are powerful administrative capabilities that exceed the justified scope of a diagnostics-focused skill. If triggered accidentally or through ambiguous prompting, they can cause service disruption, configuration drift, or enable more verbose logging that exposes sensitive data.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script contains administrative primitives to discover config files, back them up, modify arbitrary JSON key paths, and later use those changes to affect service behavior. In an agent skill, embedding write-capable config management materially increases the attack surface because a tool expected to inspect diagnostics can be used to persist configuration changes or prepare for service-impacting operations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill is presented as a diagnostics/log analysis tool, but its advanced mode goes beyond observation and performs privileged state changes: it rewrites OpenClaw configuration and restarts the Gateway. That mismatch is dangerous because invoking a seemingly read-only diagnostic skill can unexpectedly alter system behavior, enable verbose debug logging, and cause service disruption or broaden data exposure.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill exposes operational capabilities through exec and read, and the documented behavior clearly reads local logs/session files and invokes shell commands, but it does not declare a restrictive tool scope such as allowed tools, paths, or command constraints. That gap increases the blast radius of prompt/skill misuse because a diagnostics skill can access broader local state than users may expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The natural-language triggers are broad terms like diagnostics, performance, run status, and agent analysis, which can overlap with ordinary conversation. Overbroad triggering is dangerous because it can cause unintended execution of shell-based diagnostics and disclosure of operational data when the user did not explicitly request a command run.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill instructs direct execution and raw forwarding of script output, including chunked passthrough via messaging, without warning that logs and session-derived output may contain sensitive operational or user data. This creates a straightforward exfiltration path from local diagnostic artifacts into the chat channel with no filtering, minimization, or contextual review.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Direct raw forwarding of diagnostic output is especially risky here because the declared data sources include debug logs and session JSONL files, which may contain prompts, tool arguments, identifiers, errors, and other sensitive session content. Sending that output verbatim to the user bypasses model review and filtering, increasing the chance of leaking private or security-relevant data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The advanced mode documentation states that configuration will be modified and the Gateway restarted, but it does not provide a strong user-impact warning or require elevated confirmation. That is dangerous because users may treat it as a normal diagnostic option and unintentionally trigger downtime or environment changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented advanced mode automatically changes local diagnostic settings and restarts the Gateway, which can disrupt active workloads and alter system state without an explicit safety warning or confirmation step described in the reference. In a diagnostics skill, this is especially risky because users may expect read-only analysis, but the feature performs state-changing operations that can cause service interruption, unexpected debug logging, and persistence of sensitive logging until restored.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill reads from session logs and agent session files that may contain prompts, tool arguments, message content, and other sensitive operational data, yet it does not provide a clear user-facing warning before doing so. This increases the chance that operators or downstream consumers unintentionally expose confidential data during routine diagnostics.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script parses session files and surfaces detailed tool invocation arguments such as shell commands, filesystem paths, URLs, search queries, message text, and edit diffs. Those fields can contain secrets, proprietary code paths, internal endpoints, user content, or operational details, so exposing them in diagnostic output creates a confidentiality risk disproportionate to the skill's stated purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script’s user-facing natural-language content, including title, usage comments, prompts, and help text, is presented only in Chinese. This imposes a specific language/locale on users without opt-in or an alternative language path, which matches the stated policy concern for forced language selection.

Content

No source excerpt is available for this finding.