T05 · Unauthorized Access and Privilege Escalation
- 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: HighVulnerable 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
-
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
-avalue as proof of authorization.
-
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.
-
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.
- Stop scanning
-
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.
-
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.
-
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.
-
Add security tests
- Verify that one agent ca ...[truncated 225 chars]
-
