npm
GHSA-4rj4-rcrq-gr92
Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)
- Severity
- Medium
- Published
- 19 Nov 2026
- Last changed
- 19 Nov 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 2.22.15
- Sources
- OSV.dev and GitHub
Description
Sixteen places in safari.js placed a tool argument inside a single-quoted JavaScript string literal and escaped the single quote without first escaping backslashes. An argument containing a backslash followed by a quote therefore closed the literal, and the rest of the argument ran as JavaScript in the page.
Seven of the affected arguments belong to read-only tools that are exempt from the tab-ownership check: filter in safari_network_details and safari_extract_links, level in safari_console_filter, selector in safari_snapshot, safari_accessibility_snapshot and safari_extract_tables, and dbName / storeName in safari_get_indexed_db. An MCP client limited to read-only tools (with safari_evaluate and safari_run_script excluded from its allowlist) could still run arbitrary page JavaScript through them, including in a tab the session does not own.
Workarounds
Upgrade to 2.22.15. There is no configuration workaround: excluding safari_evaluate and safari_run_script from a client's tool list did not prevent the injection.
Affected software
| Software | Affected versions |
|---|---|
safari-mcpnpm · osv:npm:safari-mcp |
|
About safari-mcp
- Weekly downloads (npm)
- 3,637npm, 24 Nov 2026
This is the only vulnerability in safari-mcp in our list.
References
- GitHub Advisory Database https://github.com/advisories/GHSA-4rj4-rcrq-gr92