T05 · Unauthorized Access and Privilege Escalation
- Location
freezer_inventory_skill.js:59- Finding
Missing Authorization for Administrator-Privileged Database Operations
- Content
View full analysis
{ if (POCKETBASE_ADMIN_TOKEN) { await pb.admins.authWithPassword("admin", POCKETBASE_ADMIN_TOKEN); } })(); ``` ```js export async function handleMessage({ from, message, session }) { if (!pb.authStore.token) { await pb.admins.authWithPassword("admin", POCKETBASE_ADMIN_TOKEN); } const text = message.trim().toLowerCase(); const [command, ...args] = text.split(/\s+/); if (!["inventory", "sold", "schedule"].includes(command)) { return `Unknown command. Available: inventory, sold, schedule`; } ``` ### Technical Analysis The message handler receives the sender identity through `from` and session information through `session`, but neither value is used to authenticate the caller or authorize individual commands. All database operations are instead performed through a shared PocketBase client authenticated as an administrator. Consequently, possession of access to the message handler is treated as sufficient permission to perform inventory and sales operations. This violates least privilege and contradicts the role-based authorization described in `SKILL.md`. The shared global administrator session also broadens the impact of every downstream input-validation flaw. An attacker does not need PocketBase credentials because the Skill acts as an administrator on the attacker's behalf. ### Attack Path 1. An attacker obtains access to the WhatsApp webhook or any OpenClaw route that invokes `handleMessage`. 2. The attacker submits a supported command such as: ```text inventory target-item 500 expiration 2099-12-31 ``` or: ```text sold target-item 100 ``` 3. `handleMessage` accepts the command without v ...[truncated 803 chars]- Remediation
View remediation
