T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/manage_tasks.py:27- Finding
Session Enumeration and Plaintext Storage of Routing Metadata
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:96-98,SKILL.md:252-254,scripts/manage_tasks.py:27-44,scripts/manage_tasks.py:80
Vulnerability Type: Excessive session discovery and insecure storage of session routing identifiers
Risk Level: MediumVulnerable Code and Instructions
SKILL.md:96-98:markdown - **`delivery`** — **Required field** - `channel` — Target channel ID - `sessionKey` — Target session key obtained from `openclaw sessions`SKILL.md:252-254:markdown 2. **Delivery must be stored.** 3. **How to obtain sessionKey:** use `openclaw sessions --agent main --active 60 --json` to view recent sessions.scripts/manage_tasks.py:27-44:python STATE_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "memory") STATE_FILE = os.path.join(STATE_DIR, "smart-reminder-tasks.json") def _ensure_state(): os.makedirs(STATE_DIR, exist_ok=True) if not os.path.exists(STATE_FILE): with open(STATE_FILE, "w", encoding="utf-8") as f: json.dump({"config": {}, "tasks": {}}, f, ensure_ascii=False, indent=2) with open(STATE_FILE, "r", encoding="utf-8") as f: state = json.load(f) if "config" not in state: state["config"] = {} if "tasks" not in state: state["tasks"] = {} return state def _save_state(state): with open(STATE_FILE, "w", encoding="utf-8") as f: json.dump(state, f, ensure_ascii=False, indent=2)scripts/manage_tasks.py:80:python task["delivery"] = {"channel": channel, "sessionKey": session_key}Technical Analysis
The Skill directs the agent to enumerate recently active sessions for the entire
mainagent to identify a delivery destination. This query can disclose metadata for sessions unrelated to the user who requested the reminder. The design therefore exceeds the least-privilege requirement of accessing only the inv ...[truncated 1989 chars]- Remediation
View remediation
Remediation Suggestions
- Obtain the channel and destination identifier directly from trusted invocation context instead of enumerating all recent main-agent sessions.
- Restrict session discovery to the current user, account, and invoking session when enumeration is unavoidable.
- Do not retain a full session key unless persistent cross-channel delivery strictly requires it.
- Store an opaque, narrowly scoped delivery reference instead of a general session identifier where supported.
- Segregate state by authenticated user or tenant and verify ownership before reading or using delivery metadata.
- Create the state directory and file with owner-only permissions, such as directory mode
0700and file mode0600, while accounting for platform differences. - Use atomic writes with explicit permissions to prevent replacement or accidental permission widening.
- Redact session keys from command output, logs, diagnostics, and task-listing interfaces.
- Define a retention period and remove routing metadata when its associated reminder is canceled, deleted, or expires.
- Validate the destination against the authenticated requester's permitted channels before every delivery.
