GHSA-4rj4-rcrq-gr92: Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)
Published 2026-11-19 · Updated 2026-11-19
Summary
The safari-mcp package contains an improper neutralization of input during web page code generation, allowing for arbitrary JavaScript injection via specially crafted tool arguments. Users must upgrade to version 2.22.15 to mitigate this vulnerability.
Who is affected
The vulnerability affects 16 arguments across multiple Safari MCP tools, where improper escaping of backslashes allows an attacker to break out of single-quoted string literals. Notably, several read-only tools are affected, meaning even clients restricted from running arbitrary scripts can still execute code within the context of a browser tab.
Exploitability
The vulnerability is rated as Medium severity, requiring local access with low attack complexity and no user interaction. According to the CVSS 4.0 vector, it poses a high risk to system confidentiality and integrity, though CISA KEV data indicates no evidence of active exploitation.
Remediation
- Upgrade the safari-mcp package to version 2.22.15 or later.
- Verify that the updated package correctly utilizes the shared escJsSingleQuote function for all tool argument handling.
How to check your project
- Check the package.json file in your project to see if 'safari-mcp' is listed with a version number less than 2.22.15.
- Run 'npm list safari-mcp' in your terminal to identify the current installed version of the package.
Automated analysis of the published advisory data, generated 2026-11-19. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| npm | safari-mcp |
>= 0, < 2.22.15 | 2.22.15 | npm install [email protected] |
CVSS 4.0 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
| Attack vector | Local |
|---|---|
| Attack complexity | Low |
| Attack requirements | None |
| Privileges required | Low |
| User interaction | None |
| Confidentiality (vulnerable system) | None |
| Integrity (vulnerable system) | None |
| Availability (vulnerable system) | None |
| Confidentiality (subsequent systems) | High |
| Integrity (subsequent systems) | High |
| Availability (subsequent systems) | None |
Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.
FAQ
Can I mitigate this by excluding sensitive tools from my allowlist?
No. The vulnerability affects several read-only tools, meaning even if you restrict tools like safari_evaluate, the injection can still be triggered via other affected parameters.
Is this vulnerability actively being exploited in the wild?
There is no evidence of active exploitation; CISA KEV status is reported as no.
What specifically caused the injection?
The flaw was caused by failing to escape backslashes before escaping single quotes when placing tool arguments into JavaScript string literals, allowing an attacker to escape the literal context.
Original advisory description
References
- WEB https://github.com/achiya-automation/safari-mcp/security/advisories/GHSA-4rj4-rcrq-gr92
- WEB https://github.com/achiya-automation/safari-mcp/commit/23f1319defefd2c5cbd06b23189ab01876a8c5d3
- PACKAGE https://github.com/achiya-automation/safari-mcp
- WEB https://github.com/achiya-automation/safari-mcp/releases/tag/v2.22.15
Source records: GHSA-4rj4-rcrq-gr92 (OSV.dev).