mcp-chrome
- Type
- MCP server
- Scanned
- Nov 12, 2026
- Version
- f48e71751e00
- Files read
- 651
This project pairs a Chrome extension with a local server so AI assistants can control your everyday Chrome browser, automate web tasks, and work with local coding agents. Its biggest risk is that its local server runs without a password and launches coding agents with safety prompts turned off, allowing a malicious website, another program on your computer, or untrusted webpage content to take over your logged-in browser accounts and run commands on your machine.
What it can reach
- Browser
- Full control over your live Chrome profile across all websites, including reading and interacting with open tabs, running scripts on pages, capturing screenshots and network traffic, and reading or changing your history, bookmarks, and downloads.
- Shell commands
- Launches local AI coding tools (Claude Code and Codex) that can run arbitrary terminal commands, and opens local programs like VS Code, system terminals, and folder-picker dialogs.
- Files
- Reads any local file on your computer to upload into websites without asking, saves downloads, logs, temporary files, and local database history (under ~/.chrome-mcp-agent), and writes browser configuration files.
- Network
- Runs a local web server on port 12306, sends custom web requests carrying your browser cookies or bypassing normal website restrictions, and downloads optional AI models from Hugging Face.
- Secrets
- Reads AI API keys and settings from environment variables and ~/.claude-code-router/config.json, and accesses active login cookies, authorization headers, and signed-in web sessions in Chrome.
- System
- Registers a background bridge with Chrome so the browser extension can automatically start and communicate with a local Node.js process on your computer.
Findings
-
CriticalUnauthenticated local HTTP server with bypassable CORS and no DNS rebinding protection
app/native-server/src/server/index.ts:81
As soon as the extension connects to the native host, it starts an HTTP server on 127.0.0.1:12306 exposing /mcp, /sse, /messages, /ask-extension, and /agent/* with no password or token check. Its CORS filter checks 'http://127.0.0.1' using origin.startsWith(pattern), which mistakenly trusts attacker domains like http://127.0.0.1.attacker.com, and allows every installed Chrome or Firefox extension rather than only this extension's ID. In addition, @fastify/cors only omits response headers instead of rejecting disallowed cross-origin requests, and Fastify does not validate the Host header against DNS rebinding. Any website using DNS rebinding or the 127.0.0.1 prefix bypass, any other browser extension, or any local user can invoke browser tools on logged-in tabs and trigger local coding agents.
Fix: Require a cryptographically random bearer token generated by the native host and shared only via Native Messaging, validate the Host header to allow only 127.0.0.1 or localhost, reject disallowed Origin headers in a preHandler hook before route execution, and restrict extension origins to the exact Chrome extension ID.
-
CriticalLocal agent HTTP routes allow unauthenticated command execution and data access
app/native-server/src/server/routes/agent.ts:463
All /agent/* HTTP endpoints on the local Fastify server (port 12306 by default) are registered without any password, token, or Origin header check, and the README confirms authentication is not yet implemented. Any local process or user—and any website the user visits if CORS allows cross-origin requests, via DNS rebinding, or via the extension's background HTTP fetch tool—can create projects pointing to arbitrary directories, configure sessions with custom environment variables or MCP servers, read stored chat histories and attachments, and call /agent/chat/:sessionId/act to execute arbitrary commands on the host machine through Claude Code or Codex.
Fix: Generate a random per-instance bearer token in the native host, share it exclusively with the Chrome extension over Native Messaging, require it on all /agent/* routes, and reject requests with unexpected Origin or Host headers.
-
HighPath traversal in file upload staging allows overwriting or deleting arbitrary local files
app/native-server/src/file-handler.ts:88
When the chrome_upload_file tool prepares base64 data or a downloaded URL for a file input, FileHandler.saveBase64File and FileHandler.downloadFile join the caller-supplied fileName directly onto the temp directory without stripping path traversal sequences and write the buffer with fs.writeFileSync. Similarly, FileHandler.cleanupFile checks filePath.startsWith(this.tempDir) without resolving '..' segments first before calling fs.unlinkSync. If a webpage tricks the AI agent via prompt injection into calling chrome_upload_file with a fileName like '../../../../Users/victim/.zshrc' or '~/.ssh/authorized_keys', the native host will overwrite arbitrary files on the user's computer.
Fix: Sanitize fileName with path.basename(fileName) before joining, and verify path.resolve(filePath).startsWith(path.resolve(this.tempDir) + path.sep) in saveBase64File, downloadFile, and cleanupFile.
-
HighBuilt-in coding agent sessions disable permission prompts and sandboxing by default
app/native-server/src/agent/session-service.ts:203
New AgentChat sessions default to permissionMode 'bypassPermissions' with allowDangerouslySkipPermissions enabled for Claude, while DEFAULT_CODEX_CONFIG in packages/shared/src/agent-types.ts defaults to sandboxMode 'danger-full-access' with instructions to run shell commands autonomously without asking for confirmation. Because Quick Panel AI Chat and the Visual Editor feed untrusted webpage text, selectors, and framework debug attributes into these sessions, a prompt injection hidden in a webpage can cause the coding agent to run arbitrary shell commands and modify files on the host machine without user approval.
Fix: Default sessions to interactive permission prompts and workspace-scoped sandboxing, and require explicit opt-in with a clear UI warning before enabling bypassPermissions or danger-full-access.
-
HighCoding agent engines bypass approvals and OS sandboxing by default while reading untrusted web pages
app/native-server/src/agent/engines/codex.ts:111
CodexEngine hardcodes --dangerously-bypass-approvals-and-sandbox on every codex exec invocation, overriding any configured sandboxMode so sandboxing and command confirmations cannot take effect. Likewise, ClaudeEngine (in claude.ts and db/schema.ts) defaults every session to permissionMode 'bypassPermissions' with allowDangerouslySkipPermissions forced to true. Because Chrome MCP integration is enabled by default for these sessions, prompt injection inside any webpage read by the agent can immediately execute unsandboxed shell commands and modify or exfiltrate local files without user approval.
Fix: Remove --dangerously-bypass-approvals-and-sandbox in CodexEngine so codexConfig.sandboxMode is enforced, and change the default permissionMode in ClaudeEngine and the sessions table schema from 'bypassPermissions' to 'default'.
-
MediumWebpages can control the visual editor via open Shadow DOM and untrusted events
app/chrome-extension/entrypoints/web-editor-v2/ui/shadow-host.ts:3526
When the user turns on Web Editor V2 on a page, mountShadowHost attaches its UI container to the page using attachShadow({ mode: 'open' }), and neither the document event handlers in event-controller.ts nor the Apply button handler in toolbar.ts check event.isTrusted. A malicious webpage can access host.shadowRoot, programmatically simulate editing an element containing attacker-chosen instructions, and call .click() on the Apply button to send a web_editor_apply_batch request to the local coding agent without the user clicking Apply. Element Marker (element-marker.js) likewise uses an open Shadow DOM without checking event.isTrusted on its Execute button.
Fix: Attach editor overlays with attachShadow({ mode: 'closed' }) without exposing the shadow root on DOM properties, and verify event.isTrusted === true on pointer, keyboard, and button handlers that trigger edits or background actions.
-
MediumUnescaped HTML and unverified cross-origin iframe messages cause XSS in recorded pages
app/chrome-extension/inject-scripts/recorder.js:328
While workflow recording is active, recorder.js renders recorded step descriptions (including element selectors, input values, and URLs) into the page DOM using innerHTML without escaping HTML characters. In addition, _onWindowMessage accepts rr_iframe_event postMessage payloads from any cross-origin iframe on the page and forwards them to the background script, which broadcasts timeline updates to all recorded tabs. A malicious cross-origin iframe or crafted element attribute on a recorded page can inject HTML such as an img onerror payload to run arbitrary JavaScript in the top-level origin of every tab being recorded.
Fix: Build timeline list items using document.createElement and textContent instead of innerHTML, and authenticate cross-frame recorder messages or handle iframe recording via chrome.runtime messaging with sender.frameId in the background script.
-
LowPredictable temporary file path used during system-level host registration
app/native-server/src/scripts/utils.ts:418
registerWithElevatedPermissions writes the Native Messaging manifest to a fixed filename in the shared temp directory (/tmp/com.chromemcp.nativehost.json) before copying it to the system-wide Chrome directory or instructing the user to copy it with sudo. On a multi-user machine, another local user can pre-create that file so the unprivileged write fails and a subsequent sudo copy installs an attacker-controlled native host binary path, or exploit symlinks on systems without symlink protection.
Fix: Write directly to manifestPath when already running with elevated privileges, or create a private temporary directory with fs.mkdtempSync before writing the manifest.
-
LowMissing path separator in allowed workspace directory prefix check
app/native-server/src/agent/project-service.ts:68
validateRootPath checks whether a candidate project path is inside an allowed base directory using absolute.startsWith(path.resolve(base)) without requiring a trailing path separator. This allows sibling directories that share the same prefix (for example, /Users/alice-other when the home directory is /Users/alice) to pass validation.
Fix: Check that absolute === resolvedBase || absolute.startsWith(resolvedBase + path.sep) for each allowed base directory.
-
LowWorkflow conditional node evaluates expressions with new Function in the privileged extension background context
app/chrome-extension/entrypoints/background/record-replay/nodes/conditional.ts:17
While scheduler.ts uses a restricted expression parser (evalExpression) that blocks access to global scope, the legacy ifNode handler compiles branch and condition expressions using new Function inside the extension background script. Because legacy mode is the default (and hybrid mode still delegates 'if' steps to ifNode), importing and running an untrusted workflow JSON in environments where CSP permits unsafe-eval (such as Firefox builds) can execute arbitrary JavaScript with full background chrome.* extension API privileges.
Fix: Replace both new Function calls in conditional.ts with the existing safe evalExpression(code, { vars: ctx.vars }) evaluator from ../engine/utils/expression.
-
LowPersistent userscript injection ignores configured URL exclusion patterns
app/chrome-extension/entrypoints/background/tools/browser/userscript.ts:162
UserscriptTool accepts an excludes list (from tool arguments, @exclude Tampermonkey metadata, and the Options UI) and saves it to storage, but reinjectForTab, onCommitted, onDOMContentLoaded, and initial injection in create() only check rec.matches and never check rec.excludes. Users or agents that exclude sensitive paths or subdomains (such as login or billing pages) from a broadly scoped userscript will still have the script injected onto those excluded pages.
Fix: Check if (rec.excludes?.length && matchUrl(rec.excludes, url)) continue; before injecting in create(), reinjectForTab, onCommitted, and onDOMContentLoaded.
-
LowRecord-Replay V3 RPC server accepts Port connections without verifying sender origin
app/chrome-extension/entrypoints/background/record-replay-v3/engine/transport/rpc-server.ts:122
RpcServer exposes privileged workflow management and execution methods (rr_v3.saveFlow, rr_v3.createTrigger, rr_v3.enqueueRun) over chrome.runtime.onConnect for extension UI pages, but handleConnect only checks port.name and never validates port.sender. Any content script running inside a compromised web renderer process can connect to the rr_v3 port to create and run workflows that execute scripts across other tabs, issue CORS-free background HTTP requests, or upload local files via CDP.
Fix: Validate port.sender in handleConnect by requiring port.sender?.id === chrome.runtime.id and port.sender?.url?.startsWith(chrome.runtime.getURL('')) before accepting the connection.
-
LowUnescaped backslash in file-upload CSS selector allows JavaScript injection into Runtime.evaluate
app/chrome-extension/entrypoints/background/tools/browser/file-upload.ts:126
After setting input files via CDP, FileUploadTool dispatches a change event by interpolating selector into a single-quoted JavaScript string in Runtime.evaluate, escaping only single quotes without escaping backslashes or newlines. A CSS selector list containing an escaped quote inside an attribute selector (such as input[type=file],[x="\');...//"]) passes DOM.querySelector validation and breaks out of the JavaScript string literal to run arbitrary code in the page context.
Fix: Pass the selector safely using JSON.stringify(selector) instead of manual string replacement: document.querySelector(${JSON.stringify(selector)}).
-
LowRecommended pnpm install command permanently enables lifecycle scripts globally
The Quick Start guide recommends running 'pnpm config set enable-pre-post-scripts true' before installing mcp-chrome-bridge. Because 'pnpm config set' saves this setting globally, every unrelated package the user installs with pnpm afterward will automatically execute preinstall and postinstall scripts without asking, weakening pnpm's built-in protection against malicious npm packages.
Fix: Recommend installing the package normally and running 'mcp-chrome-bridge register' (currently listed as Method 2) instead of changing the user's global pnpm configuration.
