T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/search_sessions.sh:14- Finding
Unrestricted Cross-Session Search Exposes Sensitive Conversation Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/search_sessions.sh:14, 41-49, 94-103; related instructions inSKILL.md:23-57
Vulnerability Type: T05: Unauthorized Access and Privilege Escalation
Risk Level: MediumVulnerable code:
bash SESSIONS_DIR="${OPENCLAW_SESSIONS_DIR:-${HOME}/.openclaw/agents/main/sessions}"bash # Count total matches (using find to avoid glob expansion issues) TOTAL=$(find "$SESSIONS_DIR" -maxdepth 1 -name '*.jsonl' -exec grep -l "$KEYWORD" {} + 2>/dev/null | wc -l) ARCHIVED=$(find "$SESSIONS_DIR" -maxdepth 1 -name '*.reset.*' -exec grep -l "$KEYWORD" {} + 2>/dev/null | wc -l) echo "Found in $TOTAL active session(s), $ARCHIVED archived session(s)" echo "" # Search active .jsonl files (current sessions) find "$SESSIONS_DIR" -maxdepth 1 -name '*.jsonl' -exec grep -l "$KEYWORD" {} + 2>/dev/null | while read -r f; dobash # Report archived matches if [ "$ARCHIVED" -gt 0 ]; then echo "=== Archived sessions with matches ===" find "$SESSIONS_DIR" -maxdepth 1 -name '*.reset.*' -exec grep -l "$KEYWORD" {} + 2>/dev/null | head -5 | while read -r f; do echo " $(basename "$f")" done echo " (use 'grep' directly on these files for details)" fiThe associated skill instructions explicitly expand recovery to private data sources:
markdown ### Step 1: Same-channel transcript Read the `.jsonl` transcript for the current session: 1. Look up the session associated with this channel via `sessions_list` or `sessions.json` 2. Read `~/.openclaw/agents/{agent}/sessions/{sessionId}.jsonl` (default agent: `main`) 3. For large files, read the **tail** first (`tail -n 200`) rather than loading the entire file 4. Check for `.reset` files with the same sessionId prefix (pre-compaction data) 5. If the message is a thread reply, read the parent message first ### Step 3: Cross-channel and cron search Messages often originate from cron ...[truncated 2066 chars]- Remediation
View remediation
Remediation Suggestions
- Restrict searches to the current authorized session by default.
- Require explicit user confirmation before accessing archived sessions, other channels, cron sessions, or shared memory.
- Enforce authorization by user identity, channel, agent, and tenant before opening a transcript.
- Maintain an allowlist of permitted transcript paths instead of scanning an entire configurable directory.
- Redact credentials, tokens, passwords, and personal data before emitting excerpts.
- Return only the minimum context necessary and avoid printing raw transcript content to standard output.
- Add audit logging that records file access without recording sensitive matched content.
- Document and enforce a retention policy for archived transcript and reset files.
