GHSA-4rj4-rcrq-gr92

Suggest an improvement
Source
https://github.com/advisories/GHSA-4rj4-rcrq-gr92
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-4rj4-rcrq-gr92/GHSA-4rj4-rcrq-gr92.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-4rj4-rcrq-gr92
Published
2026-11-19T22:17:05Z
Modified
2026-11-19T22:45:06Z
Severity
  • 6.2 (Medium) CVSS_V4 - 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 CVSS Calculator
Summary
Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)
Details

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.

Database specific
{
    "cwe_ids": [
        "CWE-116",
        "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-19T22:17:05Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
}
References

Affected packages

npm / safari-mcp

Package

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
2.22.15

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-4rj4-rcrq-gr92/GHSA-4rj4-rcrq-gr92.json"