T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/setup.js:64- Finding
Cross-Workspace Agent Session Discovery Can Expose Unrelated Conversation Logs
- Content
View full analysis
{ const sessDir = path.join(agentsDir, d, 'sessions'); return fs.existsSync(sessDir) && fs.statSync(sessDir).isDirectory(); }); if (agents.length > 0) { // Pick the agent with the most session files (likely the primary agent) let best = null; let bestCount = 0; for (const agent of agents) { const sessDir = path.join(agentsDir, agent, 'sessions'); const files = fs.readdirSync(sessDir).filter(f => f.endsWith('.jsonl')); if (files.length > bestCount) { bestCount = files.length; best = { agentId: agent, sessionsPath: sessDir }; } } if (best) return best; } } const parent = path.dirname(dir); if (parent === dir) break; // reached filesystem root dir = parent; } return null; } ``` ### Technical Analysis The setup process walks upward from the selected workspace to the filesystem root while searching for an `.openclaw/agents` directory. Once one is found, it enumerates every agent beneath that directory and automatically chooses the agent with the largest number of `.jsonl` session files. No check establishes that the selected agent belongs to the requested workspace, is owned by the current user, or was explicitly selected for memory processing. The generated configuration records the selected session directory, and the documented dream workflow subse ...[truncated 1541 chars]- Remediation
View remediation
