T05 · Unauthorized Access and Privilege Escalation
- Location
src/handler.js:31- Finding
Unrestricted Database Path Permits Access to Unintended Local Databases
- Content
View full analysis
{ const db = new sqlite3.Database(dbPath, (err) => { if (err) reject(err); else resolve(db); }); }); } ``` ### Technical Analysis The `--db-path` argument is accepted directly from the caller and stored as the active database path. The path is subsequently passed to `sqlite3.Database` without canonicalization, an allowlisted root directory, file ownership validation, symlink checks, or caller authorization. SQL parameterization elsewhere prevents SQL injection, but it does not mitigate this access-control problem. A caller who can invoke the Skill can select any SQLite-compatible file readable by the OpenClaw Gateway process. If that database contains the expected `visitors` and `messages` tables, its records can be collected and incorporated into a subagent prompt. The database is opened using the Gateway process's privileges rather than privileges restricted to the invoking user. This creates a confused-deputy condition and violates least privilege. ### Attack Path 1. An attacker obtains permission to invoke the `voko-subagent` Skill. 2. The attacker supplies `--mode=build-and-handle` and an arbitrary `--db-path` pointing to another accessible SQLite database. 3. `handleVisitorMessage` accepts and stores the path without validating its location or ownership. 4. `buildPrompt` opens the selected file under the Gateway process's filesystem privileges. 5. Records from compatible `visitors` and `messages` tables are read and placed into the subagent task. 6. The subagent processe ...[truncated 553 chars]- Remediation
View remediation
