Track vulnerabilities like this one.
Sign up free to get alerted when software you use is affected.
6.0
Safari MCP can run unintended code on web pages
published 6 days ago
Summary
The Safari MCP tool for GitHub Actions builds JavaScript strings incorrectly, allowing specially crafted input to break out of a quoted value and execute extra script on the page. This can let a user who is allowed to run read‑only Safari commands inject and run their own JavaScript, even in tabs they do not own. Update to version 2.22.15, which fixes the string handling, to eliminate the risk.
What to do
- Update GitHub Actions safari-mcp to version 2.22.15.
Affected software
| Ecosystem | Vendor | Product | Affected versions |
|---|---|---|---|
| npm | GitHub Actions | safari-mcp |
< 2.22.15 Fix: upgrade to 2.22.15
|
Original advisory text
Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)
### Impact
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. 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`.
### Patches
Fixed 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.
### 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.
### Credits
Reported privately on 2026-10-09 by Aliaksandr Palei (@fakepooh) under the coordinated-disclosure process in SECURITY.md.
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. 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`.
### Patches
Fixed 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.
### 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.
### Credits
Reported privately on 2026-10-09 by Aliaksandr Palei (@fakepooh) under the coordinated-disclosure process in SECURITY.md.
References
- https://github.com/achiya-automation/safari-mcp/security/advisories/GHSA-4rj4-rc... URL
- https://github.com/achiya-automation/safari-mcp/commit/23f1319defefd2c5cbd06b231... URL
- https://github.com/achiya-automation/safari-mcp Product
- https://github.com/achiya-automation/safari-mcp/releases/tag/v2.22.15 URL
Internet-facing
60 days
Internal
At next upgrade
- Not known to be exploited
- Needs hands-on effort to exploit (estimated)
- Gives an attacker partial control (estimated)
Type
CWE-116Improper Encoding or Escaping of Output
CWE-94Code Injection
Timeline
Published19 Nov 2026
Updated19 Nov 2026
First seen19 Nov 2026
Sources
GHSA-4rj4-rcrq-gr92 · OSV
Track software like this
Free during beta