T05 · Unauthorized Access and Privilege Escalation
- Location
- incremental_slice.py:52
- Finding
- Deleted and Reset Conversation Transcripts Are Collected and Persisted Without Data-Minimization Controls## Vulnerability Details **File Location**: `incremental_slice.py:22`, `incremental_slice.py:52-62`, and `incremental_slice.py:96-120` **Vulnerability Type**: Excessive access to deleted conversation data and plaintext sensitive-data retention **Risk Level**: High ### Vulnerable Code ```python SESSIONS_DIR = Path("/home/aqukin/.openclaw/agents/main/sessions") ``` ```python def get_session_files(): files = [] if SESSIONS_DIR.exists(): for f in SESSIONS_DIR.glob('*.jsonl'): files.append(f) for f in SESSIONS_DIR.glob('*.jsonl.reset.*'): files.append(f) for f in SESSIONS_DIR.glob('*.jsonl.deleted.*'): files.append(f) return sorted(files, key=lambda x: x.stat().st_mtime, reverse=True) ``` ```python def create_slice(session_file, start_line, end_line, content_lines): timestamp = datetime.now().strftime('%Y%m%d_%H%M%S') slice_name = f"slice_{session_file.stem}_{start_line}_{end_line}_{timestamp}.json" slice_path = CHUNKS_DIR / slice_name content = ''.join(content_lines) slice_data = { 'source': str(session_file), 'source_name': session_file.name, 'start_line': start_line, 'end_line': end_line, 'timestamp': timestamp, 'content': content, 'line_count': len(content_lines) } with open(slice_path, 'w', encoding='utf-8') as f: json.dump(slice_data, f, indent=2, ensure_ascii=False) return slice_path ``` ### Technical Analysis Reading active conversation transcripts is consistent with the declared memory-distillation purpose. However, the scanner deliberately includes files marked as reset or deleted. This exceeds the minimum data scope needed to process current conversations and undermines the expected effect of conversation deletion or reset operations. The selected transcript lines are copied verbatim into persistent ...[truncated 2529 chars]
- Remediation
- ## Remediation Suggestions 1. Exclude deleted and reset transcripts by default: ```python def get_session_files(): if not SESSIONS_DIR.exists(): return [] return sorted( SESSIONS_DIR.glob('*.jsonl'), key=lambda path: path.stat().st_mtime, reverse=True, ) ``` 2. Require a clearly documented, explicit opt-in before processing historical reset files. Deleted files should not be processed under normal operation. 3. Add a configurable allowlist of sessions or conversation identifiers rather than scanning the entire main-agent session directory. 4. Redact credentials and sensitive values before writing chunks. At minimum, detect API keys, authorization headers, private keys, access tokens, passwords, cookies, and common connection strings. 5. Avoid retaining full raw transcript content where possible. Store only the minimum extracted fields needed for processing, and delete raw chunks immediately after successful extraction. 6. Create directories and files with owner-only permissions, such as directory mode `0700` and file mode `0600`, independent of the ambient process umask. 7. Implement a documented retention policy and a secure cleanup command that removes chunks, task files, state entries, and derived cards associated with a deleted source conversation. 8. Add installation and uninstall documentation covering removal of the recommended cron entries so processing does not continue after the Skill is no longer wanted.
