{"vuln_id":"GHSA-4rj4-rcrq-gr92","aliases":[],"description":"Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)","published_at":"2026-11-19T22:17:05Z","modified_at":"2026-11-19T22:45:06.189447Z","first_seen_at":"2026-11-21T19:15:19.464022Z","severity":"medium","severity_source":"ghsa","cvss_score":6.2,"cvss_vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N","cwe":["CWE-94","CWE-116"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-4rj4-rcrq-gr92"},"matched_alias":null,"items":[{"id":10941,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-4rj4-rcrq-gr92: Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)","summary":"Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)\n\n### Impact\n\nSixteen 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.\n\nSeven 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. The other affected arguments are `ref` in `safari_select_option`, `safari_react_select_set` and `safari_react_select_list_options`, the key in `safari_press_key`, the file name in `safari_upload_file` and `safari_paste_image`, and the first line of the text in `safari_replace_editor`.\n\n### Patches\n\nFixed in 2.22.15: every affected site uses the shared `escJsSingleQuote`, which escapes the backslash before the quote, and a test fails the build if a quote-only escape returns.\n\n### Workarounds\n\nUpgrade 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.\n\n### Credits\n\nReported privately on 2026-10-09 by Aliaksandr Palei (@fakepooh) under the coordinated-disclosure process in SECURITY.md.\n\nAffected: npm:safari-mcp\n\nFixed in: 2.22.15\n\nReferences:\nhttps://github.com/achiya-automation/safari-mcp/security/advisories/GHSA-4rj4-rcrq-gr92\nhttps://github.com/achiya-automation/safari-mcp/commit/23f1319defefd2c5cbd06b23189ab01876a8c5d3\nhttps://github.com/achiya-automation/safari-mcp\nhttps://github.com/achiya-automation/safari-mcp/releases/tag/v2.22.15","url":"https://osv.dev/vulnerability/GHSA-4rj4-rcrq-gr92","published_at":"2026-11-19T22:17:05Z","updated_at":"2026-11-19T22:45:06.189447Z","fetched_at":"2026-11-21T19:15:55.946315Z","severity":"medium","cvss_score":6.2,"epss":null,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"apple","product":"safari-mcp","vuln_id":"GHSA-4rj4-rcrq-gr92","vuln_ids":["GHSA-4RJ4-RCRQ-GR92"],"tags":["osv","npm","fix-available"],"cluster_id":2205,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10941","html":"https://vulnwatch.ve1ve2.com/item/10941"}},{"id":2388,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-4rj4-rcrq-gr92: Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)","summary":"Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)\n\n### Impact\n\nSixteen 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.\n\nSeven 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. The other affected arguments are `ref` in `safari_select_option`, `safari_react_select_set` and `safari_react_select_list_options`, the key in `safari_press_key`, the file name in `safari_upload_file` and `safari_paste_image`, and the first line of the text in `safari_replace_editor`.\n\n### Patches\n\nFixed in 2.22.15: every affected site uses the shared `escJsSingleQuote`, which escapes the backslash before the quote, and a test fails the build if a quote-only escape returns.\n\n### Workarounds\n\nUpgrade 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.\n\n### Credits\n\nReported privately on 2026-10-09 by Aliaksandr Palei (@fakepooh) under the coordinated-disclosure process in SECURITY.md.\n\nAffected packages: npm:safari-mcp\nPatched: safari-mcp 2.22.15","url":"https://github.com/advisories/GHSA-4rj4-rcrq-gr92","published_at":"2026-11-19T22:17:05Z","updated_at":"2026-11-19T22:17:08Z","fetched_at":"2026-11-21T19:15:18.416798Z","severity":"medium","cvss_score":6.2,"epss":null,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"apple","product":"safari-mcp","vuln_id":"GHSA-4rj4-rcrq-gr92","vuln_ids":["GHSA-4RJ4-RCRQ-GR92"],"tags":["ghsa","npm","CWE-94","CWE-116"],"cluster_id":2205,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2388","html":"https://vulnwatch.ve1ve2.com/item/2388"}}]}