T05 · Unauthorized Access and Privilege Escalation
- Location
src/index.ts:349- Finding
<![CDATA[Unauthenticated Repair Endpoint Allows Remote Process Restart]]>
- Content
View full analysis
body += chunk); req.on('end', async () => { try { const repair: RepairRequest = JSON.parse(body); console.log('[Repair] Received request:', repair); const result = await this.executeRepair(repair); res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ type: 'repair_ack', timestamp: Date.now(), success: true, result })); ``` ```typescript private async executeRepair(repair: RepairRequest) { switch (repair.action) { case 'check': return await checkSystemHealth(); case 'restart': return await this.restartOpenClaw(); case 'diagnose': return await this.diagnoseLocal(); default: throw new Error(`Unknown repair action: ${repair.action}`); } } private async restartOpenClaw() { console.log('[Repair] Restarting OpenClaw...'); try { await execPromise('pm2 restart openclaw'); return { success: true, message: 'OpenClaw restarted' }; } catch (error: any) { try { await execPromise('systemctl restart openclaw'); return { success: true, message: 'OpenClaw restarted via systemd' }; } catch (e: any) { throw new Error('Failed to restart OpenClaw: ' + e.message); } } } ``` ### Technical Analysis The `/api/repair` endpoint accepts repair requests without authenticating the caller, validating the caller against an authorized peer, or checking whether the caller is permitted to invoke a specific repair operation. A TypeScript type annotation does not provide runtime security validation. When the s ...[truncated 1635 chars]- Remediation
View remediation
