T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/cdp-proxy.mjs:275- Finding
Unauthenticated Local API Provides Full Control of the User's Authenticated Browser
- Content
View full analysis
t.type === 'page'); res.end(JSON.stringify(pages, null, 2)); } ``` ```javascript else if (pathname === '/eval') { const sid = await ensureSession(q.target); const body = await readBody(req); const expr = body || q.expr || 'document.title'; const resp = await sendCDP('Runtime.evaluate', { expression: expr, returnByValue: true, awaitPromise: true, }, sid); if (resp.result?.result?.value !== undefined) { res.end(JSON.stringify({ value: resp.result.result.value })); } else if (resp.result?.exceptionDetails) { res.statusCode = 400; res.end(JSON.stringify({ error: resp.result.exceptionDetails.text })); } else { res.end(JSON.stringify(resp.result)); } } ``` ```javascript server.listen(PORT, '127.0.0.1', () => { console.log(`[CDP Proxy] Running at http://localhost:${PORT}`); connect().catch(e => console.error( '[CDP Proxy] Initial connection failed:', e.message )); }); ``` The proxy is also launched as a detached process: ```javascript const child = spawn(process.execPath, [PROXY_SCRIPT], { detached: true, stdio: ['ignore', logFd, logFd], ...(os.platform() === 'win32' ? { windowsHide: true } : {}), }); child.unref(); ``` ### Technical Analysis The proxy binds only to `127.0.0.1`, which reduces remote network exposure, but it does not authenticate callers or authorize individual operations. Any local process able to connect to the configured port can invoke all API endpoints. The exposed operations include: - Enumerating all existing browser tabs throug ...[truncated 2316 chars]- Remediation
View remediation
