T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/browser-login.mjs:369
- Finding
- Unauthenticated Public Control of a Privileged Browser Session<![CDATA[ ## Vulnerability Details **File Location**: `scripts/browser-login.mjs:369-371, 408-419` **Vulnerability Type**: Missing authentication and authorization on a publicly tunneled browser-control service **Risk Level**: Critical ### Vulnerable Code ```javascript server.listen(proxyPort, '0.0.0.0', () => { console.log(`🖥️ Server on port ${proxyPort}`); }); // --- Cloudflared Tunnel --- console.log('🚇 Starting tunnel...'); const tunnel = spawn( CLOUDFLARED, ['tunnel', '--url', `http://localhost:${proxyPort}`], { stdio: ['ignore', 'pipe', 'pipe'] } ); let tunnelUrl = null; const onData = (data) => { const m = data.toString().match(/(https:\/\/[a-z0-9-]+\.trycloudflare\.com)/); if (m && !tunnelUrl) { tunnelUrl = m[1]; console.log(`\n🔗 LOGIN URL: ${tunnelUrl}\n`); } }; ``` ### Technical Analysis The HTTP server listens on every local interface and is then exposed through a public Cloudflare tunnel. No endpoint requires authentication or authorization. The implementation also lacks request-origin validation, CSRF defenses, session-bound capability tokens, and rate limiting. The tunnel hostname is random, but possession or discovery of a URL is not a sufficient substitute for authentication. The URL can leak through chat history, process logs, terminal output, shell-management systems, browser history, screenshots, or monitoring infrastructure. This exceeds the minimum privileges needed to facilitate remote login because every person who can reach the URL receives the same browser-control privileges as the intended user. ### Attack Path 1. The Skill launches the local HTTP service and publishes it through Cloudflare. 2. The tunnel URL is exposed through logs or the messaging channel used to send it to the user. 3. An unauthorized party obtains the URL. 4. The party requests `/screenshot` to inspect the browser's current state. 5. The party invokes endpoints such as `/click`, `/type`, `/navigate`, `/save`, or `/done`. 6. The pa ...[truncated 469 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Require a cryptographically random, single-use bearer token on every HTTP endpoint. - Bind authorization to the intended session and invalidate it immediately when the session ends. - Listen only on `127.0.0.1` rather than `0.0.0.0` when Cloudflared connects locally. - Require POST requests for all state-changing operations. - Validate the `Origin` header and implement CSRF protection. - Add request throttling and lockout controls. - Avoid printing the complete access credential in broadly accessible logs. - Prefer an authenticated Cloudflare Access configuration over an anonymous quick tunnel. - Display a list of active controllers and terminate the session if an unexpected client connects. ]]>
