T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/server.py:104- Finding
Unauthenticated Local Browser-Control Service Exposes Arbitrary Navigation and JavaScript Execution
- Content
View full analysis
Vulnerability Details
File Location:
scripts/server.py:104-124,scripts/server.py:127-164,scripts/server.py:174-181
Vulnerability Type: Missing authentication and authorization on a privileged browser-control interface
Risk Level: HighVulnerable Code
python async def evaluate(self, script): if not self.page: return {"status": "error", "message": "No page open"} result = await self.page.evaluate(script) return {"status": "success", "result": result} async def handle_call(self, data): tool = data.get("tool") args = data.get("args", {}) handlers = { "launch": lambda: self.start_browser(args.get("headless", False)), "close": self.close_browser, "navigate": lambda: self.navigate(args["url"]), "screenshot": lambda: self.screenshot(args.get("path", "screenshot.png"), args.get("full_page", False)), "click": lambda: self.click(args["selector"]), "type": lambda: self.type_text(args["selector"], args["text"]), "get_text": lambda: self.get_text(args["selector"]), "get_url": self.get_url, "get_title": self.get_title, "evaluate": lambda: self.evaluate(args["script"]), } if tool not in handlers: return {"status": "error", "message": f"Unknown tool: {tool}"}python async def handle_client(self, reader, writer): try: data = await reader.read(65536) request = json.loads(data.decode()) if request.get("cmd") == "stop": self.running = False response = {"status": "success", "message": "Server stopping"} elif request.get("cmd") == "status": response = {"status": "success", "browser": self.browser is not None, "page": self.page is not None} else: response = await self.handle_call(request) writer.write(json.dumps(response).encode()) await writer.drain() except Exception as e: writer.write(js ...[truncated 3444 chars]- Remediation
View remediation
Remediation Suggestions
- Replace the TCP listener with a Unix-domain socket stored in a directory accessible only to the owning user, and set restrictive filesystem permissions.
- If TCP must be used, generate a cryptographically random token for each server launch and require constant-time token validation on every request.
- Do not place authentication secrets in command-line arguments; use a permission-controlled file descriptor, environment mechanism, or protected token file.
- Restrict navigation to explicitly approved schemes, hosts, address ranges, and ports. Resolve hostnames and validate all resulting addresses to prevent DNS-based allowlist bypasses.
- Deny link-local metadata endpoints and other sensitive internal targets unless specifically required.
- Remove
evaluatefrom the default command set. If it is required, place it behind an explicit high-risk opt-in and an additional authorization check. - Use isolated browser contexts for separate authorized clients rather than sharing one persistent page and session.
- Add request-size limits, read timeouts, schema validation, rate limiting, and structured security logging.
- Ensure the primary documentation clearly discloses the
evaluatecapability and its security implications.
