GHSA-4rj4-rcrq-gr92: Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)
- Identifier
- GHSA-4rj4-rcrq-gr92
- Published
- Record updated
- Affected
- safari-mcp < 2.22.15
- Fixed in
- 2.22.15
- released October 10, 2026, 40 days before disclosure
Summary
Sixteen sites in `safari.js` of Safari MCP placed tool arguments inside single-quoted JavaScript string literals and escaped the quote without escaping backslashes first. A backslash followed by a quote closed the literal, so the remaining argument text ran as JavaScript in the page, including through seven read-only tools that are exempt from the tab-ownership check. An MCP client restricted to read-only tools with `safari_evaluate` and `safari_run_script` excluded could still execute arbitrary page JavaScript, including in tabs the session does not own.
Mitigation
Fixed in 2.22.15: every affected site now uses the shared `escJsSingleQuote`, which escapes the backslash before the quote, and a test fails the build if a quote-only escape returns. Upgrade to 2.22.15; there is no configuration workaround, since excluding `safari_evaluate` and `safari_run_script` from a client's tool list did not prevent the injection.
Topics
Related items
- CriticalGHSA-9x8x-crjq-g64h: Jupyter MCP Server: Browser DNS rebinding can hijack the Jupyter backend through management routesSimilar attack · GitHub Advisory Database
- HighGHSA-24pw-rf5p-mgp7: Jupyter MCP Server: Unauthenticated management routes can hijack the Jupyter backend in standalone HTTP modeSimilar attack · GitHub Advisory Database
- HighGHSA-m932-63jc-4jqq: k8s-mcp-server: Missing authentication on default SSE/HTTP transport allows unauthenticated Kubernetes tool executionSimilar attack · GitHub Advisory Database
- HighGHSA-3mgh-93r5-r7jf: CodeWhale: exec_shell parallel-readonly classifier auto-approves fd/rg/git grep exec flags enabling silent RCESimilar attack · GitHub Advisory Database
- HighGHSA-qx49-fqc8-xw99: Model Context Protocol Python SDK: OAuth client could send credentials to an authorization server chosen by the MCP serverSimilar attack · GitHub Advisory Database