T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- scripts/todo_manager.py:18
- Finding
- Undisclosed Access to a Hard-Coded File Outside the Skill Directory<![CDATA[ ## Vulnerability Details **File Location**: `scripts/todo_manager.py`, lines 18–28 **Vulnerability Type**: Hard-coded external storage path and insufficient path-boundary enforcement **Risk Level**: Medium ### Vulnerable Code ```python TODO_FILE = "/home/openclaw/.openclaw/workspace/backtest/todo.json" def load(): if os.path.exists(TODO_FILE): with open(TODO_FILE) as f: return json.load(f) return {"version": "1.0", "updated": "", "items": []} def save(data): data["updated"] = datetime.now().isoformat() with open(TODO_FILE, 'w') as f: json.dump(data, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis The task manager does not use the bundled `references/todo.json`. Instead, every operation reads from or writes to a hard-coded path in a separate workspace: `/home/openclaw/.openclaw/workspace/backtest/todo.json` This behavior conflicts with the documented project-local storage model. Commands such as `--list` and `--check` can disclose task metadata from that external workspace, while `--add`, `--done`, `--remove`, `--update`, and `--purge` can modify or delete its records. The script performs no validation that the target resides within an approved directory. It also does not verify file ownership or reject symbolic links. If an attacker who can manipulate the target path replaces the file with a symbolic link, writes may be redirected to another file writable by the script's operating-system identity. ### Attack Path 1. A user or Agent invokes the task manager according to the documented commands. 2. The script ignores the package's `references/todo.json` and resolves the hard-coded external path. 3. A read command exposes titles, notes, deadlines, and other metadata stored by the external workspace. 4. A mutating command overwrites, removes, archives, or purges records in that workspace. 5. If a local attacker can replace the target with a symbolic link, the write may be redirected to anot ...[truncated 691 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Store data within the Skill directory by resolving the path relative to the script: ```python from pathlib import Path PROJECT_ROOT = Path(__file__).resolve().parent.parent TODO_FILE = PROJECT_ROOT / "references" / "todo.json" ``` 2. If configurable storage is required, require an explicit configuration value rather than silently using a path from another workspace. 3. Resolve the canonical path and verify that it remains under an approved storage directory before every read or write. 4. Reject symbolic-link targets where they are not explicitly supported. 5. Verify file ownership and use restrictive permissions, such as owner-only read and write access. 6. Update the documentation and implementation so that they identify the same storage location. ]]>
