Vulnerabilities in pkg:npm/safari-mcp
PACKAGEGHSA-4rj4-rcrq-gr92 is a MODERATE javascript injection through single-quoted tool vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting Safari MCP libraries in the npm ecosystem. The issue involves javascript injection through single-quoted tool arguments (backslash not escaped). Remediation is available by upgrading affected packages to version 2.22.15.
pkg:npm/safari-mcp
Vulnerability advisories affecting package pkg:npm/safari-mcp. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-4rj4-rcrq-gr92 | - | MODERATE | Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped) |
GHSA-4rj4-rcrq-gr92 at a Glance
How to Fix GHSA-4rj4-rcrq-gr92
To remediate this vulnerability, upgrade all affected Safari MCP dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install safari-mcp@2.22.15
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls safari-mcp
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-4rj4-rcrq-gr92, inspect your project dependencies using npm:
npm ls safari-mcp
Analyze the terminal output to locate any version of Safari MCP in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.22.15), your application is affected.
Note: The npm ls safari-mcp command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. In Safari MCP, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-4rj4-rcrq-gr92 Affected Safari MCP Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
safari-mcp
|
npm |
< 2.22.15
|
2.22.15
|
References
Frequently Asked Questions
What is GHSA-4rj4-rcrq-gr92?
Which Safari MCP versions are affected?
What version fixes GHSA-4rj4-rcrq-gr92?
Is safari-mcp affected?
What CWE is associated with GHSA-4rj4-rcrq-gr92?
How can I check npm dependencies for GHSA-4rj4-rcrq-gr92?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4rj4-rcrq-gr92",
"modified" : "2026-11-19T22:17:05Z",
"published" : "2026-11-19T22:17:05Z",
"aliases" : [ ],
"summary" : "Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)",
"details" : "### 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.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "safari-mcp"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.22.15"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/achiya-automation/safari-mcp/security/advisories/GHSA-4rj4-rcrq-gr92"
}, {
"type" : "WEB",
"url" : "https://github.com/achiya-automation/safari-mcp/commit/23f1319defefd2c5cbd06b23189ab01876a8c5d3"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/achiya-automation/safari-mcp"
}, {
"type" : "WEB",
"url" : "https://github.com/achiya-automation/safari-mcp/releases/tag/v2.22.15"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-116", "CWE-94" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-11-19T22:17:05Z",
"nvd_published_at" : null
}
}